diff -Nru gearmand-0.14/aclocal.m4 gearmand-0.23/aclocal.m4 --- gearmand-0.14/aclocal.m4 2010-06-30 20:31:19.000000000 +0200 +++ gearmand-0.23/aclocal.m4 2011-06-29 22:59:27.000000000 +0200 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, -[m4_warning([this file was generated for autoconf 2.65. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.66],, +[m4_warning([this file was generated for autoconf 2.66. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -776,6 +776,23 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 @@ -1011,37 +1028,38 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([m4/ac_cxx_compile_stdcxx_0x.m4]) -m4_include([m4/ac_cxx_header_stdcxx_98.m4]) m4_include([m4/acx_pthread.m4]) +m4_include([m4/boost.m4]) m4_include([m4/extensions.m4]) m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) m4_include([m4/lib-prefix.m4]) +m4_include([m4/libdrizzle.m4]) +m4_include([m4/libmemcached.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) +m4_include([m4/memcached.m4]) m4_include([m4/pandora_64bit.m4]) m4_include([m4/pandora_canonical.m4]) m4_include([m4/pandora_check_compiler_version.m4]) m4_include([m4/pandora_check_cxx_standard.m4]) +m4_include([m4/pandora_cinttypes.m4]) m4_include([m4/pandora_clock_gettime.m4]) +m4_include([m4/pandora_cstdint.m4]) m4_include([m4/pandora_enable_dtrace.m4]) -m4_include([m4/pandora_ensure_gcc_version.m4]) m4_include([m4/pandora_extensions.m4]) m4_include([m4/pandora_have_better_malloc.m4]) m4_include([m4/pandora_have_gcc_atomics.m4]) -m4_include([m4/pandora_have_libdrizzle.m4]) m4_include([m4/pandora_have_libevent.m4]) -m4_include([m4/pandora_have_libgtest.m4]) -m4_include([m4/pandora_have_libmemcached.m4]) m4_include([m4/pandora_have_libpq.m4]) m4_include([m4/pandora_have_libsqlite3.m4]) m4_include([m4/pandora_have_libtokyocabinet.m4]) m4_include([m4/pandora_have_libuuid.m4]) m4_include([m4/pandora_header_assert.m4]) +m4_include([m4/pandora_header_stdcxx_98.m4]) m4_include([m4/pandora_libtool.m4]) m4_include([m4/pandora_optimize.m4]) m4_include([m4/pandora_platform.m4]) @@ -1051,6 +1069,6 @@ m4_include([m4/pandora_version.m4]) m4_include([m4/pandora_visibility.m4]) m4_include([m4/pandora_warnings.m4]) -m4_include([m4/pandora_with_gettext.m4]) -m4_include([m4/pandora_with_memcached.m4]) +m4_include([m4/pandora_with_valgrind.m4]) m4_include([m4/pkg.m4]) +m4_include([m4/socket_send_flags.m4]) diff -Nru gearmand-0.14/AUTHORS gearmand-0.23/AUTHORS --- gearmand-0.14/AUTHORS 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/AUTHORS 2011-06-08 08:01:33.000000000 +0200 @@ -1,2 +1,13 @@ -Brian Aker - brian@tangent.org -Eric Day - eday@oddments.org +Brian Aker brian@tangent.org +John Ewart john@johnewart.net, Initial Epoch support +Eric Day eday@oddments.org +Trond Norbye trond.norbye@gmail.com +Brian Moon +Cory Bennett +Clint clint@fewbar.com +cmooney@concentric.com +Jedi/Sector One +Piotr Sikora +Joe Daly +Steve Yen +Rhett Garber diff -Nru gearmand-0.14/benchmark/benchmark.c gearmand-0.23/benchmark/benchmark.c --- gearmand-0.14/benchmark/benchmark.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/benchmark/benchmark.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Common benchmark functions - */ - -#include "benchmark.h" - -/* - * Public definitions - */ - -void benchmark_init(gearman_benchmark_st *benchmark) -{ - memset(benchmark, 0, sizeof(gearman_benchmark_st)); - gettimeofday(&(benchmark->total), NULL); - gettimeofday(&(benchmark->begin), NULL); -} - -void benchmark_check_time(gearman_benchmark_st *benchmark) -{ - benchmark->jobs++; - - gettimeofday(&(benchmark->end), NULL); - if (benchmark->end.tv_sec != benchmark->begin.tv_sec) - { - benchmark->total_jobs+= benchmark->jobs; - - printf("[Current: %6"PRIu64" jobs/s, Total: %6"PRIu64" jobs/s]\n", - ((uint64_t)(benchmark->jobs) * 1000000) / - ((((uint64_t)(benchmark->end.tv_sec) * 1000000) + - (uint64_t)(benchmark->end.tv_usec)) - - (((uint64_t)(benchmark->begin.tv_sec) * 1000000) + - (uint64_t)(benchmark->begin.tv_usec))), - ((uint64_t)(benchmark->total_jobs) * 1000000) / - ((((uint64_t)(benchmark->end.tv_sec) * 1000000) + - (uint64_t)(benchmark->end.tv_usec)) - - (((uint64_t)(benchmark->total.tv_sec) * 1000000) + - (uint64_t)(benchmark->total.tv_usec)))); - - benchmark->jobs= 0; - gettimeofday(&(benchmark->begin), NULL); - } -} diff -Nru gearmand-0.14/benchmark/benchmark.cc gearmand-0.23/benchmark/benchmark.cc --- gearmand-0.14/benchmark/benchmark.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/benchmark/benchmark.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,45 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Common benchmark functions + */ + +#include +#include + +/* + * Public definitions + */ + +void benchmark_check_time(gearman_benchmark_st *benchmark) +{ + benchmark->jobs++; + + gettimeofday(&(benchmark->end), NULL); + if (benchmark->end.tv_sec != benchmark->begin.tv_sec) + { + benchmark->total_jobs+= benchmark->jobs; + + printf("[Current: %6"PRIu64" jobs/s, Total: %6"PRIu64" jobs/s]\n", + (uint64_t(benchmark->jobs) * 1000000) / + (((uint64_t(benchmark->end.tv_sec) * 1000000) + + uint64_t(benchmark->end.tv_usec)) - + ((uint64_t(benchmark->begin.tv_sec) * 1000000) + + uint64_t(benchmark->begin.tv_usec))), + (uint64_t(benchmark->total_jobs) * 1000000) / + (((uint64_t(benchmark->end.tv_sec) * 1000000) + + uint64_t(benchmark->end.tv_usec)) - + ((uint64_t(benchmark->total.tv_sec) * 1000000) + + uint64_t(benchmark->total.tv_usec)))); + + benchmark->jobs= 0; + gettimeofday(&(benchmark->begin), NULL); + } +} diff -Nru gearmand-0.14/benchmark/benchmark.h gearmand-0.23/benchmark/benchmark.h --- gearmand-0.14/benchmark/benchmark.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/benchmark/benchmark.h 2011-06-29 22:18:02.000000000 +0200 @@ -11,10 +11,9 @@ * @brief Common benchmark header */ -#ifndef __GEARMAN_BENCHMARK_H__ -#define __GEARMAN_BENCHMARK_H__ +#pragma once -#include "config.h" +#include #include @@ -54,7 +53,7 @@ * @addtogroup benchmark Common Benchmark Utilities * @{ */ -typedef struct +struct gearman_benchmark_st { bool background; uint8_t verbose; @@ -63,18 +62,20 @@ struct timeval total; struct timeval begin; struct timeval end; -} gearman_benchmark_st; -/** - * Initialize a benchmark strucutre. - */ -void benchmark_init(gearman_benchmark_st *benchmark); + gearman_benchmark_st() : + background(false), + verbose(0), + total_jobs(0), + jobs(0), + end() + { + gettimeofday(&total, NULL); + gettimeofday(&begin, NULL); + } +}; /** * Check and possibly print time. */ void benchmark_check_time(gearman_benchmark_st *benchmark); - -/** @} */ - -#endif /* __GEARMAN_BENCHMARK_H__ */ diff -Nru gearmand-0.14/benchmark/blobslap_client.c gearmand-0.23/benchmark/blobslap_client.c --- gearmand-0.14/benchmark/blobslap_client.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/benchmark/blobslap_client.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,338 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Blob slap client utility - */ - -#include "benchmark.h" - -#define BLOBSLAP_DEFAULT_NUM_TASKS 10 -#define BLOBSLAP_DEFAULT_BLOB_MIN_SIZE 0 -#define BLOBSLAP_DEFAULT_BLOB_MAX_SIZE 1024 -#define BLOBSLAP_BUFFER_SIZE 8192 - -static gearman_return_t _created(gearman_task_st *task); -static gearman_return_t _data(gearman_task_st *task); -static gearman_return_t _status(gearman_task_st *task); -static gearman_return_t _complete(gearman_task_st *task); -static gearman_return_t _fail(gearman_task_st *task); - -static void _usage(char *name); - -int main(int argc, char *argv[]) -{ - gearman_benchmark_st benchmark; - int c; - char *host= NULL; - in_port_t port= 0; - const char *function= GEARMAN_BENCHMARK_DEFAULT_FUNCTION; - uint32_t num_tasks= BLOBSLAP_DEFAULT_NUM_TASKS; - size_t min_size= BLOBSLAP_DEFAULT_BLOB_MIN_SIZE; - size_t max_size= BLOBSLAP_DEFAULT_BLOB_MAX_SIZE; - uint32_t count= 1; - gearman_return_t ret; - gearman_client_st client; - gearman_task_st *tasks; - char *blob; - size_t blob_size; - uint32_t x; - - benchmark_init(&benchmark); - - if (gearman_client_create(&client) == NULL) - { - fprintf(stderr, "Memory allocation failure on client creation\n"); - exit(1); - } - - gearman_client_add_options(&client, GEARMAN_CLIENT_UNBUFFERED_RESULT); - - while ((c= getopt(argc, argv, "bc:f:h:m:M:n:p:s:v")) != -1) - { - switch(c) - { - case 'b': - benchmark.background= true; - break; - - case 'c': - count= (uint32_t)atoi(optarg); - break; - - case 'f': - function= optarg; - break; - - case 'h': - host= optarg; - ret= gearman_client_add_server(&client, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - break; - - case 'm': - min_size= (size_t)atoi(optarg); - break; - - case 'M': - max_size= (size_t)atoi(optarg); - break; - - case 'n': - num_tasks= (uint32_t)atoi(optarg); - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - case 's': - srand((unsigned int)atoi(optarg)); - break; - - case 'v': - benchmark.verbose++; - break; - - default: - gearman_client_free(&client); - _usage(argv[0]); - exit(1); - } - } - - if (host == NULL) - { - ret= gearman_client_add_server(&client, NULL, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - } - - if (min_size > max_size) - { - fprintf(stderr, "Min data size must be smaller than max data size\n"); - exit(1); - } - - if (num_tasks == 0) - { - fprintf(stderr, "Number of tasks must be larger than zero\n"); - exit(1); - } - - tasks= malloc(num_tasks * sizeof(gearman_task_st)); - if (tasks == NULL) - { - fprintf(stderr, "Memory allocation failure on malloc\n"); - exit(1); - } - - blob= malloc(max_size); - if (blob == NULL) - { - fprintf(stderr, "Memory allocation failure on malloc\n"); - exit(1); - } - - memset(blob, 'x', max_size); - - while (1) - { - for (x= 0; x < num_tasks; x++) - { - if (min_size == max_size) - blob_size= max_size; - else - { - blob_size= (size_t)rand(); - - if (max_size > RAND_MAX) - blob_size*= (size_t)(rand() + 1); - - blob_size= (blob_size % (max_size - min_size)) + min_size; - } - - if (benchmark.background) - { - (void)gearman_client_add_task_background(&client, &(tasks[x]), - &benchmark, function, NULL, - (void *)blob, blob_size, &ret); - } - else - { - (void)gearman_client_add_task(&client, &(tasks[x]), &benchmark, - function, NULL, (void *)blob, blob_size, - &ret); - } - - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - } - - gearman_client_set_created_fn(&client, _created); - gearman_client_set_data_fn(&client, _data); - gearman_client_set_status_fn(&client, _status); - gearman_client_set_complete_fn(&client, _complete); - gearman_client_set_fail_fn(&client, _fail); - ret= gearman_client_run_tasks(&client); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - for (x= 0; x < num_tasks; x++) - gearman_task_free(&(tasks[x])); - - if (count > 0) - { - count--; - if (count == 0) - break; - } - } - - free(blob); - free(tasks); - gearman_client_free(&client); - - return 0; -} - -static gearman_return_t _created(gearman_task_st *task) -{ - gearman_benchmark_st *benchmark; - - benchmark= (gearman_benchmark_st *)gearman_task_context(task); - - if (benchmark->background && benchmark->verbose > 0) - benchmark_check_time(benchmark); - - if (benchmark->verbose > 2) - printf("Created: %s\n", gearman_task_job_handle(task)); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _status(gearman_task_st *task) -{ - gearman_benchmark_st *benchmark; - - benchmark= (gearman_benchmark_st *)gearman_task_context(task); - - if (benchmark->verbose > 2) - { - printf("Status: %s (%u/%u)\n", gearman_task_job_handle(task), - gearman_task_numerator(task), gearman_task_denominator(task)); - } - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _data(gearman_task_st *task) -{ - gearman_benchmark_st *benchmark; - char buffer[BLOBSLAP_BUFFER_SIZE]; - size_t size; - gearman_return_t ret; - - benchmark= (gearman_benchmark_st *)gearman_task_context(task); - - while (1) - { - size= gearman_task_recv_data(task, buffer, BLOBSLAP_BUFFER_SIZE, &ret); - if (ret != GEARMAN_SUCCESS) - return ret; - if (size == 0) - break; - } - - if (benchmark->verbose > 2) - { - printf("Data: %s %zu\n", gearman_task_job_handle(task), - gearman_task_data_size(task)); - } - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _complete(gearman_task_st *task) -{ - gearman_benchmark_st *benchmark; - char buffer[BLOBSLAP_BUFFER_SIZE]; - size_t size; - gearman_return_t ret; - - benchmark= (gearman_benchmark_st *)gearman_task_context(task); - - while (1) - { - size= gearman_task_recv_data(task, buffer, BLOBSLAP_BUFFER_SIZE, &ret); - if (ret != GEARMAN_SUCCESS) - return ret; - if (size == 0) - break; - } - - if (benchmark->verbose > 0) - benchmark_check_time(benchmark); - - if (benchmark->verbose > 1) - { - printf("Completed: %s %zu\n", gearman_task_job_handle(task), - gearman_task_data_size(task)); - } - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _fail(gearman_task_st *task) -{ - gearman_benchmark_st *benchmark; - - benchmark= (gearman_benchmark_st *)gearman_task_context(task); - - if (benchmark->verbose > 0) - benchmark_check_time(benchmark); - - if (benchmark->verbose > 1) - printf("Failed: %s\n", gearman_task_job_handle(task)); - - return GEARMAN_SUCCESS; -} - -static void _usage(char *name) -{ - printf("\nusage: %s\n" - "\t[-c count] [-f ] [-h ] [-m ]\n" - "\t[-M ] [-n ] [-p ] [-s] [-v]\n\n", name); - printf("\t-c - number of times to run all tasks\n"); - printf("\t-f - function name for tasks (default %s)\n", - GEARMAN_BENCHMARK_DEFAULT_FUNCTION); - printf("\t-h - job server host, can specify many\n"); - printf("\t-m - minimum blob size (default %d)\n", - BLOBSLAP_DEFAULT_BLOB_MIN_SIZE); - printf("\t-M - maximum blob size (default %d)\n", - BLOBSLAP_DEFAULT_BLOB_MAX_SIZE); - printf("\t-n - number of tasks to run at once (default %d)\n", - BLOBSLAP_DEFAULT_NUM_TASKS); - printf("\t-p - job server port\n"); - printf("\t-s - seed random number for blobsize with \n"); - printf("\t-v - increase verbose level\n"); -} diff -Nru gearmand-0.14/benchmark/blobslap_client.cc gearmand-0.23/benchmark/blobslap_client.cc --- gearmand-0.14/benchmark/blobslap_client.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/benchmark/blobslap_client.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,370 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Blob slap client utility + */ + +#include +#include + +#define BLOBSLAP_DEFAULT_NUM_TASKS 10 +#define BLOBSLAP_DEFAULT_BLOB_MIN_SIZE 0 +#define BLOBSLAP_DEFAULT_BLOB_MAX_SIZE 1024 +#define BLOBSLAP_BUFFER_SIZE 8192 + +static gearman_return_t _created(gearman_task_st *task); +static gearman_return_t _data(gearman_task_st *task); +static gearman_return_t _status(gearman_task_st *task); +static gearman_return_t _complete(gearman_task_st *task); +static gearman_return_t _fail(gearman_task_st *task); + +static void _usage(char *name); + +int main(int argc, char *argv[]) +{ + gearman_benchmark_st benchmark; + int c; + char *host= NULL; + in_port_t port= 0; + const char *function= GEARMAN_BENCHMARK_DEFAULT_FUNCTION; + uint32_t num_tasks= BLOBSLAP_DEFAULT_NUM_TASKS; + size_t min_size= BLOBSLAP_DEFAULT_BLOB_MIN_SIZE; + size_t max_size= BLOBSLAP_DEFAULT_BLOB_MAX_SIZE; + unsigned long int count= 1; + gearman_client_st client; + bool shutdown_worker= false; + + if (not gearman_client_create(&client)) + { + std::cerr << "Failed to allocate memory for client" << std::endl; + exit(EXIT_FAILURE); + } + + gearman_client_add_options(&client, GEARMAN_CLIENT_UNBUFFERED_RESULT); + + while ((c= getopt(argc, argv, "bc:f:h:m:M:n:p:s:ve")) != -1) + { + switch(c) + { + case 'b': + benchmark.background= true; + break; + + case 'c': + count= strtoul(optarg, NULL, 10); + break; + + case 'f': + function= optarg; + break; + + case 'h': + { + if (gearman_failed(gearman_client_add_server(&client, host, port))) + { + std::cerr << "Failed while adding server " << host << ":" << port << " :" << gearman_client_error(&client) << std::endl; + exit(EXIT_FAILURE); + } + } + break; + + case 'm': + min_size= static_cast(strtoul(optarg, NULL, 10)); + break; + + case 'M': + max_size= static_cast(strtoul(optarg, NULL, 10)); + break; + + case 'n': + num_tasks= uint32_t(strtoul(optarg, NULL, 10)); + break; + + case 'p': + port= in_port_t(atoi(optarg)); + break; + + case 's': + srand(uint32_t(atoi(optarg))); + break; + + case 'e': + shutdown_worker= true; + break; + + case 'v': + benchmark.verbose++; + break; + + default: + gearman_client_free(&client); + _usage(argv[0]); + exit(EXIT_FAILURE); + } + } + + if (not host) + { + if (gearman_failed(gearman_client_add_server(&client, NULL, port))) + { + std::cerr << "Failing to add localhost:" << port << " :" << gearman_client_error(&client) << std::endl; + exit(EXIT_FAILURE); + } + } + + if (min_size > max_size) + { + std::cerr << "Min data size must be smaller than max data size" << std::endl; + exit(EXIT_FAILURE); + } + + if (num_tasks == 0) + { + std::cerr << "Number of tasks must be larger than zero\n" << std::endl; + exit(EXIT_FAILURE); + } + + gearman_task_st *tasks= new gearman_task_st[num_tasks]; + if (not tasks) + { + std::cerr << "Failed to allocate " << num_tasks << " tasks" << std::endl; + exit(EXIT_FAILURE); + } + + char *blob= new char[max_size]; + if (not blob) + { + std::cerr << "Failed to allocate blob with length of " << max_size << std::endl; + exit(EXIT_FAILURE); + } + memset(blob, 'x', max_size); + + bool error= false; + do + { + for (uint32_t x= 0; x < num_tasks; x++) + { + size_t blob_size; + + if (min_size == max_size) + { + blob_size= max_size; + } + else + { + blob_size= size_t(rand()); + + if (max_size > RAND_MAX) + blob_size*= size_t(rand()) + 1; + + blob_size= (blob_size % (max_size - min_size)) + min_size; + } + + const char *blob_ptr= blob_size ? blob : NULL; + + gearman_return_t ret; + if (benchmark.background) + { + (void)gearman_client_add_task_background(&client, &(tasks[x]), + &benchmark, function, NULL, + blob_ptr, blob_size, &ret); + } + else + { + (void)gearman_client_add_task(&client, &(tasks[x]), &benchmark, + function, NULL, blob_ptr, blob_size, + &ret); + } + + if (gearman_failed(ret)) + { + if (ret == GEARMAN_LOST_CONNECTION) + continue; + + if (benchmark.background) + { + std::cerr << "Task #" << x << " failed during gearman_client_add_task_background(" << gearman_strerror(ret) << " -> " << gearman_client_error(&client) << std::endl ; + } + else + { + std::cerr << "Task #" << x << " failed during gearman_client_add_task(" << gearman_strerror(ret) << " -> " << gearman_client_error(&client) << std::endl ; + } + + error= true; + goto exit_immediatly; + } + } + + gearman_client_set_created_fn(&client, _created); + gearman_client_set_data_fn(&client, _data); + gearman_client_set_status_fn(&client, _status); + gearman_client_set_complete_fn(&client, _complete); + gearman_client_set_fail_fn(&client, _fail); + + gearman_client_set_timeout(&client, 1000); + gearman_return_t ret; + do { + ret= gearman_client_run_tasks(&client); + } while (gearman_continue(ret)); + + if (ret == GEARMAN_TIMEOUT) + { + error= true; + } + else if (gearman_failed(ret) and ret != GEARMAN_LOST_CONNECTION) + { + std::cerr << "gearman_client_run_tasks(" << gearman_strerror(ret) << ") -> " << gearman_client_error(&client); + for (uint32_t x= 0; x < num_tasks; x++) + { + if (gearman_task_error(&tasks[x])) + { + std::cerr << "\t Task #" << x << " failed with " << gearman_task_error(&tasks[x]) << std::endl; + } + } + + error= true; + } + + for (uint32_t x= 0; x < num_tasks; x++) + { + gearman_task_free(&(tasks[x])); + } + + count--; + } while (count or error); + +exit_immediatly: + if (shutdown_worker) + { + gearman_client_do(&client, "shutdown", 0, 0, 0, 0, 0); + } + + delete [] blob; + delete [] tasks; + gearman_client_free(&client); + + if (benchmark.verbose) + std::cout << "Successfully completed all tasks" << std::endl; + + return error ? EXIT_FAILURE : 0; +} + +static gearman_return_t _created(gearman_task_st *task) +{ + gearman_benchmark_st *benchmark= static_cast(gearman_task_context(task)); + + if (benchmark->background && benchmark->verbose > 0) + benchmark_check_time(benchmark); + + if (benchmark->verbose > 2) + { + std::cout << "Created: " << gearman_task_job_handle(task) << std::endl; + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _status(gearman_task_st *task) +{ + gearman_benchmark_st *benchmark= static_cast(gearman_task_context(task)); + + if (benchmark->verbose > 2) + { + std::cout << "Status " << gearman_task_job_handle(task) << " " << gearman_task_numerator(task) << " " << gearman_task_denominator(task) << std::endl; + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _data(gearman_task_st *task) +{ + char buffer[BLOBSLAP_BUFFER_SIZE]; + gearman_return_t ret; + + gearman_benchmark_st *benchmark= static_cast(gearman_task_context(task)); + + while (1) + { + size_t size= gearman_task_recv_data(task, buffer, BLOBSLAP_BUFFER_SIZE, &ret); + if (gearman_failed(GEARMAN_SUCCESS)) + return ret; + if (size == 0) + break; + } + + if (benchmark->verbose > 2) + { + std::cerr << "Data: " << gearman_task_job_handle(task) << " " << gearman_task_data_size(task) << std::endl; + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _complete(gearman_task_st *task) +{ + char buffer[BLOBSLAP_BUFFER_SIZE]; + gearman_return_t ret; + + gearman_benchmark_st *benchmark= static_cast(gearman_task_context(task)); + + while (1) + { + size_t size= gearman_task_recv_data(task, buffer, BLOBSLAP_BUFFER_SIZE, &ret); + if (gearman_failed(ret)) + return ret; + + if (size == 0) + break; + } + + if (benchmark->verbose > 0) + { + benchmark_check_time(benchmark); + } + + if (benchmark->verbose > 1) + { + std::cout << "Completed: " << gearman_task_job_handle(task) << " " << gearman_task_data_size(task) << std::endl; + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _fail(gearman_task_st *task) +{ + gearman_benchmark_st *benchmark= static_cast(gearman_task_context(task)); + + if (benchmark->verbose > 0) + benchmark_check_time(benchmark); + + if (benchmark->verbose > 1) + { + std::cerr << "Failed " << gearman_task_job_handle(task) << " " << gearman_task_error(task) << std::endl; + } + + return GEARMAN_SUCCESS; +} + +static void _usage(char *name) +{ + printf("\nusage: %s\n" + "\t[-c count] [-f ] [-h ] [-m ]\n" + "\t[-M ] [-n ] [-p ] [-s] [-v]\n\n", name); + printf("\t-c - number of times to run all tasks\n"); + printf("\t-f - function name for tasks (default %s)\n", GEARMAN_BENCHMARK_DEFAULT_FUNCTION); + printf("\t-h - job server host, can specify many\n"); + printf("\t-m - minimum blob size (default %d)\n", BLOBSLAP_DEFAULT_BLOB_MIN_SIZE); + printf("\t-M - maximum blob size (default %d)\n", BLOBSLAP_DEFAULT_BLOB_MAX_SIZE); + printf("\t-n - number of tasks to run at once (default %d)\n", BLOBSLAP_DEFAULT_NUM_TASKS); + printf("\t-p - job server port\n"); + printf("\t-s - seed random number for blobsize with \n"); + printf("\t-e - tell worker to shutdown when done\n"); + printf("\t-v - increase verbose level\n"); +} diff -Nru gearmand-0.14/benchmark/blobslap_worker.c gearmand-0.23/benchmark/blobslap_worker.c --- gearmand-0.14/benchmark/blobslap_worker.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/benchmark/blobslap_worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,164 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Blob slap worker utility - */ - -#include "benchmark.h" - -static void *worker_fn(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr); - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - gearman_benchmark_st benchmark; - int c; - char *host= NULL; - in_port_t port= 0; - char *function= NULL; - uint32_t count= 0; - gearman_return_t ret; - gearman_worker_st worker; - - benchmark_init(&benchmark); - - if (gearman_worker_create(&worker) == NULL) - { - fprintf(stderr, "Memory allocation failure on worker creation\n"); - exit(1); - } - - while ((c = getopt(argc, argv, "c:f:h:p:v")) != -1) - { - switch(c) - { - case 'c': - count= (uint32_t)atoi(optarg); - break; - - case 'f': - function= optarg; - ret= gearman_worker_add_function(&worker, function, 0, worker_fn, - &benchmark); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - break; - - case 'h': - host= optarg; - ret= gearman_worker_add_server(&worker, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - case 'v': - benchmark.verbose++; - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) - { - fprintf(stderr, "signal:%d\n", errno); - exit(1); - } - - if (host == NULL) - { - ret= gearman_worker_add_server(&worker, NULL, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - } - - if (function == NULL) - { - ret= gearman_worker_add_function(&worker, - GEARMAN_BENCHMARK_DEFAULT_FUNCTION, 0, - worker_fn, &benchmark); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - } - - while (1) - { - ret= gearman_worker_work(&worker); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - break; - } - - if (count > 0) - { - count--; - if (count == 0) - break; - } - } - - gearman_worker_free(&worker); - - return 0; -} - -static void *worker_fn(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr) -{ - gearman_benchmark_st *benchmark= (gearman_benchmark_st *)context; - - (void)result_size; - - if (benchmark->verbose > 0) - benchmark_check_time(benchmark); - - if (benchmark->verbose > 1) - { - printf("Job=%s (%zu)\n", gearman_job_handle(job), - gearman_job_workload_size(job)); - } - - *ret_ptr= GEARMAN_SUCCESS; - return NULL; -} - -static void usage(char *name) -{ - printf("\nusage: %s\n" - "\t[-c count] [-f function] [-h ] [-p ] [-v]\n\n", name); - printf("\t-c - number of jobs to run before exiting\n"); - printf("\t-f - function name for tasks, can specify many\n" - "\t (default %s)\n", - GEARMAN_BENCHMARK_DEFAULT_FUNCTION); - printf("\t-h - job server host, can specify many\n"); - printf("\t-p - job server port\n"); - printf("\t-v - increase verbose level\n"); -} diff -Nru gearmand-0.14/benchmark/blobslap_worker.cc gearmand-0.23/benchmark/blobslap_worker.cc --- gearmand-0.14/benchmark/blobslap_worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/benchmark/blobslap_worker.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,214 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief Blob slap worker utility + */ + +#include +#include +#include +#include +#include +#include +#include +#include "util/daemon.h" + +static void *worker_fn(gearman_job_st *job, void *context, + size_t *result_size, gearman_return_t *ret_ptr); + +static gearman_return_t shutdown_fn(gearman_job_st*, void* /* context */) +{ + return GEARMAN_SHUTDOWN; +} + + +int main(int args, char *argv[]) +{ + gearman_benchmark_st benchmark; + bool opt_daemon; + bool opt_chunk; + bool opt_status; + bool opt_unique; + int32_t timeout; + uint32_t count= UINT_MAX; + in_port_t port; + std::string host; + std::vector* functions= NULL; + std::string verbose_string; + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("count,c", boost::program_options::value(&count)->default_value(0), "Number of jobs to run before exiting") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ("chunk", boost::program_options::bool_switch(&opt_chunk)->default_value(false), "Send result back in data chunks") + ("status,s", boost::program_options::bool_switch(&opt_status)->default_value(false), "Send status updates and sleep while running job") + ("unique,u", boost::program_options::bool_switch(&opt_unique)->default_value(false), "When grabbing jobs, grab the uniqie id") + ("daemon,d", boost::program_options::bool_switch(&opt_daemon)->default_value(false), "Daemonize") + ("function,f", boost::program_options::value(functions), "Function to use.") + ("verbose,v", boost::program_options::value(&verbose_string)->default_value("v"), "Increase verbosity level by one.") + ; + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::parse_command_line(args, argv, desc), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (opt_daemon) + { + gearmand::daemonize(false, true); + } + + if (opt_daemon) + { + gearmand::daemon_is_ready(benchmark.verbose == 0); + } + + gearman_worker_st *worker; + if (not (worker= gearman_worker_create(NULL))) + { + std::cerr << "Failed to allocate worker" << std::endl; + exit(EXIT_FAILURE); + } + + + benchmark.verbose= static_cast(verbose_string.length()); + + if (gearman_failed(gearman_worker_add_server(worker, host.c_str(), port))) + { + std::cerr << "Failed while adding server " << host << ":" << port << " :" << gearman_worker_error(worker) << std::endl; + exit(EXIT_FAILURE); + } + + gearman_function_t shutdown_function= gearman_function_create(shutdown_fn); + if (gearman_failed(gearman_worker_define_function(worker, + gearman_literal_param("shutdown"), + shutdown_function, + 0, 0))) + { + std::cerr << "Failed to add shutdown function: " << gearman_worker_error(worker) << std::endl; + exit(EXIT_FAILURE); + } + + if (functions and functions->size()) + { + for (std::vector::iterator iter= functions->begin(); + iter != functions->end(); + iter++) + { + if (gearman_failed(gearman_worker_add_function(worker, + (*iter).c_str(), 0, + worker_fn, &benchmark))) + { + std::cerr << "Failed to add default function: " << gearman_worker_error(worker) << std::endl; + exit(EXIT_FAILURE); + } + } + } + else + { + if (gearman_failed(gearman_worker_add_function(worker, + GEARMAN_BENCHMARK_DEFAULT_FUNCTION, 0, + worker_fn, &benchmark))) + { + std::cerr << "Failed to add default function: " << gearman_worker_error(worker) << std::endl; + exit(EXIT_FAILURE); + } + } + + gearman_worker_set_timeout(worker, timeout); + + do + { + gearman_return_t rc= gearman_worker_work(worker); + + if (rc == GEARMAN_SHUTDOWN) + { + if (benchmark.verbose > 0) + { + std::cerr << "shutdown" << std::endl; + } + break; + } + else if (gearman_failed(rc)) + { + std::cerr << "gearman_worker_work(): " << gearman_worker_error(worker) << std::endl; + break; + } + + count--; + } while(count); + + gearman_worker_free(worker); + + return 0; +} + +static void *worker_fn(gearman_job_st *job, void *context, + size_t *, gearman_return_t *ret_ptr) +{ + gearman_benchmark_st *benchmark= static_cast(context); + + if (benchmark->verbose > 0) + benchmark_check_time(benchmark); + + if (benchmark->verbose > 1) + { + std::cout << "Job=%s (" << gearman_job_workload_size(job) << ")" << std::endl; + } + + *ret_ptr= GEARMAN_SUCCESS; + return NULL; +} diff -Nru gearmand-0.14/benchmark/include.am gearmand-0.23/benchmark/include.am --- gearmand-0.14/benchmark/include.am 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/benchmark/include.am 2011-06-29 22:18:02.000000000 +0200 @@ -19,10 +19,30 @@ benchmark/benchmark.h noinst_LTLIBRARIES+= benchmark/libbenchmark.la -benchmark_libbenchmark_la_SOURCES= benchmark/benchmark.c +benchmark_libbenchmark_la_SOURCES= benchmark/benchmark.cc -benchmark_blobslap_client_SOURCES= benchmark/blobslap_client.c +benchmark_blobslap_client_SOURCES= benchmark/blobslap_client.cc benchmark_blobslap_client_LDADD= benchmark/libbenchmark.la libgearman/libgearman.la -benchmark_blobslap_worker_SOURCES= benchmark/blobslap_worker.c -benchmark_blobslap_worker_LDADD= benchmark/libbenchmark.la libgearman/libgearman.la +benchmark_blobslap_worker_SOURCES= \ + benchmark/blobslap_worker.cc \ + util/daemon.cc + +benchmark_blobslap_worker_LDADD= \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + benchmark/libbenchmark.la \ + libgearman/libgearman.la + +GEARMAND_BE_PIDFILE = ${abs_top_builddir}/tests/var/tmp/Begearmand.pid +GEARMAND_BENCHMARK_PORT = 6000 +BENCHMARK_COUNT = 100 +BENCHMARK_TASK_COUNT = 10 +BENCHMARK_TASK_COUNT_TOTAL = 1000 + +benchmark-test: benchmark/blobslap_client benchmark/blobslap_worker gearmand/gearmand + @echo Running benchmarking tool, this may take a couple of seconds + @gearmand/gearmand --port=$(GEARMAND_BENCHMARK_PORT) --daemon --pid-file=$(GEARMAND_BE_PIDFILE) + @libtest/wait $(GEARMAND_BE_PIDFILE) + @benchmark/blobslap_worker -p $(GEARMAND_BENCHMARK_PORT) -d + @benchmark/blobslap_client -c $(BENCHMARK_COUNT) -n $(BENCHMARK_TASK_COUNT) -p $(GEARMAND_BENCHMARK_PORT) -e + cat $(GEARMAND_BE_PIDFILE) | xargs kill diff -Nru gearmand-0.14/bin/arguments.cc gearmand-0.23/bin/arguments.cc --- gearmand-0.14/bin/arguments.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/arguments.cc 2011-04-26 02:05:05.000000000 +0200 @@ -0,0 +1,136 @@ +/* Gearman server and library + * Copyright (C) 2011 DataDifferential + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GETOPT_H +#include +#endif + +#include +#include "arguments.h" + +namespace gearman_client +{ + +Args::Args(int p_argc, char *p_argv[]) : + _host(NULL), + _port(0), + _count(0), + _unique(NULL), + _job_per_newline(false), + _strip_newline(false), + _worker(false), + _suppress_input(false), + _prefix(false), + _background(false), + _daemon(false), + _usage(false), + _priority(GEARMAN_JOB_PRIORITY_NORMAL), + _timeout(-1), + argv(p_argv), + _error(0) +{ + init(p_argc); +} + +Args::~Args() +{ +} + +void Args::init(int argc) +{ + int c; + + while ((c = getopt(argc, argv, "bc:f:h:HILnNp:Pst:u:wi:d")) != -1) + { + switch(c) + { + case 'b': + _background= true; + break; + + case 'c': + _count= static_cast(atoi(optarg)); + break; + + case 'd': + _daemon= true; + break; + + case 'f': + add(optarg); + break; + + case 'h': + _host= optarg; + break; + + case 'i': + _pid_file= optarg; + break; + + case 'I': + _priority= GEARMAN_JOB_PRIORITY_HIGH; + break; + + case 'L': + _priority= GEARMAN_JOB_PRIORITY_LOW; + break; + + case 'n': + _job_per_newline= true; + break; + + case 'N': + _job_per_newline= true; + _strip_newline= true; + break; + + case 'p': + _port= static_cast(atoi(optarg)); + break; + + case 'P': + _prefix= true; + break; + + case 's': + _suppress_input= true; + break; + + case 't': + _timeout= atoi(optarg); + break; + + case 'u': + _unique= optarg; + break; + + case 'w': + _worker= true; + break; + + case 'H': + default: + _usage= true; + return; + } + } + + argv+= optind; +} + +} // namespace gearman_client diff -Nru gearmand-0.14/bin/arguments.h gearmand-0.23/bin/arguments.h --- gearmand-0.14/bin/arguments.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/arguments.h 2011-04-26 02:04:55.000000000 +0200 @@ -0,0 +1,167 @@ +/* Gearman server and library + * Copyright (C) 2011 DataDifferential + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#include + +namespace gearman_client +{ + +/** + * Data structure for arguments and state. + */ +class Args +{ +public: + Args(int p_argc, char *p_argv[]); + + ~Args(); + + bool usage() + { + return _usage; + } + + bool prefix() const + { + return _prefix; + } + + bool background() const + { + return _background; + } + + bool daemon() const + { + return _daemon; + } + + gearman_job_priority_t priority() const + { + return _priority; + } + + int timeout() const + { + return _timeout; + } + + const char *unique() const + { + return _unique; + } + + bool job_per_newline() const + { + return _job_per_newline; + } + + Function::vector::iterator begin() + { + return _functions.begin(); + } + + Function::vector::iterator end() + { + return _functions.end(); + } + bool strip_newline() const + { + return _strip_newline; + } + + bool worker() const + { + return _worker; + } + + const std::string &pid_file() const + { + return _pid_file; + } + + int error() const + { + return _error; + } + + void set_error() const + { + _error= 1; + } + + uint32_t &count() + { + return _count; + } + + const char *host() const + { + return _host; + } + + in_port_t port() const + { + return _port; + } + + bool arguments() const + { + if (argv[0]) + return true; + + return false; + } + + bool suppress_input() const + { + return _suppress_input; + } + + const char *argument(size_t arg) + { + return argv[arg]; + } + + char **argumentv() + { + return argv; + } + +private: + Function::vector _functions; + char *_host; + in_port_t _port; + uint32_t _count; + char *_unique; + bool _job_per_newline; + bool _strip_newline; + bool _worker; + bool _suppress_input; + + bool _prefix; + bool _background; + bool _daemon; + bool _usage; + gearman_job_priority_t _priority; + int _timeout; + char **argv; + mutable int _error; + std::string _pid_file; + + void init(int argc); + + void add(const char *name) + { + _functions.push_back(Function(name)); + } +}; + +} // namespace gearman_client diff -Nru gearmand-0.14/bin/client.h gearmand-0.23/bin/client.h --- gearmand-0.14/bin/client.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/client.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,65 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +class Client +{ +public: + Client() : + _client() + { + if (gearman_client_create(&_client) == NULL) + { + std::cerr << "Failed memory allocation while initializing client." << std::endl; + abort(); + } + } + + ~Client() + { + gearman_client_free(&_client); + } + + gearman_client_st &client() + { + return _client; + } + +private: + gearman_client_st _client; +}; diff -Nru gearmand-0.14/bin/function.cc gearmand-0.23/bin/function.cc --- gearmand-0.14/bin/function.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/function.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,33 @@ +/* Gearman server and library + * Copyright (C) 2011 DataDifferential + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include + +#include + +namespace gearman_client +{ + +Function::Function(const char *name_arg) : + _name(), + _buffer() +{ + // copy the name into the _name vector + size_t length= strlen(name_arg); + _name.resize(length +1); + memcpy(&_name[0], name_arg, length); +} + +Function::~Function() +{ +} + +} // namespace gearman_client diff -Nru gearmand-0.14/bin/function.h gearmand-0.23/bin/function.h --- gearmand-0.14/bin/function.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/function.h 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,85 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include + +#include + +namespace gearman_client +{ + +typedef std::vector Bytes; + +class Function { + Bytes _name; + Bytes _buffer; + +public: + typedef std::vector vector; + + Function(const char *name_arg); + + ~Function(); + + const char *name() const + { + return &_name[0]; + } + + Bytes &buffer() + { + return _buffer; + } + + char *buffer_ptr() + { + return &_buffer[0]; + } +}; + +} // namespace gearman_client + +inline std::ostream& operator<<(std::ostream& output, const gearman_client::Function& arg) +{ + output << arg.name(); + output << "()"; + + return output; +} diff -Nru gearmand-0.14/bin/gearadmin.cc gearmand-0.23/bin/gearadmin.cc --- gearmand-0.14/bin/gearadmin.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/gearadmin.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,184 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_PWD_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include + +#include + +using namespace gearman_util; + +/* + This is a very quickly build application, I am just tired of telneting to the port. +*/ + +#define STRING_WITH_LEN(X) (X), (static_cast((sizeof(X) - 1))) + + +int main(int args, char *argv[]) +{ + boost::program_options::options_description desc("Options"); + std::string host; + std::string port; + + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT_STRING), "Port number or service to use for connection") + ("server-version", "Fetch the version number for the server.") + ("server-verbose", "Fetch the verbose setting for the server.") + ("create-function", boost::program_options::value(), "Create the function from the server.") + ("drop-function", boost::program_options::value(), "Drop the function from the server.") + ("status", "Status for the server.") + ("workers", "Workers for the server.") + ("shutdown", "Shutdown server.") + ; + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::parse_command_line(args, argv, desc), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cerr << argv[0] << " : " << e.what() << std::endl; + std::cerr << std::endl << desc << std::endl; + return EXIT_FAILURE; + } + + Instance instance; + + instance.set_host(host); + instance.set_port(port); + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (vm.count("shutdown")) + { + instance.push(new Operation(STRING_WITH_LEN("shutdown\r\n"), false)); + } + + if (vm.count("status")) + { + instance.push(new Operation(STRING_WITH_LEN("status\r\n"))); + } + + if (vm.count("workers")) + { + instance.push(new Operation(STRING_WITH_LEN("workers\r\n"))); + } + + if (vm.count("server-version")) + { + instance.push(new Operation(STRING_WITH_LEN("version\r\n"))); + } + + if (vm.count("server-verbose")) + { + instance.push(new Operation(STRING_WITH_LEN("verbose\r\n"))); + } + + if (vm.count("drop-function")) + { + std::string execute(STRING_WITH_LEN("drop function ")); + execute.append(vm["drop-function"].as()); + execute.append("\r\n"); + instance.push(new Operation(execute.c_str(), execute.size())); + } + + if (vm.count("create-function")) + { + std::string execute(STRING_WITH_LEN("create function ")); + execute.append(vm["create-function"].as()); + execute.append("\r\n"); + instance.push(new Operation(execute.c_str(), execute.size())); + } + + instance.run(); + + return EXIT_SUCCESS; +} diff -Nru gearmand-0.14/bin/gearman.c gearmand-0.23/bin/gearman.c --- gearmand-0.14/bin/gearman.c 2010-06-30 22:02:10.000000000 +0200 +++ gearmand-0.23/bin/gearman.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,801 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman Command Line Tool - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include - -#define GEARMAN_INITIAL_WORKLOAD_SIZE 8192 - -#define GEARMAN_ERROR(...) \ -{ \ - fprintf(stderr, "gearman:" __VA_ARGS__); \ - fprintf(stderr, "\n"); \ - exit(1); \ -} - -/** - * Data structure for arguments and state. - */ -typedef struct -{ - char **function; - uint32_t function_count; - char *host; - in_port_t port; - uint32_t count; - char *unique; - bool job_per_newline; - bool strip_newline; - bool worker; - bool suppress_input; - bool prefix; - bool background; - bool daemon; - gearman_job_priority_t priority; - int timeout; - char **argv; - gearman_task_st *task; - char return_value; - char *pid_file; -} gearman_args_st; - -/** - * Function to run in client mode. - */ -static void _client(gearman_args_st *args); - -/** - * Run client jobs. - */ -static void _client_run(gearman_client_st *client, gearman_args_st *args, - const void *workload, size_t workload_size); - -/** - * Client data/complete callback function. - */ -static gearman_return_t _client_data(gearman_task_st *task); - -/** - * Client warning/exception callback function. - */ -static gearman_return_t _client_warning(gearman_task_st *task); - -/** - * Client status callback function. - */ -static gearman_return_t _client_status(gearman_task_st *task); -/** - * Client fail callback function. - */ -static gearman_return_t _client_fail(gearman_task_st *task); - -/** - * Function to run in worker mode. - */ -static void _worker(gearman_args_st *args); - -/** - * Callback function when worker gets a job. - */ -static void *_worker_cb(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr); - -/** - * Read workload chunk from a file descriptor and put into allocated memory. - */ -static void _read_workload(int fd, char **workload, size_t *workload_offset, - size_t *workload_size); - -/** - * Print usage information. - */ -static void usage(char *name); - -/* - Pid file functions. -*/ -static bool _pid_write(const char *pid_file) -{ - FILE *f; - - f= fopen(pid_file, "w"); - if (f == NULL) - { - fprintf(stderr, "gearmand: Could not open pid file for writing: %s (%d)\n", - pid_file, errno); - return true; - } - - fprintf(f, "%" PRId64 "\n", (int64_t)getpid()); - - if (fclose(f) == -1) - { - fprintf(stderr, "gearmand: Could not close the pid file: %s (%d)\n", - pid_file, errno); - return true; - } - - return false; -} - -static void _pid_delete(const char *pid_file) -{ - if (unlink(pid_file) == -1) - { - fprintf(stderr, "gearmand: Could not remove the pid file: %s (%d)\n", - pid_file, errno); - } -} - -int main(int argc, char *argv[]) -{ - int c; - gearman_args_st args; - bool close_stdio= false; - - memset(&args, 0, sizeof(gearman_args_st)); - args.priority= GEARMAN_JOB_PRIORITY_NORMAL; - args.timeout= -1; - - /* Allocate the maximum number of possible functions. */ - args.function= malloc(sizeof(char *) * (size_t)argc); - if (args.function == NULL) - { - GEARMAN_ERROR("malloc:%d", errno); - } - - while ((c = getopt(argc, argv, "bc:f:h:HILnNp:Pst:u:wi:d")) != -1) - { - switch(c) - { - case 'b': - args.background= true; - break; - - case 'c': - args.count= (uint32_t)atoi(optarg); - break; - - case 'd': - args.daemon= true; - break; - - case 'f': - args.function[args.function_count]= optarg; - args.function_count++; - break; - - case 'h': - args.host= optarg; - break; - - case 'i': - args.pid_file= strdup(optarg); - break; - - case 'I': - args.priority= GEARMAN_JOB_PRIORITY_HIGH; - break; - - case 'L': - args.priority= GEARMAN_JOB_PRIORITY_LOW; - break; - - case 'n': - args.job_per_newline= true; - break; - - case 'N': - args.job_per_newline= true; - args.strip_newline= true; - break; - - case 'p': - args.port= (in_port_t)atoi(optarg); - break; - - case 'P': - args.prefix= true; - break; - - case 's': - args.suppress_input= true; - break; - - case 't': - args.timeout= atoi(optarg); - break; - - case 'u': - args.unique= optarg; - break; - - case 'w': - args.worker= true; - break; - - case 'H': - default: - usage(argv[0]); - exit(0); - } - } - - args.argv= argv + optind; - - if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) - { - GEARMAN_ERROR("signal:%d", errno); - } - - if (args.daemon) - { - switch (fork()) - { - case -1: - fprintf(stderr, "gearmand: fork:%d\n", errno); - return 1; - - case 0: - break; - - default: - return 0; - } - - if (setsid() == -1) - { - fprintf(stderr, "gearmand: setsid:%d\n", errno); - return 1; - } - - close_stdio= true; - } - - if (close_stdio) - { - int fd; - - /* If we can't remap stdio, it should not a fatal error. */ - fd= open("/dev/null", O_RDWR, 0); - - if (fd != -1) - { - if (dup2(fd, STDIN_FILENO) == -1) - { - fprintf(stderr, "gearmand: dup2:%d\n", errno); - return 1; - } - - if (dup2(fd, STDOUT_FILENO) == -1) - { - fprintf(stderr, "gearmand: dup2:%d\n", errno); - return 1; - } - - if (dup2(fd, STDERR_FILENO) == -1) - { - fprintf(stderr, "gearmand: dup2:%d\n", errno); - return 1; - } - - close(fd); - } - } - - if (args.pid_file != NULL && _pid_write(args.pid_file)) - return 1; - - if (args.worker) - _worker(&args); - else - _client(&args); - - if (args.pid_file != NULL) - { - _pid_delete(args.pid_file); - free(args.pid_file); - } - - return args.return_value; -} - -void _client(gearman_args_st *args) -{ - gearman_client_st client; - gearman_return_t ret; - char *workload= NULL; - size_t workload_size= 0; - size_t workload_offset= 0; - uint32_t x; - - if (gearman_client_create(&client) == NULL) - { - GEARMAN_ERROR("Memory allocation failure on client creation"); - } - - if (args->timeout >= 0) - gearman_client_set_timeout(&client, args->timeout); - - ret= gearman_client_add_server(&client, args->host, args->port); - if (ret != GEARMAN_SUCCESS) - { - GEARMAN_ERROR("gearman_client_add_server:%s", gearman_client_error(&client)); - } - - gearman_client_set_data_fn(&client, _client_data); - gearman_client_set_warning_fn(&client, _client_warning); - gearman_client_set_status_fn(&client, _client_status); - gearman_client_set_complete_fn(&client, _client_data); - gearman_client_set_exception_fn(&client, _client_warning); - gearman_client_set_fail_fn(&client, _client_fail); - - args->task= malloc(sizeof(gearman_task_st) * args->function_count); - if (args->task == NULL) - { - GEARMAN_ERROR("malloc:%d", errno); - } - - if (args->argv[0] == NULL) - { - if (args->suppress_input) - _client_run(&client, args, NULL, 0); - else if (args->job_per_newline) - { - workload= malloc(GEARMAN_INITIAL_WORKLOAD_SIZE); - if (workload == NULL) - { - GEARMAN_ERROR("malloc:%d", errno); - } - - while (1) - { - if (fgets(workload, GEARMAN_INITIAL_WORKLOAD_SIZE, stdin) == NULL) - break; - - if (args->strip_newline) - _client_run(&client, args, workload, strlen(workload) - 1); - else - _client_run(&client, args, workload, strlen(workload)); - } - } - else - { - _read_workload(0, &workload, &workload_offset, &workload_size); - _client_run(&client, args, workload, workload_offset); - } - } - else - { - for (x= 0; args->argv[x] != NULL; x++) - _client_run(&client, args, args->argv[x], strlen(args->argv[x])); - } - - gearman_client_free(&client); - - if (workload != NULL) - free(workload); -} - -void _client_run(gearman_client_st *client, gearman_args_st *args, - const void *workload, size_t workload_size) -{ - gearman_return_t ret; - uint32_t x; - - for (x= 0; x < args->function_count; x++) - { - /* This is a bit nasty, but all we have currently is multiple function - calls. */ - if (args->background) - { - switch (args->priority) - { - case GEARMAN_JOB_PRIORITY_HIGH: - (void)gearman_client_add_task_high_background(client, &(args->task[x]), - args, args->function[x], - args->unique, workload, - workload_size, &ret); - break; - - case GEARMAN_JOB_PRIORITY_NORMAL: - (void)gearman_client_add_task_background(client, &(args->task[x]), args, - args->function[x], - args->unique, workload, - workload_size, &ret); - break; - - case GEARMAN_JOB_PRIORITY_LOW: - (void)gearman_client_add_task_low_background(client, &(args->task[x]), - args, args->function[x], - args->unique, workload, - workload_size, &ret); - break; - - case GEARMAN_JOB_PRIORITY_MAX: - default: - /* This should never happen. */ - ret= GEARMAN_UNKNOWN_STATE; - break; - } - } - else - { - switch (args->priority) - { - case GEARMAN_JOB_PRIORITY_HIGH: - (void)gearman_client_add_task_high(client, &(args->task[x]), args, - args->function[x], args->unique, - workload, workload_size, &ret); - break; - - case GEARMAN_JOB_PRIORITY_NORMAL: - (void)gearman_client_add_task(client, &(args->task[x]), args, - args->function[x], args->unique, workload, - workload_size, &ret); - break; - - case GEARMAN_JOB_PRIORITY_LOW: - (void)gearman_client_add_task_low(client, &(args->task[x]), args, - args->function[x], args->unique, - workload, workload_size, &ret); - break; - - case GEARMAN_JOB_PRIORITY_MAX: - default: - /* This should never happen. */ - ret= GEARMAN_UNKNOWN_STATE; - break; - } - } - if (ret != GEARMAN_SUCCESS) - { - GEARMAN_ERROR("gearman_client_add_task:%s", gearman_client_error(client)); - } - } - - ret= gearman_client_run_tasks(client); - if (ret != GEARMAN_SUCCESS) - { - GEARMAN_ERROR("gearman_client_run_tasks:%s", gearman_client_error(client)); - } - - for (x= 0; x < args->function_count; x++) - gearman_task_free(&(args->task[x])); -} - -static gearman_return_t _client_data(gearman_task_st *task) -{ - const gearman_args_st *args; - - args= gearman_task_context(task); - if (args->prefix) - { - fprintf(stdout, "%s: ", gearman_task_function_name(task)); - fflush(stdout); - } - - if (write(1, gearman_task_data(task), gearman_task_data_size(task)) == -1) - { - GEARMAN_ERROR("write:%d", errno); - } - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _client_warning(gearman_task_st *task) -{ - const gearman_args_st *args; - - args= gearman_task_context(task); - if (args->prefix) - { - fprintf(stderr, "%s: ", gearman_task_function_name(task)); - fflush(stderr); - } - - if (write(2, gearman_task_data(task), gearman_task_data_size(task)) == -1) - { - GEARMAN_ERROR("write:%d", errno); - } - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _client_status(gearman_task_st *task) -{ - const gearman_args_st *args; - - args= gearman_task_context(task); - if (args->prefix) - printf("%s: ", gearman_task_function_name(task)); - - printf("%u%% Complete\n", (gearman_task_numerator(task) * 100) / - gearman_task_denominator(task)); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _client_fail(gearman_task_st *task) -{ - gearman_args_st *args; - - args= (gearman_args_st *)gearman_task_context(task); - if (args->prefix) - fprintf(stderr, "%s: ", gearman_task_function_name(task)); - - fprintf(stderr, "Job failed\n"); - - /** - @note Fix this so that we don't cast from const. - */ - args->return_value= 1; - return GEARMAN_SUCCESS; -} - -void _worker(gearman_args_st *args) -{ - gearman_worker_st worker; - gearman_return_t ret; - uint32_t x; - - if (gearman_worker_create(&worker) == NULL) - { - GEARMAN_ERROR("Memory allocation failure on client creation"); - } - - if (args->timeout >= 0) - gearman_worker_set_timeout(&worker, args->timeout); - - ret= gearman_worker_add_server(&worker, args->host, args->port); - if (ret != GEARMAN_SUCCESS) - { - GEARMAN_ERROR("gearman_worker_add_server:%s", gearman_worker_error(&worker)); - } - - for (x= 0; x < args->function_count; x++) - { - ret= gearman_worker_add_function(&worker, args->function[x], 0, _worker_cb, - args); - if (ret != GEARMAN_SUCCESS) - { - GEARMAN_ERROR("gearman_worker_add_function:%s", gearman_worker_error(&worker)); - } - } - - while (1) - { - ret= gearman_worker_work(&worker); - if (ret != GEARMAN_SUCCESS) - { - GEARMAN_ERROR("gearman_worker_work:%s", gearman_worker_error(&worker)); - } - - if (args->count > 0) - { - args->count--; - if (args->count == 0) - break; - } - } - - gearman_worker_free(&worker); -} - -static void *_worker_cb(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr) -{ - gearman_args_st *args= (gearman_args_st *)context; - int in_fds[2]; - int out_fds[2]; - char *result= NULL; - size_t total_size= 0; - FILE *f; - int status; - - *ret_ptr= GEARMAN_SUCCESS; - - if (args->argv[0] == NULL) - { - if (write(1, gearman_job_workload(job), - gearman_job_workload_size(job)) == -1) - { - GEARMAN_ERROR("write:%d", errno); - } - } - else - { - if (pipe(in_fds) == -1 || pipe(out_fds) == -1) - { - GEARMAN_ERROR("pipe:%d", errno); - } - - switch (fork()) - { - case -1: - GEARMAN_ERROR("fork:%d", errno); - - case 0: - if (dup2(in_fds[0], 0) == -1) - { - GEARMAN_ERROR("dup2:%d", errno); - } - - close(in_fds[1]); - - if (dup2(out_fds[1], 1) == -1) - { - GEARMAN_ERROR("dup2:%d", errno); - } - - close(out_fds[0]); - - execvp(args->argv[0], args->argv); - { - GEARMAN_ERROR("execvp:%d", errno); - } - - default: - break; - } - - close(in_fds[0]); - close(out_fds[1]); - - if (gearman_job_workload_size(job) > 0) - { - if (write(in_fds[1], gearman_job_workload(job), - gearman_job_workload_size(job)) == -1) - { - GEARMAN_ERROR("write:%d", errno); - } - } - - close(in_fds[1]); - - if (args->job_per_newline) - { - f= fdopen(out_fds[0], "r"); - if (f == NULL) - { - GEARMAN_ERROR("fdopen:%d", errno); - } - - result= malloc(GEARMAN_INITIAL_WORKLOAD_SIZE); - if (result == NULL) - { - GEARMAN_ERROR("malloc:%d", errno); - } - - while (1) - { - if (fgets(result, GEARMAN_INITIAL_WORKLOAD_SIZE, f) == NULL) - break; - - if (args->strip_newline) - *ret_ptr= gearman_job_send_data(job, result, strlen(result) - 1); - else - *ret_ptr= gearman_job_send_data(job, result, strlen(result)); - - if (*ret_ptr != GEARMAN_SUCCESS) - break; - } - - free(result); - result= NULL; - fclose(f); - } - else - { - _read_workload(out_fds[0], &result, result_size, &total_size); - close(out_fds[0]); - } - - if (wait(&status) == -1) - { - GEARMAN_ERROR("wait:%d", errno); - } - - if (WEXITSTATUS(status) != 0) - { - if (result != NULL) - { - *ret_ptr= gearman_job_send_data(job, result, *result_size); - if (*ret_ptr != GEARMAN_SUCCESS) - return NULL; - } - - *ret_ptr= GEARMAN_WORK_FAIL; - return NULL; - } - } - - return result; -} - -void _read_workload(int fd, char **workload, size_t *workload_offset, - size_t *workload_size) -{ - ssize_t read_ret; - - while (1) - { - if (*workload_offset == *workload_size) - { - if (*workload_size == 0) - *workload_size= GEARMAN_INITIAL_WORKLOAD_SIZE; - else - *workload_size= *workload_size * 2; - - *workload= realloc(*workload, *workload_size); - if(*workload == NULL) - { - GEARMAN_ERROR("realloc:%d", errno); - } - } - - read_ret= read(fd, *workload + *workload_offset, - *workload_size - *workload_offset); - if (read_ret == -1) - { - GEARMAN_ERROR("execvp:%d", errno); - } - else if (read_ret == 0) - { - break; - } - - *workload_offset += (size_t)read_ret; - } -} - -static void usage(char *name) -{ - printf("Client mode: %s [options] []\n", name); - printf("Worker mode: %s -w [options] [ [ ...]]\n", name); - - printf("\nCommon options to both client and worker modes.\n"); - printf("\t-f - Function name to use for jobs (can give many)\n"); - printf("\t-h - Job server host\n"); - printf("\t-H - Print this help menu\n"); - printf("\t-p - Job server port\n"); - printf("\t-t - Timeout in milliseconds\n"); - printf("\t-i - Create a pidfile for the process\n"); - - printf("\nClient options:\n"); - printf("\t-b - Run jobs in the background\n"); - printf("\t-I - Run jobs as high priority\n"); - printf("\t-L - Run jobs as low priority\n"); - printf("\t-n - Run one job per line\n"); - printf("\t-N - Same as -n, but strip off the newline\n"); - printf("\t-P - Prefix all output lines with functions names\n"); - printf("\t-s - Send job without reading from standard input\n"); - printf("\t-u - Unique key to use for job\n"); - - printf("\nWorker options:\n"); - printf("\t-c - Number of jobs for worker to run before exiting\n"); - printf("\t-n - Send data packet for each line\n"); - printf("\t-N - Same as -n, but strip off the newline\n"); - printf("\t-w - Run in worker mode\n"); -} diff -Nru gearmand-0.14/bin/gearman.cc gearmand-0.23/bin/gearman.cc --- gearmand-0.14/bin/gearman.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/gearman.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,726 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Gearman Command Line Tool + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#include + +#include "bin/arguments.h" +#include "bin/client.h" +#include "bin/worker.h" +#include "util/pidfile.h" +#include "util/error.h" + +using namespace gearman_client; +using namespace gearman_util; + +#define GEARMAN_INITIAL_WORKLOAD_SIZE 8192 + +struct worker_argument_t +{ + Args &args; + Function &function; + + worker_argument_t(Args &args_arg, Function &function_arg) : + args(args_arg), + function(function_arg) + { + } +}; + +/** + * Function to run in client mode. + */ +static void _client(Args &args); + +/** + * Run client jobs. + */ +static void _client_run(gearman_client_st& client, Args &args, + const void *workload, size_t workload_size); + +/** + * Client data/complete callback function. + */ +static gearman_return_t _client_data(gearman_task_st *task); + +/** + * Client warning/exception callback function. + */ +static gearman_return_t _client_warning(gearman_task_st *task); + +/** + * Client status callback function. + */ +static gearman_return_t _client_status(gearman_task_st *task); +/** + * Client fail callback function. + */ +static gearman_return_t _client_fail(gearman_task_st *task); + +/** + * Function to run in worker mode. + */ +static void _worker(Args &args); + +/** + * Callback function when worker gets a job. + */ +static void *_worker_cb(gearman_job_st *job, void *context, + size_t *result_size, gearman_return_t *ret_ptr); + +/** + * Read workload chunk from a file descriptor and put into allocated memory. + */ +static void _read_workload(int fd, Bytes& workload); + +/** + * Print usage information. + */ +static void usage(char *name); + +extern "C" +{ + +static void signal_setup() +{ + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) + { + error::perror("signal"); + } +} + +} + +int main(int argc, char *argv[]) +{ + Args args(argc, argv); + bool close_stdio= false; + + if (args.usage()) + { + usage(argv[0]); + return EXIT_SUCCESS; + } + + signal_setup(); + + if (args.daemon()) + { + switch (fork()) + { + case -1: + fprintf(stderr, "gearmand: fork:%d\n", errno); + return EXIT_FAILURE; + + case 0: + break; + + default: + return EXIT_SUCCESS; + } + + if (setsid() == -1) + { + fprintf(stderr, "gearmand: setsid:%d\n", errno); + return EXIT_FAILURE; + } + + close_stdio= true; + } + + if (close_stdio) + { + /* If we can't remap stdio, it should not a fatal error. */ + int fd= open("/dev/null", O_RDWR, 0); + + if (fd != -1) + { + if (dup2(fd, STDIN_FILENO) == -1) + { + fprintf(stderr, "gearmand: dup2:%d\n", errno); + return EXIT_FAILURE; + } + + if (dup2(fd, STDOUT_FILENO) == -1) + { + fprintf(stderr, "gearmand: dup2:%d\n", errno); + return EXIT_FAILURE; + } + + if (dup2(fd, STDERR_FILENO) == -1) + { + fprintf(stderr, "gearmand: dup2:%d\n", errno); + return EXIT_FAILURE; + } + + close(fd); + } + } + + Pidfile _pid_file(args.pid_file()); + + if (not _pid_file.create()) + { + error::perror(_pid_file.error_message().c_str()); + return EXIT_FAILURE; + } + + if (args.worker()) + { + _worker(args); + } + else + { + _client(args); + } + + return args.error(); +} + +void _client(Args &args) +{ + Client local_client; + gearman_client_st &client= local_client.client(); + Bytes workload; + if (args.timeout() >= 0) + { + gearman_client_set_timeout(&client, args.timeout()); + } + + if (gearman_failed(gearman_client_add_server(&client, args.host(), args.port()))) + { + error::message("gearman_client_add_server", client); + return; + } + + gearman_client_set_data_fn(&client, _client_data); + gearman_client_set_warning_fn(&client, _client_warning); + gearman_client_set_status_fn(&client, _client_status); + gearman_client_set_complete_fn(&client, _client_data); + gearman_client_set_exception_fn(&client, _client_warning); + gearman_client_set_fail_fn(&client, _client_fail); + + if (not args.arguments()) + { + if (args.suppress_input()) + { + _client_run(client, args, NULL, 0); + } + else if (args.job_per_newline()) + { + workload.resize(GEARMAN_INITIAL_WORKLOAD_SIZE); + + while (1) + { + if (fgets(&workload[0], static_cast(workload.size()), stdin) == NULL) + { + break; + } + + if (args.strip_newline()) + { + _client_run(client, args, &workload[0], strlen(&workload[0]) - 1); + } + else + { + _client_run(client, args, &workload[0], strlen(&workload[0])); + } + } + } + else + { + _read_workload(STDIN_FILENO, workload); + _client_run(client, args, &workload[0], workload.size()); + } + } + else + { + for (size_t x= 0; args.argument(x) != NULL; x++) + { + _client_run(client, args, args.argument(x), strlen(args.argument(x))); + } + } +} + +void _client_run(gearman_client_st& client, Args &args, + const void *workload, size_t workload_size) +{ + gearman_return_t ret; + + for (Function::vector::iterator iter= args.begin(); + iter != args.end(); + iter++) + { + Function &function= *iter; + + /* This is a bit nasty, but all we have currently is multiple function + calls. */ + if (args.background()) + { + switch (args.priority()) + { + case GEARMAN_JOB_PRIORITY_HIGH: + (void)gearman_client_add_task_high_background(&client, + NULL, + &args, + function.name(), + args.unique(), + workload, + workload_size, &ret); + break; + + case GEARMAN_JOB_PRIORITY_NORMAL: + (void)gearman_client_add_task_background(&client, + NULL, + &args, + function.name(), + args.unique(), + workload, + workload_size, &ret); + break; + + case GEARMAN_JOB_PRIORITY_LOW: + (void)gearman_client_add_task_low_background(&client, + NULL, + &args, + function.name(), + args.unique(), + workload, + workload_size, &ret); + break; + + case GEARMAN_JOB_PRIORITY_MAX: + default: + /* This should never happen. */ + ret= GEARMAN_UNKNOWN_STATE; + break; + } + } + else + { + switch (args.priority()) + { + case GEARMAN_JOB_PRIORITY_HIGH: + (void)gearman_client_add_task_high(&client, + NULL, + &args, + function.name(), + args.unique(), + workload, workload_size, &ret); + break; + + case GEARMAN_JOB_PRIORITY_NORMAL: + (void)gearman_client_add_task(&client, + NULL, + &args, + function.name(), + args.unique(), + workload, + workload_size, &ret); + break; + + case GEARMAN_JOB_PRIORITY_LOW: + (void)gearman_client_add_task_low(&client, + NULL, + &args, + function.name(), + args.unique(), + workload, workload_size, &ret); + break; + + case GEARMAN_JOB_PRIORITY_MAX: + default: + /* This should never happen. */ + ret= GEARMAN_UNKNOWN_STATE; + break; + } + } + + if (gearman_failed(ret)) + { + error::message("gearman_client_add_task", client); + } + } + + if (gearman_failed(gearman_client_run_tasks(&client))) + { + error::message("gearman_client_run_tasks", client); + } +} + +static gearman_return_t _client_data(gearman_task_st *task) +{ + const Args *args= static_cast(gearman_task_context(task)); + if (args->prefix()) + { + fprintf(stdout, "%s: ", gearman_task_function_name(task)); + fflush(stdout); + } + + if (write(fileno(stdout), gearman_task_data(task), gearman_task_data_size(task)) == -1) + { + error::perror("write"); + return GEARMAN_ERRNO; + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _client_warning(gearman_task_st *task) +{ + const Args *args= static_cast(gearman_task_context(task)); + if (args->prefix()) + { + fprintf(stderr, "%s: ", gearman_task_function_name(task)); + fflush(stderr); + } + + if (write(fileno(stderr), gearman_task_data(task), gearman_task_data_size(task)) == -1) + { + error::perror("write"); + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _client_status(gearman_task_st *task) +{ + const Args *args= static_cast(gearman_task_context(task)); + + if (args->prefix()) + printf("%s: ", gearman_task_function_name(task)); + + printf("%u%% Complete\n", (gearman_task_numerator(task) * 100) / + gearman_task_denominator(task)); + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _client_fail(gearman_task_st *task) +{ + const Args *args= static_cast(gearman_task_context(task)); + + if (args->prefix()) + fprintf(stderr, "%s: ", gearman_task_function_name(task)); + + fprintf(stderr, "Job failed\n"); + + args->set_error(); + + return GEARMAN_SUCCESS; +} + +static void _worker_free(void *, void *) +{ +} + +void _worker(Args &args) +{ + Worker local_worker; + gearman_worker_st &worker= local_worker.worker(); + + if (args.timeout() >= 0) + { + gearman_worker_set_timeout(&worker, args.timeout()); + } + + if (gearman_failed(gearman_worker_add_server(&worker, args.host(), args.port()))) + { + error::message("gearman_worker_add_server", worker); + _exit(EXIT_FAILURE); + } + + gearman_worker_set_workload_free_fn(&worker, _worker_free, NULL); + + for (Function::vector::iterator iter= args.begin(); + iter != args.end(); + iter++) + { + Function &function= *iter; + worker_argument_t pass(args, *iter); + if (gearman_failed(gearman_worker_add_function(&worker, function.name(), 0, _worker_cb, &pass))) + { + error::message("gearman_worker_add_function", worker); + _exit(EXIT_FAILURE); + } + } + + while (1) + { + if (gearman_failed(gearman_worker_work(&worker))) + { + error::message("gearman_worker_work", worker); + } + + if (args.count() > 0) + { + --args.count(); + if (args.count() == 0) + break; + } + } +} + +extern "C" { +static bool local_wexitstatus(int status) +{ + if (WEXITSTATUS(status) != 0) + return true; + + return false; +} +} + +static void *_worker_cb(gearman_job_st *job, void *context, + size_t *result_size, gearman_return_t *ret_ptr) +{ + worker_argument_t *arguments= static_cast(context); + int in_fds[2]; + int out_fds[2]; + int status; + + Args &args= arguments->args; + Function &function= arguments->function; + + function.buffer().clear(); + + *ret_ptr= GEARMAN_SUCCESS; + + if (not args.arguments()) + { + if (write(STDOUT_FILENO, gearman_job_workload(job), + gearman_job_workload_size(job)) == -1) + { + error::perror("write"); + } + } + else + { + if (pipe(in_fds) == -1 || pipe(out_fds) == -1) + { + error::perror("pipe"); + } + + pid_t pid; + switch ((pid= fork())) + { + case -1: + error::perror("fork"); + return NULL; + + case 0: + if (dup2(in_fds[0], 0) == -1) + { + error::perror("dup2"); + return NULL; + } + + if (close(in_fds[1]) < 0) + { + error::perror("close"); + return NULL; + } + + if (dup2(out_fds[1], 1) == -1) + { + error::perror("dup2"); + return NULL; + } + + if (close(out_fds[0]) < 0) + { + error::perror("close"); + return NULL; + } + + if (execvp(args.argument(0), args.argumentv()) < 0) + { + error::perror("execvp"); + return NULL; + } + + default: + break; + } + + if (close(in_fds[0]) < 0) + { + error::perror("close"); + } + + if (close(out_fds[1]) < 0) + { + error::perror("close"); + } + + if (gearman_job_workload_size(job) > 0) + { + if (write(in_fds[1], gearman_job_workload(job), + gearman_job_workload_size(job)) == -1) + { + error::perror("write"); + } + } + + if (close(in_fds[1]) < 0) + { + error::perror("close"); + } + + if (args.job_per_newline()) + { + FILE *f= fdopen(out_fds[0], "r"); + + if (f == NULL) + { + error::perror("fdopen"); + } + + function.buffer().clear(); + + while (1) + { + char buffer[1024]; + if (fgets(buffer, sizeof(buffer), f) == NULL) + { + break; + } + + size_t length= strlen(buffer); + for (size_t x= 0; x < length ; x++) + { + function.buffer().push_back(buffer[x]); + } + + if (args.strip_newline()) + { + *ret_ptr= gearman_job_send_data(job, function.buffer_ptr(), function.buffer().size() - 1); + } + else + { + *ret_ptr= gearman_job_send_data(job, function.buffer_ptr(), function.buffer().size()); + } + + if (*ret_ptr != GEARMAN_SUCCESS) + { + error::message("gearman_job_send_data() failed with", *ret_ptr); + break; + } + } + + function.buffer().clear(); + fclose(f); + } + else + { + _read_workload(out_fds[0], function.buffer()); + if (close(out_fds[0]) < 0) + { + error::perror("close"); + } + *result_size= function.buffer().size(); + } + + if (wait(&status) == -1) + { + error::perror("wait"); + } + + if (local_wexitstatus(status)) + { + if (not function.buffer().empty()) + { + *ret_ptr= gearman_job_send_data(job, function.buffer_ptr(), function.buffer().size()); + if (*ret_ptr != GEARMAN_SUCCESS) + return NULL; + } + + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + + return function.buffer_ptr(); +} + +void _read_workload(int fd, Bytes& workload) +{ + while (1) + { + char buffer[1024]; + + ssize_t read_ret= read(fd, buffer, sizeof(buffer)); + + if (read_ret == -1) + { + error::perror("read"); + } + else if (read_ret == 0) + { + break; + } + + workload.reserve(workload.size() + static_cast(read_ret)); + for (size_t x= 0; x < static_cast(read_ret); x++) + { + workload.push_back(buffer[x]); + } + } +} + +static void usage(char *name) +{ + printf("Client mode: %s [options] []\n", name); + printf("Worker mode: %s -w [options] [ [ ...]]\n", name); + + printf("\nCommon options to both client and worker modes.\n"); + printf("\t-f - Function name to use for jobs (can give many)\n"); + printf("\t-h - Job server host\n"); + printf("\t-H - Print this help menu\n"); + printf("\t-p - Job server port\n"); + printf("\t-t - Timeout in milliseconds\n"); + printf("\t-i - Create a pidfile for the process\n"); + + printf("\nClient options:\n"); + printf("\t-b - Run jobs in the background\n"); + printf("\t-I - Run jobs as high priority\n"); + printf("\t-L - Run jobs as low priority\n"); + printf("\t-n - Run one job per line\n"); + printf("\t-N - Same as -n, but strip off the newline\n"); + printf("\t-P - Prefix all output lines with functions names\n"); + printf("\t-s - Send job without reading from standard input\n"); + printf("\t-u - Unique key to use for job\n"); + + printf("\nWorker options:\n"); + printf("\t-c - Number of jobs for worker to run before exiting\n"); + printf("\t-n - Send data packet for each line\n"); + printf("\t-N - Same as -n, but strip off the newline\n"); + printf("\t-w - Run in worker mode\n"); +} diff -Nru gearmand-0.14/bin/include.am gearmand-0.23/bin/include.am --- gearmand-0.14/bin/include.am 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/bin/include.am 2011-04-28 19:44:27.000000000 +0200 @@ -1,7 +1,9 @@ # vim:ft=automake -# Gearman server and library -# Copyright (C) 2008 Brian Aker, Eric Day -# Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor +# Gearman server and library +# Copyright (C) 2011 DataDifferential +# Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor +# Copyright (C) 2008 Brian Aker, Eric Day +# # All rights reserved. # # Use and distribution licensed under the BSD license. See @@ -12,7 +14,79 @@ bin_PROGRAMS+= \ - bin/gearman + bin/gearman \ + bin/gearadmin + +bin_gearadmin_SOURCES= \ + bin/gearadmin.cc \ + util/instance.cc +bin_gearadmin_CPPFLAGS= \ + $(AM_CPPFLAGS) \ + $(BOOST_CPPFLAGS) +bin_gearadmin_LDFLAGS= \ + $(AM_LDFLAGS) \ + $(BOOST_PROGRAM_OPTIONS_LDFLAGS) +bin_gearadmin_LDADD= \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + ${BETTER_MALLOC_LIBS} + +bin_gearman_SOURCES= \ + bin/arguments.cc \ + bin/function.cc \ + bin/gearman.cc \ + util/error.cc \ + util/pidfile.cc +bin_gearman_LDADD= \ + libgearman/libgearman.la + +noinst_HEADERS+= \ + bin/arguments.h \ + bin/function.h \ + bin/client.h \ + bin/worker.h + +GEARMAN_CLIENT_TEST= bin/gearman +GEARMAN_VALGRIND_CLIENT_TEST= $(VALGRIND_COMMAND) bin/gearman +GEARMAN_PIDFILE = ${abs_top_builddir}/tests/var/tmp/Xugear.pid +GEARMAND_PIDFILE = ${abs_top_builddir}/tests/var/tmp/Xugearmand.pid +GEARMAND_PORT = 5999 + +client-test: client-test-basic + +client-test-basic: $(GEARMAN_CLIENT_TEST) + @$(GEARMAN_CLIENT_TEST) -H 2>&1 > /dev/null + @$(GEARMAN_CLIENT_TEST) -w -f true -d -i $(GEARMAN_PIDFILE) -- false + @libtest/wait $(GEARMAN_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + +client-test-wc: $(GEARMAN_CLIENT_TEST) + @gearmand/gearmand --port=$(GEARMAND_PORT) --daemon --pid-file=$(GEARMAND_PIDFILE) + @echo "1" > $(GEARMAN_TMP)/test_file + @$(GEARMAN_CLIENT_TEST) -w -f wc -d -i $(GEARMAN_PIDFILE) -- wc -l + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @diff -q $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @rm $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @libtest/wait $(GEARMAN_PIDFILE) + @libtest/wait $(GEARMAND_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + @cat $(GEARMAND_PIDFILE) | xargs kill + +client-test-lp738917: $(GEARMAN_CLIENT_TEST) + @gearmand/gearmand --port=$(GEARMAND_PORT) --daemon --pid-file=$(GEARMAND_PIDFILE) + @echo "1" > $(GEARMAN_TMP)/test_file + @$(GEARMAN_CLIENT_TEST) -w -f wc -d -i $(GEARMAN_PIDFILE) -- wc -l + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @diff -q $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @rm $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @libtest/wait $(GEARMAN_PIDFILE) + @libtest/wait $(GEARMAND_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + @cat $(GEARMAND_PIDFILE) | xargs kill -bin_gearman_SOURCES= bin/gearman.c -bin_gearman_LDADD= libgearman/libgearman.la ${BETTER_MALLOC_LIBS} +valgrind-client-test: $(GEARMAN_CLIENT_TEST) + @$(GEARMAN_VALGRIND_CLIENT_TEST) -H 2>&1 > /dev/null + @$(GEARMAN_CLIENT_TEST) -w -f true -d -i $(GEARMAN_PIDFILE) -- false + @libtest/wait $(GEARMAN_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill diff -Nru gearmand-0.14/bin/worker.h gearmand-0.23/bin/worker.h --- gearmand-0.14/bin/worker.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/bin/worker.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,65 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +class Worker +{ +public: + Worker() : + _worker() + { + if (gearman_worker_create(&_worker) == NULL) + { + std::cerr << "Failed memory allocation while initializing memory." << std::endl; + abort(); + } + } + + ~Worker() + { + gearman_worker_free(&_worker); + } + + gearman_worker_st &worker() + { + return _worker; + } + +private: + gearman_worker_st _worker; +}; diff -Nru gearmand-0.14/ChangeLog gearmand-0.23/ChangeLog --- gearmand-0.14/ChangeLog 2010-06-30 22:04:41.000000000 +0200 +++ gearmand-0.23/ChangeLog 2011-06-29 22:27:01.000000000 +0200 @@ -1,3 +1,75 @@ +0.23 Wed Jun 29 13:26:26 PDT 2011 + * Defined workers can now return GEARMAN_SHUTDOWN. + * Benchmark worker can now be told to shutdown. + * Allocator code has been cleaned up (gearman_allocator_t). + * Added "workers" option to gearadmin + * Workers will now default to -1 as timeout (lowers CPU on gearmand server for non-active workers). + * SO_KEEPALIVE is now enabled on client/worker connections. + * By default, workers now grab the unique value of the job. + +0.22 Sun Jun 19 20:32:18 PDT 2011 + * Added gearman_work_map() for gearman_work_t describer. + * gearman_execute_by_partition() added. + * gearamn_task_attr_t added. + * Additional documentation update. + * Issue with PHP client using automated task free (Thanks Taneli Leppä!!) + * Fixed issue where PHP client's custom allocator was free'ing memory that did not belong to it. + +0.21 Wed Jun 15 21:01:04 PDT 2011 + * Support for "drop function" in admin client + * Fixed issue where server would not report on a bad unique value due to size + * Forces do operations to complete no matter how the worker is designed. + * Tasks inherit actions from client, and use them throughout execution. + * Support for namespaces. + * gearman_worker_define_function() has been added. It allows jobs to map out work to other workers and then aggregate the results. + * gearman_client_run_tasks() will now reset the IO state for all connections on exit if all hosts have been marked down. The next call will check all hosts. + * Lots of bug fixes. + +0.20 Fri Apr 8 09:25:15 PDT 2011 + * gearman_client_execute() interface added + * New types of gearman_unique_t, gearman_function_st, gearman_workload_t + * Better error reporting from clients. + * Server no longer hangs because of bad job list. + * First bit of work on supporting epoch portion of protocol. John Ewart, john@johnewart.net + * Improved error message handling in client. + * Updates for manpages. + +0.19 Fri Apr 1 09:50:22 PDT 2011 + * Fix bug where gearman util would create duplicate output. + * Update sqlite queue so that it uses a prepared statement. + * Fixes a number cases where server was not initializing default values internally correctly. + * gearman_client_compare() API added. Returns true if the client connections are connects are equivalent. + +0.18 Tue Mar 15 13:32:33 PDT 2011 + * Bug fix for compile when no plugins are requested. + * Bug fix where during startup using Drizzle or MySQL the server could crash. + * Bug fix to make sure test programs will run if NULL sized objects are sent. + + +0.17 Tue Mar 8 08:27:04 PST 2011 + * gearadmin added, easy access to shutdown, version, and verbose commands on the server. + * Bug fixes related to CLI. + * Bug fixes related to Memcached support. + * Bug fixes related to Drizzle support. + * Dependency on boost now required for build. + * Drizzle queue module expects that a schema named "gearmand" exists. + * Fix copyright headers were needed. + +0.16 Tue Feb 22 10:55:33 PST 2011 + * Fixed cases where silent failure of server for queues would not cause tests to fail. + * Fix for failure when setsockopt() failed on new connection. + * Fixed silen exit in client library based on signals. + * Error log now reports failure location in compiled code for ERROR conditions. + * Fix for failover. + * Fixed issue in client where it would silently die based on signal issues. + * "verbose" has been added to the string protocol. It allows you to see what the verbose setting is. + +0.15 Mon Feb 14 18:44:32 PST 2011 + * Numerous issues around overflow on buffers are now fixed. + * Updates on gearmand daemon to share a bit more code. + * Numerious fixes for gearman command line client. + * IPV6 fix for server. + 0.14 Wed Jun 30 13:04:39 PDT 2010 * Leak in SQLite resolved. * updated build configs @@ -8,10 +80,8 @@ * Use OR REPLACE syntax for inserting items into the sqlite. * Changed default bitfield optimize setting to only be off for Solaris. * Refactoring on server. - * Various bug fixes as reported on mailing list, such as a bad return - code and treating EHOSTDOWN as lost connection for FreeBSD. - * Fixed bug #543402 so jobs taking more than max job retries will - be removed from persistentn queue as well. + * Various bug fixes as reported on mailing list, such as a bad return code and treating EHOSTDOWN as lost connection for FreeBSD. + * Fixed bug #543402 so jobs taking more than max job retries will be removed from persistentn queue as well. * Check to make sure worker job results match assigned worker. 0.12 Thu Feb 18 11:28:49 PST 2010 @@ -32,8 +102,7 @@ 0.11 - 2009-11-30 * Added max wakeup-worker option to gearmand. Default is still to wakeup all. * API and documentation cleanup. - * Fixed bug where task context free function was getting called for do() - functions. This was PECL/Gearman bug #16899 as well. + * Fixed bug where task context free function was getting called for do() functions. This was PECL/Gearman bug #16899 as well. * Fixed bug #458912, not flushing with multiple gearmands in client. * Fixed PECL/Gearman bug #16847, was actually in C library and not in PHP. * Fixed C++ build/test/ issue, updated pandora build system. @@ -45,12 +114,10 @@ * Added server option for max job retry. * Changed queue_libdrizzle to overwrite the password string to hide in ps. * Worker unregister bug fixed. Bug #372074 - * Added memory ownership functions so applications can pass control with - tasks, jobs, and packets. + * Added memory ownership functions so applications can pass control with tasks, jobs, and packets. * Changed gearmand to remap stdio to /dev/null for detaching. Bug #407242 * Fixed bug that now allows workers to run concurrent jobs. - * Changed behavior of sending NOOPs to one per PRESLEEP, rather than only - having one in the outgoing queue at any time. + * Changed behavior of sending NOOPs to one per PRESLEEP, rather than only having one in the outgoing queue at any time. * API cleanup to make the code more consistent and object-oriented. * Added more documentation for base classes, client, and worker. * Build system updates. @@ -73,27 +140,21 @@ * Fixed server spinning bug with long running jobs and large workloads. 0.7 - 2009-05-31 - * Added libmodconf for config option processing. Eventually this will be split - into a separate library. Updated gearmand and tests to use libmodconf. + * Added libmodconf for config option processing. Eventually this will be split into a separate library. Updated gearmand and tests to use libmodconf. * Fixed persistent queue bug where jobs were not removed after replay. * Fix for bug #379198. - * Changed done() function for queue, function_name is now passed to it as - well as unique. + * Changed done() function for queue, function_name is now passed to it as well as unique. * Fixed text protocol command response to be dynamic length. * Fixed libevent usage to support libevent 1.1 (still used in CentOS and Suse). - * Added gearman_*_add_servers to client/worker interfaces for taking - server lists. + * Added gearman_*_add_servers to client/worker interfaces for taking server lists. 0.6 - 2009-05-19 - * Changed behavior so forground jobs are not run when their connected clients - disconnect. This is how the Perl server behaves. + * Changed behavior so forground jobs are not run when their connected clients disconnect. This is how the Perl server behaves. * Changed to named logging macros, making it easier for module writers to use. - * Added persistent queue support with a libdrizzle module. This allows queue - storage for both Drizzle and MySQL. + * Added persistent queue support with a libdrizzle module. This allows queue storage for both Drizzle and MySQL. * Added Solaris service scripts (Trond Norbye). * Fixed rpm building (make rpm). - * Removed AI_V4MAPPED for client/worker connect lookup, not fully - supported in all operating systems (like FreeBSD, bug #373060). + * Removed AI_V4MAPPED for client/worker connect lookup, not fully supported in all operating systems (like FreeBSD, bug #373060). * Support for gearmand to bind to multiple addresses. * Protocol document updates and fixes (Eric Day, Eric Herman). * Bind to specific hostname in gearmand (Brian Moon). @@ -113,8 +174,7 @@ * New priority queue in server to support new protocol options. * Reworked the unique ID checking in server. * Added hooks to aid in client memory cleanup. - * Added gearman command line utility to allow you to use clients and - workers from the shell. + * Added gearman command line utility to allow you to use clients and workers from the shell. * Build fixes (Monty Taylor). * Basic init script added. * Fixed getopt bugs with variable type and EOF. diff -Nru gearmand-0.14/config/ltmain.sh gearmand-0.23/config/ltmain.sh --- gearmand-0.14/config/ltmain.sh 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/config/ltmain.sh 2011-06-24 09:14:11.000000000 +0200 @@ -1,9 +1,10 @@ # Generated from ltmain.m4sh. -# ltmain.sh (GNU libtool) 2.2.6b +# libtool (GNU libtool) 2.2.10 # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -32,50 +33,54 @@ # # Provide generalized library-building support services. # -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print informational messages (default) -# --version print version information -# -h, --help print short or long help message +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory # -# MODE-ARGS vary depending on the MODE. +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6b -# automake: $automake_version -# autoconf: $autoconf_version +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.10 +# automake: $automake_version +# autoconf: $autoconf_version # # Report bugs to . -PROGRAM=ltmain.sh +PROGRAM=libtool PACKAGE=libtool -VERSION=2.2.6b +VERSION=2.2.10 TIMESTAMP="" -package_revision=1.3017 +package_revision=1.3175 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -91,10 +96,15 @@ BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + # NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES @@ -107,15 +117,24 @@ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL $lt_unset CDPATH +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" : ${CP="cp -f"} -: ${ECHO="echo"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} @@ -159,32 +178,168 @@ func_dirname_and_basename () { # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # Generated shell functions inserted here. -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} # The name of this program: -# In the unlikely event $progname began with a '-', it would play havoc with -# func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result -case $progname in - -*) progname=./$progname ;; -esac # Make sure we have an absolute path for reexecution: case $progpath in @@ -258,6 +413,13 @@ : } +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + # func_error arg... # Echo program name prefixed message to standard error. func_error () @@ -326,9 +488,9 @@ case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done - my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do @@ -378,7 +540,7 @@ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $ECHO "X$my_tmpdir" | $Xsed + $ECHO "$my_tmpdir" } @@ -392,7 +554,7 @@ { case $1 in *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac @@ -419,7 +581,7 @@ { case $1 in *[\\\`\"]*) - my_arg=`$ECHO "X$1" | $Xsed \ + my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; @@ -489,14 +651,19 @@ } - - - # func_version # Echo version message to standard output and exit. func_version () { - $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ @@ -509,19 +676,20 @@ # Echo short help message to standard output and exit. func_usage () { - $SED -n '/^# Usage:/,/# -h/ { + $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" - $ECHO + echo $ECHO "run \`$progname --help | more' for full usage" exit $? } -# func_help -# Echo long help message to standard output and exit. +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. func_help () { $SED -n '/^# Usage:/,/# Report bugs to/ { @@ -538,7 +706,10 @@ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p }' < "$progpath" - exit $? + ret=$? + if test -z "$1"; then + exit $ret + fi } # func_missing_arg argname @@ -546,7 +717,7 @@ # exit_cmd. func_missing_arg () { - func_error "missing argument for $1" + func_error "missing argument for $1." exit_cmd=exit } @@ -556,29 +727,6 @@ -# Check that we have a working $ECHO. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell, and then maybe $ECHO will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null; then + case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -1867,6 +2067,11 @@ # Aesthetically quote it. func_quote_for_eval "$arg" install_prog="$install_prog$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac # We need to accept at least all the BSD install flags. dest= @@ -1876,8 +2081,10 @@ install_type= isdir=no stripme= + no_mode=: for arg do + arg2= if test -n "$dest"; then files="$files $dest" dest=$arg @@ -1887,10 +2094,9 @@ case $arg in -d) isdir=yes ;; -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac + if $install_cp; then :; else + prev=$arg + fi ;; -g | -m | -o) prev=$arg @@ -1904,6 +2110,10 @@ *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi prev= else dest=$arg @@ -1915,6 +2125,10 @@ # Aesthetically quote the argument. func_quote_for_eval "$arg" install_prog="$install_prog $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + install_shared_prog="$install_shared_prog $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -1923,6 +2137,13 @@ test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" + fi + fi + if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" @@ -2010,7 +2231,7 @@ if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that @@ -2023,9 +2244,9 @@ if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" @@ -2043,7 +2264,7 @@ test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. - func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in @@ -2183,7 +2404,7 @@ if test -f "$lib"; then func_source "$lib" fi - libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no @@ -2202,7 +2423,7 @@ file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" @@ -2221,7 +2442,7 @@ } else # Install the binary that we compiled earlier. - file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi @@ -2323,6 +2544,10 @@ extern \"C\" { #endif +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + /* External symbol declarations for the compiler. */\ " @@ -2332,7 +2557,7 @@ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. - progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_verbose "extracting global C symbols from \`$progfile'" $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" @@ -2371,7 +2596,7 @@ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -2415,10 +2640,10 @@ if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else - $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { @@ -2428,7 +2653,7 @@ " case $host in *cygwin* | *mingw* | *cegcc* ) - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */" @@ -2441,7 +2666,7 @@ lt_dlsym_const=const ;; esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ extern $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; $lt_dlsym_const lt_dlsymlist @@ -2457,7 +2682,7 @@ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; @@ -2515,16 +2740,16 @@ case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; @@ -2538,8 +2763,8 @@ # really was required. # Nullify the symbol file. - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } @@ -2549,6 +2774,7 @@ # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug @@ -2559,8 +2785,9 @@ win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e ' 1,100{ @@ -2598,7 +2825,18 @@ $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else @@ -2669,7 +2907,7 @@ darwin_file= darwin_files= for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ @@ -2684,25 +2922,30 @@ func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } - -# func_emit_wrapper_part1 [arg=no] +# func_emit_wrapper [arg=no] # -# Emit the first part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part1 () -{ - func_emit_wrapper_part1_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part1_arg1=$1 - fi +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL @@ -2718,7 +2961,6 @@ # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible @@ -2749,31 +2991,132 @@ else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then - ECHO=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$ECHO works! - : - else - # Restart under the correct shell, and then maybe \$ECHO will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ " - $ECHO "\ + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. - thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do - destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then @@ -2783,30 +3126,13 @@ esac fi - file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done -" -} -# end: func_emit_wrapper_part1 - -# func_emit_wrapper_part2 [arg=no] -# -# Emit the second part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part2 () -{ - func_emit_wrapper_part2_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part2_arg1=$1 - fi - - $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then @@ -2814,7 +3140,7 @@ fi # remove .libs from thisdir case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi @@ -2877,7 +3203,7 @@ # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " @@ -2894,64 +3220,18 @@ $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 + func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } -# end: func_emit_wrapper_part2 - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=no - if test -n "$1" ; then - func_emit_wrapper_arg1=$1 - fi - - # split this up so that func_emit_cwrapperexe_src - # can call each part independently. - func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" - func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" -} # func_to_host_path arg @@ -2978,23 +3258,19 @@ func_to_host_path () { func_to_host_path_result="$1" - if test -n "$1" ; then + if test -n "$1"; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' case $build in *mingw* ) # actually, msys # awkward: cmd appends spaces to result - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_path_tmp1=`( cmd //c echo "$1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` + func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) - func_to_host_path_tmp1=`cygpath -w "$1"` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` + func_to_host_path_result=`cygpath -w "$1" | + $SED -e "$lt_sed_naive_backslashify"` ;; * ) # Unfortunately, winepath does not exit with a non-zero @@ -3006,17 +3282,17 @@ # the odd construction: func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | $SED -e "$lt_sed_naive_backslashify"` else # Allow warning below. - func_to_host_path_result="" + func_to_host_path_result= fi ;; esac if test -z "$func_to_host_path_result" ; then func_error "Could not determine host path corresponding to" - func_error " '$1'" + func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_path_result="$1" @@ -3049,30 +3325,24 @@ func_to_host_pathlist () { func_to_host_pathlist_result="$1" - if test -n "$1" ; then + if test -n "$1"; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. - func_to_host_pathlist_tmp2="$1" - # Once set for this call, this variable should not be - # reassigned. It is used in tha fallback case. - func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e 's|^:*||' -e 's|:*$||'` + func_stripname : : "$1" + func_to_host_pathlist_tmp1=$func_stripname_result case $build in *mingw* ) # Actually, msys. # Awkward: cmd appends spaces to result. - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` + func_to_host_pathlist_result=` + ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) - func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | $SED -e "$lt_sed_naive_backslashify"` ;; * ) @@ -3088,18 +3358,17 @@ if test -z "$func_to_host_pathlist_result" ; then func_to_host_pathlist_result="$func_to_host_path_result" else - func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + func_append func_to_host_pathlist_result ";$func_to_host_path_result" fi fi fi - IFS=: done IFS=$func_to_host_pathlist_oldIFS ;; esac - if test -z "$func_to_host_pathlist_result" ; then + if test -z "$func_to_host_pathlist_result"; then func_error "Could not determine the host path(s) corresponding to" - func_error " '$1'" + func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This may break if $1 contains DOS-style drive # specifications. The fix is not to complicate the expression @@ -3116,7 +3385,7 @@ ;; esac case "$1" in - *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + *: ) func_append func_to_host_pathlist_result ";" ;; esac ;; @@ -3141,31 +3410,23 @@ This wrapper executable should never be moved out of the build directory. If it is, it will not operate correctly. - - Currently, it simply execs the wrapper *script* "$SHELL $output", - but could eventually absorb all of the scripts functionality and - exec $objdir/$outputname directly. */ EOF cat <<"EOF" +#ifdef _MSC_VER +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif #include #include #ifdef _MSC_VER # include # include # include -# define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include -# define HAVE_SETENV -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif # endif #endif #include @@ -3177,6 +3438,44 @@ #include #include +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) @@ -3192,14 +3491,7 @@ # define S_IXGRP 0 #endif -#ifdef _MSC_VER -# define S_IXUSR _S_IEXEC -# define stat _stat -# ifndef _INTPTR_T_DEFINED -# define intptr_t int -# endif -#endif - +/* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' @@ -3230,10 +3522,6 @@ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ -#ifdef __CYGWIN__ -# define FOPEN_WB "wb" -#endif - #ifndef FOPEN_WB # define FOPEN_WB "w" #endif @@ -3246,22 +3534,13 @@ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#undef LTWRAPPER_DEBUGPRINTF -#if defined DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; #else -# define LTWRAPPER_DEBUGPRINTF(args) +static int lt_debug = 0; #endif -const char *program_name = NULL; +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); @@ -3271,31 +3550,17 @@ int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_opt_process_env_set (const char *arg); -void lt_opt_process_env_prepend (const char *arg); -void lt_opt_process_env_append (const char *arg); -int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); - -static const char *script_text_part1 = -EOF - - func_emit_wrapper_part1 yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ "/' -e 's/$/\\n"/' - echo ";" - cat <"))); + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", + nonnull (lt_argv_zero)); for (i = 0; i < newargc; i++) { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", + i, nonnull (newargz[i])); } EOF @@ -3560,11 +3782,14 @@ mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ + newargz = prepare_spawn (newargz); rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + lt_debugprintf (__FILE__, __LINE__, + "(main) failed to launch target \"%s\": %s\n", + lt_argv_zero, nonnull (strerror (errno))); return 127; } return rval; @@ -3586,7 +3811,7 @@ { void *p = (void *) malloc (num); if (!p) - lt_fatal ("Memory exhausted"); + lt_fatal (__FILE__, __LINE__, "memory exhausted"); return p; } @@ -3620,8 +3845,8 @@ { struct stat st; - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3638,8 +3863,8 @@ int rval = 0; struct stat st; - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3665,8 +3890,8 @@ int tmp_len; char *concat_name; - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; @@ -3719,7 +3944,8 @@ { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); @@ -3744,7 +3970,8 @@ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); @@ -3770,8 +3997,9 @@ int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) @@ -3793,8 +4021,9 @@ } else { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); @@ -3807,7 +4036,8 @@ tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { - lt_fatal ("Could not follow symlinks for %s", pathspec); + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif @@ -3833,11 +4063,25 @@ return str; } +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + static void -lt_error_core (int exit_status, const char *mode, +lt_error_core (int exit_status, const char *file, + int line, const char *mode, const char *message, va_list ap) { - fprintf (stderr, "%s: %s: ", program_name, mode); + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); @@ -3846,20 +4090,32 @@ } void -lt_fatal (const char *message, ...) +lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + void lt_setenv (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ @@ -3904,95 +4160,12 @@ return new_value; } -int -lt_split_name_value (const char *arg, char** name, char** value) -{ - const char *p; - int len; - if (!arg || !*arg) - return 1; - - p = strchr (arg, (int)'='); - - if (!p) - return 1; - - *value = xstrdup (++p); - - len = strlen (arg) - strlen (*value); - *name = XMALLOC (char, len); - strncpy (*name, arg, len-1); - (*name)[len - 1] = '\0'; - - return 0; -} - -void -lt_opt_process_env_set (const char *arg) -{ - char *name = NULL; - char *value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); - } - - lt_setenv (name, value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_prepend (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_append (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 1); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - void lt_update_exe_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4011,9 +4184,9 @@ void lt_update_lib_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4023,11 +4196,152 @@ } } +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + + cat <<"EOF" +} EOF } # end: func_emit_cwrapperexe_src +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + # func_mode_link arg... func_mode_link () { @@ -4072,6 +4386,7 @@ new_inherited_linker_flags= avoid_version=no + bindir= dlfiles= dlprefiles= dlself=no @@ -4164,6 +4479,11 @@ esac case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. @@ -4425,6 +4745,11 @@ continue ;; + -bindir) + prev=bindir + continue + ;; + -dlopen) prev=dlfiles continue @@ -4503,7 +4828,7 @@ esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; @@ -4522,7 +4847,7 @@ -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -4708,7 +5033,7 @@ for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" + arg="$arg $func_quote_for_eval_result" compiler_flags="$compiler_flags $func_quote_for_eval_result" done IFS="$save_ifs" @@ -4754,18 +5079,19 @@ arg="$func_quote_for_eval_result" ;; - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" @@ -4925,7 +5251,7 @@ if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi @@ -5048,7 +5374,8 @@ # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do - deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + func_basename "$deplib" + deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; @@ -5227,7 +5554,7 @@ match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi @@ -5237,15 +5564,15 @@ ;; esac if test "$valid_a_lib" != yes; then - $ECHO + echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because the file extensions .$libext of this argument makes me believe" - $ECHO "*** that it is just a static archive that I should not use here." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" @@ -5318,7 +5645,7 @@ # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; @@ -5326,7 +5653,7 @@ esac done fi - dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then @@ -5580,7 +5907,7 @@ fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - $ECHO + echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else @@ -5683,9 +6010,9 @@ if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then - $ECHO - $ECHO "*** And there doesn't seem to be a static archive available" - $ECHO "*** The link will probably fail, sorry" + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi @@ -5825,21 +6152,21 @@ # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $ECHO + echo $ECHO "*** Warning: This system can not link to static lib archive $lib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $ECHO "*** But as you try to build a module library, libtool will still create " - $ECHO "*** a static module, that should work as long as the dlopening application" - $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -5893,6 +6220,7 @@ if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do + path= case $deplib in -L*) path="$deplib" ;; *.la) @@ -5958,7 +6286,7 @@ compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else - compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" @@ -6126,7 +6454,7 @@ if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" libobjs="$libobjs $objs" @@ -6194,7 +6522,7 @@ age="$number_minor" revision="$number_revision" ;; - freebsd-aout|freebsd-elf|sunos) + freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" @@ -6428,14 +6756,14 @@ oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do - # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` - # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` - # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then @@ -6476,7 +6804,7 @@ if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) @@ -6561,13 +6889,13 @@ newdeplibs="$newdeplibs $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which I believe you do not have" - $ECHO "*** because a test_compile did reveal that the linker did not use it for" - $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." fi fi ;; @@ -6604,22 +6932,22 @@ newdeplibs="$newdeplibs $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because a test_compile did reveal that the linker did not use this one" - $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi fi else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning! Library $i is needed by this library but I was not able to" - $ECHO "*** make it link in! You will probably need to install it or some" - $ECHO "*** library that it depends on before this library will be fully" - $ECHO "*** functional. Installing it before continuing would be even better." + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi ;; *) @@ -6665,7 +6993,7 @@ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | @@ -6680,12 +7008,12 @@ fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else @@ -6723,7 +7051,7 @@ potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" @@ -6734,12 +7062,12 @@ fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else @@ -6757,25 +7085,25 @@ ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ - -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi - if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | - $GREP . >/dev/null; then - $ECHO + case $tmp_deplibs in + *[!\ \ ]*) + echo if test "X$deplibs_check_method" = "Xnone"; then - $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $ECHO "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $ECHO "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes - fi + ;; + esac ;; esac versuffix=$versuffix_save @@ -6787,23 +7115,23 @@ case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then - $ECHO - $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - $ECHO "*** a static module, that should work as long as the dlopening" - $ECHO "*** application is linked with the -dlopen flag." + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -6813,16 +7141,16 @@ build_libtool_libs=no fi else - $ECHO "*** The inter-library dependencies that have been dropped here will be" - $ECHO "*** automatically added whenever a program is linked with this library" - $ECHO "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then - $ECHO - $ECHO "*** Since this library must not contain undefined symbols," - $ECHO "*** because either the platform does not support them or" - $ECHO "*** it was explicitly requested with -no-undefined," - $ECHO "*** libtool will only create a static version of it." + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -6839,9 +7167,9 @@ # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -6963,7 +7291,7 @@ done # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= @@ -7029,7 +7357,7 @@ if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then @@ -7130,7 +7458,8 @@ save_libobjs=$libobjs fi save_output=$output - output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + func_basename "$output" + output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. @@ -7143,12 +7472,12 @@ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" - $ECHO 'INPUT (' > $output + echo 'INPUT (' > $output for obj in $save_libobjs do $ECHO "$obj" >> $output done - $ECHO ')' >> $output + echo ')' >> $output delfiles="$delfiles $output" elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk @@ -7190,17 +7519,19 @@ # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext - objlist=$obj + objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result @@ -7210,7 +7541,8 @@ # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi @@ -7269,7 +7601,7 @@ if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then @@ -7434,7 +7766,7 @@ if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" @@ -7445,7 +7777,7 @@ fi # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' @@ -7505,8 +7837,8 @@ case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac @@ -7523,8 +7855,8 @@ esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -7661,8 +7993,8 @@ if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. - compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" @@ -7674,15 +8006,15 @@ wrappers_required=yes case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no @@ -7691,7 +8023,7 @@ esac if test "$wrappers_required" = no; then # Replace the output file specification. - compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. @@ -7738,7 +8070,7 @@ # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit @@ -7757,7 +8089,7 @@ if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= @@ -7769,7 +8101,7 @@ fi # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname @@ -7793,18 +8125,7 @@ fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $ECHO for shipping. - if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. @@ -7925,7 +8246,7 @@ done | sort | sort -uc >/dev/null 2>&1); then : else - $ECHO "copying selected object files to avoid basename conflicts..." + echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_mkdir_p "$gentop" @@ -8036,7 +8357,7 @@ done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -8121,9 +8442,27 @@ fi $RM $output # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; esac $ECHO > $output "\ # $outputname - a libtool library file diff -Nru gearmand-0.14/config.h.in gearmand-0.23/config.h.in --- gearmand-0.14/config.h.in 2010-06-30 20:31:21.000000000 +0200 +++ gearmand-0.23/config.h.in 2011-06-29 23:00:23.000000000 +0200 @@ -1,24 +1,85 @@ /* config.h.in. Generated from configure.ac by autoheader. */ + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +/* _SYS_FEATURE_TESTS_H is Solaris, _FEATURES_H is GCC */ +#if defined( _SYS_FEATURE_TESTS_H) || defined(_FEATURES_H) +#error "You should include config.h as your first include file" +#endif + + + /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* the location of */ +#undef CINTTYPES_H + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* the location of */ +#undef CSTDINT_H + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Another magical number */ +#undef EAI_SYSTEM + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + /* Define to 1 if you have the header file. */ #undef HAVE_ASSERT_H +/* Defined if the requested minimum BOOST version is satisfied */ +#undef HAVE_BOOST + +/* Define to 1 if you have */ +#undef HAVE_BOOST_PROGRAM_OPTIONS_HPP + +/* Define to 1 if you have the `btowc' function. */ +#undef HAVE_BTOWC + /* Have a working clock_gettime function */ #undef HAVE_CLOCK_GETTIME +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + /* Define to 1 if you have the declaration of `madvise', and to 0 if you don't. */ #undef HAVE_DECL_MADVISE +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + /* Enables DTRACE Support */ #undef HAVE_DTRACE +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H @@ -34,12 +95,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + /* Define to 1 if compiler provides atomic builtins. */ #undef HAVE_GCC_ATOMIC_BUILTINS /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -49,21 +116,15 @@ /* Define to 1 if you have the `c_p' library (-lc_p). */ #undef HAVE_LIBC_P -/* Define if you have the drizzle library. */ +/* Enable libdrizzle support */ #undef HAVE_LIBDRIZZLE /* Define if you have the event library. */ #undef HAVE_LIBEVENT -/* Define if you have the gtest library. */ -#undef HAVE_LIBGTEST - -/* Define if you have the memcached library. */ +/* Enable libmemcached support */ #undef HAVE_LIBMEMCACHED -/* Define if you have the memcachedprotocol library. */ -#undef HAVE_LIBMEMCACHEDPROTOCOL - /* Define to 1 if you have the `mtmalloc' library (-lmtmalloc). */ #undef HAVE_LIBMTMALLOC @@ -95,16 +156,46 @@ /* Define if you have the uuid library. */ #undef HAVE_LIBUUID +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC -/* If we have the new memcached_server_fn typedef */ -#undef HAVE_MEMCACHED_SERVER_FN +/* Define to 1 if you have the `mbsrtowcs' function. */ +#undef HAVE_MBSRTOWCS + +/* Define to 1 if declares mbstate_t. */ +#undef HAVE_MBSTATE_T + +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `mempcpy' function. */ +#undef HAVE_MEMPCPY + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have a MSG_DONTWAIT */ +#undef HAVE_MSG_DONTWAIT + +/* Define to 1 if you have a MSG_NOSIGNAL */ +#undef HAVE_MSG_NOSIGNAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_TCP_H @@ -171,6 +262,9 @@ /* pthread_yield that doesn't take any arguments */ #undef HAVE_PTHREAD_YIELD_ZERO_ARG +/* Define to 1 if the system has the type `ptrdiff_t'. */ +#undef HAVE_PTRDIFF_T + /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H @@ -190,11 +284,14 @@ /* POSIX sigwait */ #undef HAVE_SIGWAIT +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H -/* Define if g++ supports C++0x features. */ -#undef HAVE_STDCXX_0X +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H @@ -208,37 +305,94 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SDT_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UTSNAME_H +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_UUID_UUID_H +/* Add additional valgrind code for testing with valgrind. */ +#undef HAVE_VALGRIND + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + /* Define to 1 or 0, depending whether the compiler supports simple visibility declarations. */ #undef HAVE_VISIBILITY +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the `wmempcpy' function. */ +#undef HAVE_WMEMPCPY + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + /* CPU of Build System */ #undef HOST_CPU @@ -282,10 +436,19 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Version of the software */ +#undef PANDORA_RELEASE_VERSION + /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define if system doesn't define */ +#undef RUSAGE_THREAD + /* Size of long long as computed by sizeof() */ #undef SIZEOF_LONG_LONG @@ -295,12 +458,23 @@ /* Size of size_t as computed by sizeof() */ #undef SIZEOF_SIZE_T +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + /* Define if ISO C++ 1998 header files are present. */ #undef STDCXX_98_HEADERS /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + /* CPU of Target System */ #undef TARGET_CPU @@ -319,6 +493,9 @@ /* Whether we are building for Solaris */ #undef TARGET_OS_SOLARIS +/* Whether we are building for Windows */ +#undef TARGET_OS_WINDOWS + /* Vendor of Target System */ #undef TARGET_VENDOR @@ -334,6 +511,9 @@ /* Version number of package */ #undef VERSION +/* Version of Windows */ +#undef WINVER + /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD @@ -365,6 +545,24 @@ /* Cause Sun Studio to not be quite so strict with standards conflicts */ #undef _STLP_NO_NEW_C_HEADERS +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Magical number to make things work */ +#undef _WIN32_WINNT + /* Define to 500 only on HP-UX. */ #undef _XOPEN_SOURCE @@ -393,18 +591,43 @@ #endif +/* Use STDC Constant Macros in C++ */ +#undef __STDC_CONSTANT_MACROS + +/* Use STDC Format Macros in C++ */ +#undef __STDC_FORMAT_MACROS + +/* Use STDC Limit Macros in C++ */ +#undef __STDC_LIMIT_MACROS + /* Define to empty if `const' does not conform to ANSI C. */ #undef const +/* Define to rpl_fnmatch if the replacement function should be used. */ +#undef fnmatch + +/* Define to `int' if doesn't define. */ +#undef gid_t + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc +/* Define to a type if does not define. */ +#undef mbstate_t + +/* Define to `int' if does not define. */ +#undef pid_t + /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc @@ -425,6 +648,112 @@ /* Define to `unsigned int' if does not define. */ #undef size_t +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `int' if doesn't define. */ +#undef uid_t + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork + /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ #undef volatile + + +#ifndef HAVE_SYS_SOCKET_H +# define SHUT_RD SD_RECEIVE +# define SHUT_WR SD_SEND +# define SHUT_RDWR SD_BOTH +#endif + + + +#if defined(__cplusplus) +# include CSTDINT_H +# include CINTTYPES_H +#else +# include +# include +#endif + +#if !defined(HAVE_ULONG) && !defined(__USE_MISC) +# define HAVE_ULONG 1 +typedef unsigned long int ulong; +#endif + +/* To hide the platform differences between MS Windows and Unix, I am + * going to use the Microsoft way and #define the Microsoft-specific + * functions to the unix way. Microsoft use a separate subsystem for sockets, + * but Unix normally just use a filedescriptor on the same functions. It is + * a lot easier to map back to the unix way with macros than going the other + * way without side effect ;-) + */ +#ifdef TARGET_OS_WINDOWS +#define random() rand() +#define srandom(a) srand(a) +#define get_socket_errno() WSAGetLastError() +#else +#define INVALID_SOCKET -1 +#define SOCKET_ERROR -1 +#ifdef __cplusplus +#define closesocket(a) ::close(a) +#else +#define closesocket(a) close(a) +#endif +#define get_socket_errno() errno +#endif // TARGET_OS_WINDOWS + +#ifndef HAVE_MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif // HAVE_MSG_NOSIGNAL + +#ifndef HAVE_MSG_DONTWAIT +#define MSG_DONTWAIT 0 +#endif // HAVE_MSG_DONTWAIT + +#if defined(__cplusplus) +# if defined(DEBUG) +# include +# include +# endif +template +inline To implicit_cast(From const &f) { + return f; +} +template // use like this: down_cast(foo); +inline To down_cast(From* f) { // so we only accept pointers + // Ensures that To is a sub-type of From *. This test is here only + // for compile-time type checking, and has no overhead in an + // optimized build at run-time, as it will be optimized away + // completely. + if (false) { + implicit_cast(0); + } + +#if defined(DEBUG) + assert(f == NULL || dynamic_cast(f) != NULL); // RTTI: debug mode only! +#endif + return static_cast(f); +} +#endif /* defined(__cplusplus) */ + +#endif /* __CONFIG_H__ */ + diff -Nru gearmand-0.14/configure gearmand-0.23/configure --- gearmand-0.14/configure 2010-06-30 20:31:24.000000000 +0200 +++ gearmand-0.23/configure 2011-06-29 22:59:33.000000000 +0200 @@ -1,14 +1,14 @@ #! /bin/sh # Grabbing changelog and version information from bzr # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for gearmand 0.14. +# Generated by GNU Autoconf 2.66 for gearmand 0.23. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -174,7 +174,15 @@ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else @@ -320,7 +328,7 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -360,19 +368,19 @@ fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -529,161 +537,14 @@ # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -702,12 +563,12 @@ # Identity of this package. PACKAGE_NAME='gearmand' PACKAGE_TARNAME='gearmand' -PACKAGE_VERSION='0.14' -PACKAGE_STRING='gearmand 0.14' +PACKAGE_VERSION='0.23' +PACKAGE_STRING='gearmand 0.23' PACKAGE_BUGREPORT='https://launchpad.net/gearmand' PACKAGE_URL='' -ac_unique_file="libgearman/gearman.c" +ac_unique_file="libgearman/gearman.cc" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -747,11 +608,12 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS +ALLOCA +LIBOBJS HAVE_LIBTOKYOCABINET_FALSE HAVE_LIBTOKYOCABINET_TRUE LIBTOKYOCABINET_LIBS LIBTOKYOCABINET_CFLAGS -PKG_CONFIG LIBTOKYOCABINET_PREFIX LTLIBTOKYOCABINET LIBTOKYOCABINET @@ -762,37 +624,12 @@ LTLIBPQ LIBPQ HAVE_LIBPQ -HAVE_MEMCACHED_FALSE -HAVE_MEMCACHED_TRUE -MEMCACHED_BINARY -HAVE_LIBMEMCACHED_FALSE -HAVE_LIBMEMCACHED_TRUE -LIBMEMCACHEDPROTOCOL_PREFIX -LTLIBMEMCACHEDPROTOCOL -LIBMEMCACHEDPROTOCOL -HAVE_LIBMEMCACHEDPROTOCOL -LIBMEMCACHED_PREFIX -LTLIBMEMCACHED -LIBMEMCACHED -HAVE_LIBMEMCACHED -HAVE_LIBDRIZZLE_FALSE -HAVE_LIBDRIZZLE_TRUE -LIBDRIZZLE_PREFIX -LTLIBDRIZZLE -LIBDRIZZLE -HAVE_LIBDRIZZLE HAVE_LIBSQLITE3_FALSE HAVE_LIBSQLITE3_TRUE LIBSQLITE3_PREFIX LTLIBSQLITE3 LIBSQLITE3 HAVE_LIBSQLITE3 -HAVE_LIBGTEST_FALSE -HAVE_LIBGTEST_TRUE -LIBGTEST_PREFIX -LTLIBGTEST -LIBGTEST -HAVE_LIBGTEST HAVE_LIBUUID_FALSE HAVE_LIBUUID_TRUE LIBUUID_PREFIX @@ -809,29 +646,62 @@ PTHREAD_LIBS PTHREAD_CC acx_pthread_config +HAVE_LIBDRIZZLE_FALSE +HAVE_LIBDRIZZLE_TRUE +libdrizzle_LIBS +libdrizzle_CFLAGS +HAVE_MEMCACHED_FALSE +HAVE_MEMCACHED_TRUE +MEMCACHED_BINARY +HAVE_LIBMEMCACHED_FALSE +HAVE_LIBMEMCACHED_TRUE +libmemcached_LIBS +libmemcached_CFLAGS +PKG_CONFIG +BOOST_PROGRAM_OPTIONS_LIBS +BOOST_LDPATH +BOOST_PROGRAM_OPTIONS_LDPATH +BOOST_PROGRAM_OPTIONS_LDFLAGS +BOOST_CPPFLAGS +DISTCHECK_CONFIGURE_FLAGS +BOOST_ROOT GEARMAN_LIBRARY_VERSION AM_LDFLAGS AM_CPPFLAGS AM_CXXFLAGS AM_CFLAGS +HAVE_RECENT_SPHINX_FALSE +HAVE_RECENT_SPHINX_TRUE +HAVE_SPHINX_FALSE +HAVE_SPHINX_TRUE HAVE_DPKG_GENSYMBOLS_FALSE HAVE_DPKG_GENSYMBOLS_TRUE +SPHINXBUILD +LCOV_GENHTML +LCOV DPKG_GENSYMBOLS PERL DOXYGEN +HAVE_VALGRIND_FALSE +HAVE_VALGRIND_TRUE BETTER_MALLOC_LIBS -LIBOBJS DTRACE_NEEDS_OBJECTS_FALSE DTRACE_NEEDS_OBJECTS_TRUE HAVE_DTRACE_FALSE HAVE_DTRACE_TRUE DTRACEFLAGS DTRACE +INTLTOOL_WARNINGS +SPHINX_WARNINGS GCOV_LIBS NO_WERROR +PERMISSIVE_C_WARNINGS +PERMISSIVE_WARNINGS +BOOSTSKIP_WARNINGS INNOBASE_SKIP_WARNINGS PROTOSKIP_WARNINGS NO_OLD_STYLE_CAST +NO_EFF_CXX NO_STRICT_ALIASING NO_SHADOW NO_UNREACHED @@ -839,6 +709,8 @@ NO_CONVERSION LIBC_P HAVE_VISIBILITY +NO_VISIBILITY +CXXFLAG_VISIBILITY CFLAG_VISIBILITY LIBM CXX_VERSION @@ -850,7 +722,6 @@ LIPO NMEDIT DSYMUTIL -lt_ECHO RANLIB AR OBJDUMP @@ -863,13 +734,15 @@ SED LIBTOOL PANDORA_OPTIMIZE_BITFIELD +TARGET_OSX_FALSE +TARGET_OSX_TRUE +BUILD_WIN32_FALSE +BUILD_WIN32_TRUE +TARGET_WINDOWS TARGET_FREEBSD TARGET_SOLARIS TARGET_OSX TARGET_LINUX -EGREP -GREP -CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE @@ -877,7 +750,13 @@ CXXFLAGS CXX PANDORA_HEX_VERSION +PANDORA_RELEASE_ID +PANDORA_RELEASE_VERSION +PANDORA_RELEASE_COMMENT ISAINFO +EGREP +GREP +CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -985,6 +864,7 @@ enable_largefile with_debug enable_assert +enable_gcc_profile_mode enable_profiling enable_coverage enable_dtrace @@ -992,19 +872,17 @@ enable_umem enable_tcmalloc enable_mtmalloc +with_valgrind +with_boost +enable_static_boost +enable_libmemcached +with_memcached +enable_libdrizzle enable_rpath with_libevent_prefix with_libuuid_prefix -enable_libgtest -with_libgtest_prefix enable_libsqlite3 with_libsqlite3_prefix -enable_libdrizzle -with_libdrizzle_prefix -enable_libmemcached -with_libmemcached_prefix -with_libmemcachedprotocol_prefix -with_memcached enable_libpq with_libpq_prefix enable_libtokyocabinet @@ -1018,12 +896,17 @@ LDFLAGS LIBS CPPFLAGS +CPP CXX CXXFLAGS CCC -CPP CXXCPP +BOOST_ROOT PKG_CONFIG +libmemcached_CFLAGS +libmemcached_LIBS +libdrizzle_CFLAGS +libdrizzle_LIBS LIBTOKYOCABINET_CFLAGS LIBTOKYOCABINET_LIBS' @@ -1134,7 +1017,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1160,7 +1043,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1364,7 +1247,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1380,7 +1263,7 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1410,8 +1293,8 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1419,7 +1302,7 @@ # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1437,13 +1320,13 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1466,7 +1349,7 @@ [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1480,8 +1363,8 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1496,9 +1379,9 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1537,11 +1420,11 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1567,7 +1450,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gearmand 0.14 to adapt to many kinds of systems. +\`configure' configures gearmand 0.23 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1581,7 +1464,7 @@ --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1638,7 +1521,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gearmand 0.14:";; + short | recursive ) echo "Configuration of gearmand 0.23:";; esac cat <<\_ACEOF @@ -1659,17 +1542,20 @@ --disable-libtool-lock avoid locking (might break parallel builds) --disable-largefile omit support for large files --disable-assert Turn off assertions + --enable-gcc-profile-mode + Toggle gcc profile mode [default=off] --enable-profiling Toggle profiling [default=off] --enable-coverage Toggle coverage [default=off] - --enable-dtrace Build with support for the DTRACE. [default=off] + --disable-dtrace Build with support for the DTRACE. [default=on] --enable-umem Enable linking with libumem [default=off] --enable-tcmalloc Enable linking with tcmalloc [default=off] --disable-mtmalloc Enable linking with mtmalloc [default=on] + --enable-static-boost Prefer the static boost libraries over the shared + ones [no] + --disable-libmemcached Build with libmemcached support [default=on] + --disable-libdrizzle Build with libdrizzle support [default=on] --disable-rpath do not hardcode runtime library paths - --disable-libgtest Build with libgtest support [default=on] --disable-libsqlite3 Build with libsqlite3 support [default=on] - --disable-libdrizzle Build with libdrizzle support [default=on] - --disable-libmemcached Build with libmemcached support [default=on] --disable-libpq Build with libpq support [default=on] --disable-libtokyocabinet Build with libtokyocabinet support [default=on] @@ -1684,22 +1570,17 @@ [default=no] --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir + --with-valgrind Add additional valgrind code for testing with + valgrind. + --with-boost=DIR prefix of Boost 1.39.0 [guess] + --with-memcached Memcached binary to use for make test --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libevent-prefix[=DIR] search for libevent in DIR/include and DIR/lib --without-libevent-prefix don't search for libevent in includedir and libdir --with-libuuid-prefix[=DIR] search for libuuid in DIR/include and DIR/lib --without-libuuid-prefix don't search for libuuid in includedir and libdir - --with-libgtest-prefix[=DIR] search for libgtest in DIR/include and DIR/lib - --without-libgtest-prefix don't search for libgtest in includedir and libdir --with-libsqlite3-prefix[=DIR] search for libsqlite3 in DIR/include and DIR/lib --without-libsqlite3-prefix don't search for libsqlite3 in includedir and libdir - --with-libdrizzle-prefix[=DIR] search for libdrizzle in DIR/include and DIR/lib - --without-libdrizzle-prefix don't search for libdrizzle in includedir and libdir - --with-libmemcached-prefix[=DIR] search for libmemcached in DIR/include and DIR/lib - --without-libmemcached-prefix don't search for libmemcached in includedir and libdir - --with-libmemcachedprotocol-prefix[=DIR] search for libmemcachedprotocol in DIR/include and DIR/lib - --without-libmemcachedprotocol-prefix don't search for libmemcachedprotocol in includedir and libdir - --with-memcached Memcached binary to use for make test --with-libpq-prefix[=DIR] search for libpq in DIR/include and DIR/lib --without-libpq-prefix don't search for libpq in includedir and libdir --with-libtokyocabinet-prefix[=DIR] search for libtokyocabinet in DIR/include and DIR/lib @@ -1713,11 +1594,20 @@ LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory + CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags - CPP C preprocessor CXXCPP C++ preprocessor + BOOST_ROOT Location of Boost installation PKG_CONFIG path to pkg-config utility + libmemcached_CFLAGS + C compiler flags for libmemcached, overriding pkg-config + libmemcached_LIBS + linker flags for libmemcached, overriding pkg-config + libdrizzle_CFLAGS + C compiler flags for libdrizzle, overriding pkg-config + libdrizzle_LIBS + linker flags for libdrizzle, overriding pkg-config LIBTOKYOCABINET_CFLAGS C compiler flags for LIBTOKYOCABINET, overriding pkg-config LIBTOKYOCABINET_LIBS @@ -1789,10 +1679,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gearmand configure 0.14 -generated by GNU Autoconf 2.65 +gearmand configure 0.23 +generated by GNU Autoconf 2.66 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1841,44 +1731,6 @@ } # ac_fn_c_try_compile -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -1924,10 +1776,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1986,17 +1838,15 @@ $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( cat <<\_ASBOX -## --------------------------------------------- ## +( $as_echo "## --------------------------------------------- ## ## Report this to https://launchpad.net/gearmand ## -## --------------------------------------------- ## -_ASBOX +## --------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2060,7 +1910,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2082,15 +1932,56 @@ } # ac_fn_c_check_header_compile -# ac_fn_c_check_decl LINENO SYMBOL VAR -# ------------------------------------ -# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2099,8 +1990,12 @@ int main () { -#ifndef $2 - (void) $2; +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif #endif ; @@ -2175,7 +2070,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2326,7 +2221,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2549,15 +2444,18 @@ } # ac_fn_c_compute_int -# ac_fn_cxx_check_decl LINENO SYMBOL VAR -# -------------------------------------- -# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +# ac_fn_cxx_check_decl LINENO SYMBOL VAR INCLUDES +# ----------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. ac_fn_cxx_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2566,8 +2464,12 @@ int main () { -#ifndef $2 - (void) $2; +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif #endif ; @@ -2587,41 +2489,259 @@ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_decl -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by gearmand $as_me 0.14, which was -generated by GNU Autoconf 2.65. Invocation command line was - - $ $0 $@ -_ACEOF -exec 5>>config.log +# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES +# --------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_cxx_check_header_mongrel () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } -_ASUNAME +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## --------------------------------------------- ## +## Report this to https://launchpad.net/gearmand ## +## --------------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_cxx_check_header_mongrel + +# ac_fn_c_find_intX_t LINENO BITS VAR +# ----------------------------------- +# Finds a signed integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_intX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +$as_echo_n "checking for int$2_t... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in int$2_t 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main () +{ +static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) + < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + case $ac_type in #( + int$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_find_intX_t + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +$as_echo_n "checking for uint$2_t... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_find_uintX_t +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by gearmand $as_me 0.23, which was +generated by GNU Autoconf 2.66. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2702,11 +2822,9 @@ { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2740,11 +2858,9 @@ ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2757,11 +2873,9 @@ echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2775,11 +2889,9 @@ fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2834,7 +2946,12 @@ ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2849,7 +2966,11 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2925,7 +3046,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2941,16 +3062,22 @@ ac_aux_dir= for ac_dir in config "$srcdir"/config; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2964,6 +3091,7 @@ + # Check whether --enable-fat-binaries was given. if test "${enable_fat_binaries+set}" = set; then : enableval=$enable_fat_binaries; ac_enable_fat_binaries="$enableval" @@ -2985,7 +3113,7 @@ # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } @@ -2996,16 +3124,16 @@ test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -3030,7 +3158,7 @@ ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -3038,7 +3166,7 @@ $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -3063,7 +3191,7 @@ ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi @@ -3071,7 +3199,7 @@ $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error "invalid value of canonical target" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -3199,11 +3327,11 @@ ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -3225,7 +3353,7 @@ # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - as_fn_error "ls -t appears to fail. Make sure there is not a broken + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi @@ -3235,7 +3363,7 @@ # Ok. : else - as_fn_error "newly created file is older than distributed files! + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -3473,7 +3601,7 @@ $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3481,7 +3609,7 @@ all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -3871,8 +3999,8 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3986,9 +4114,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -4030,8 +4157,8 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -4088,9 +4215,9 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -4141,8 +4268,8 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -4489,199 +4616,497 @@ fi -if test "$GCC" = "yes"; then : - - if test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"; then : - - host_os_version=`echo ${host_os} | perl -ple 's/^\D+//g;s,\..*,,'` - if test "$host_os_version" -lt 10; then : - - if test -f /usr/bin/gcc-4.2; then : - - CPP="/usr/bin/gcc-4.2 -E" - CC=/usr/bin/gcc-4.2 - CXX=/usr/bin/g++-4.2 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : +else + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.$ac_ext + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break fi +rm -f conftest.err conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break fi + done + ac_cv_prog_CPP=$CPP - - - # Check whether --enable-64bit was given. -if test "${enable_64bit+set}" = set; then : - enableval=$enable_64bit; ac_enable_64bit="$enableval" +fi + CPP=$ac_cv_prog_CPP else - ac_enable_64bit="yes" + ac_cv_prog_CPP=$CPP fi - - - for ac_prog in isainfo +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ISAINFO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ISAINFO"; then - ac_cv_prog_ISAINFO="$ISAINFO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ISAINFO="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : -fi -fi -ISAINFO=$ac_cv_prog_ISAINFO -if test -n "$ISAINFO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ISAINFO" >&5 -$as_echo "$ISAINFO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.$ac_ext + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext - test -n "$ISAINFO" && break done -test -n "$ISAINFO" || ISAINFO="no" +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : - if test "x$ISAINFO" != "xno"; then : - isainfo_b=`${ISAINFO} -b` else - isainfo_b="x" + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi - if test "$isainfo_b" != "x"; then : - - - isainfo_k=`${ISAINFO} -k` - DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}" - - if test "x$ac_enable_64bit" = "xyes"; then : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x${ac_cv_env_LDFLAGS_set}" = "x"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac - LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}" + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" - if test "x$libdir" = "x\${exec_prefix}/lib"; then : - libdir="${libdir}/${isainfo_k}" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP fi - if test "x${ac_cv_env_CFLAGS_set}" = "x"; then : + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" - CFLAGS="${CFLAGS} -m64" - ac_cv_env_CFLAGS_set=set - ac_cv_env_CFLAGS_value='-m64' -fi - if test "x${ac_cv_env_CXXFLAGS_set}" = "x"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include - CXXFLAGS="${CXXFLAGS} -m64" - ac_cv_env_CXXFLAGS_set=set - ac_cv_env_CXXFLAGS_value='-m64' +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"; then : - - AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}" - AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}" +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -fi +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : +else + ac_cv_header_stdc=no fi +rm -f conftest* fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : - $as_echo_n "(cached) " >&6 +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi fi fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = x""yes; then : + MINIX=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + MINIX= fi - test -n "$CXX" && break - done + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + case "$host_os" in + hpux*) + +$as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + + + + # Check whether --enable-64bit was given. +if test "${enable_64bit+set}" = set; then : + enableval=$enable_64bit; ac_enable_64bit="$enableval" +else + ac_enable_64bit="yes" +fi + + + for ac_prog in isainfo do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if test "${ac_cv_prog_ISAINFO+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. + if test -n "$ISAINFO"; then + ac_cv_prog_ISAINFO="$ISAINFO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -4690,7 +5115,7 @@ test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" + ac_cv_prog_ISAINFO="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4700,44 +5125,194 @@ fi fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } +ISAINFO=$ac_cv_prog_ISAINFO +if test -n "$ISAINFO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ISAINFO" >&5 +$as_echo "$ISAINFO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$ac_ct_CXX" && break + test -n "$ISAINFO" && break done +test -n "$ISAINFO" || ISAINFO="no" - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi + if test "x$ISAINFO" != "xno"; then : + isainfo_b=`${ISAINFO} -b` +else + isainfo_b="x" fi - fi + if test "$isainfo_b" != "x" -a "$isainfo_b" != "32"; then : + + + isainfo_k=`${ISAINFO} -k` + DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}" + + if test "x$ac_enable_64bit" = "xyes"; then : + + + if test "x${ac_cv_env_LDFLAGS_set}" = "x"; then : + + LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}" + fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac + + if test "x$libdir" = "x\${exec_prefix}/lib"; then : + + libdir="${libdir}/${isainfo_k}" + +fi + + if test "x${ac_cv_env_CFLAGS_set}" = "x"; then : + + CFLAGS="${CFLAGS} -m64" + ac_cv_env_CFLAGS_set=set + ac_cv_env_CFLAGS_value='-m64' + +fi + if test "x${ac_cv_env_CXXFLAGS_set}" = "x"; then : + + CXXFLAGS="${CXXFLAGS} -m64" + ac_cv_env_CXXFLAGS_set=set + ac_cv_env_CXXFLAGS_value='-m64' + +fi + + if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"; then : + + AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}" + AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}" + +fi + +fi + +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err @@ -5001,167 +5576,270 @@ fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then : $as_echo_n "(cached) " >&6 else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - done - ac_cv_prog_CPP=$CPP +int +main () +{ -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error + ; + return 0; +} _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - # Broken: fails on valid input. -continue + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + fi -rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else - # Passes both tests. -ac_preproc_ok=: -break + enable_static=no fi -rm -f conftest.err conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : + + + + + + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.2.10' +macro_revision='1.3175' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`print -r -- -n 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test -z "$GREP"; then - ac_path_GREP_found=false + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in *GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" @@ -5170,14 +5848,14 @@ cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then + if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break @@ -5185,49 +5863,62 @@ rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - $ac_path_GREP_found && break 3 + $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else - ac_cv_path_GREP=$GREP + ac_cv_path_SED=$SED fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : - $as_echo_n "(cached) " >&6 + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" else - if test -z "$EGREP"; then - ac_path_EGREP_found=false + if test -z "$FGREP"; then + ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in *GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" @@ -5236,14 +5927,14 @@ cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then + if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break @@ -5251,383 +5942,147 @@ rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - $ac_path_EGREP_found && break 3 + $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else - ac_cv_path_EGREP=$EGREP + ac_cv_path_FGREP=$FGREP fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* +test -z "$GREP" && GREP=grep -fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h -fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi -done - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : - MINIX=yes +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else - MINIX= + with_gnu_ld=no fi - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - case "$host_os" in - hpux*) - -$as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h - +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } else - ac_cv_safe_to_define___extensions__=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - -if test "x$CC" != xcc; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 -$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 -$as_echo_n "checking whether cc understands -c and -o together... " >&6; } -fi -set dummy $CC; ac_cc=`$as_echo "$2" | - sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : +if test "${lt_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -# Make sure it works both with $CC and with simple cc. -# We do the test twice because some compilers refuse to overwrite an -# existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; -then - eval ac_cv_prog_cc_${ac_cc}_c_o=yes - if test "x$CC" != xcc; then - # Test first that cc exists at all. - if { ac_try='cc -c conftest.$ac_ext >&5' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' - rm -f conftest2.* - if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; - then - # cc works too. - : - else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "yes" >&6; } + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - -$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h - fi - -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then : + $as_echo_n "(cached) " >&6 else - enable_static=no -fi - - - - - - - - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld @@ -5636,291 +6091,10 @@ -ltmain="$ac_aux_dir/ltmain.sh" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test "${lt_cv_path_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -5973,8 +6147,11 @@ NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 @@ -6018,7 +6195,7 @@ fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -6073,6 +6250,15 @@ fi fi + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -6092,13 +6278,13 @@ else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:6095: $ac_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6098: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6101: output\"" >&5) + (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6155,6 +6341,11 @@ lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -6219,8 +6410,8 @@ # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -6491,16 +6682,18 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -6530,6 +6723,10 @@ lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -6538,11 +6735,11 @@ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -6564,7 +6761,7 @@ ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -6980,6 +7177,18 @@ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + @@ -7149,8 +7358,8 @@ test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then @@ -7303,7 +7512,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7306 "configure"' > conftest.$ac_ext + echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8015,10 +8224,42 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if test "${lt_cv_ld_force_load+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults @@ -8042,7 +8283,7 @@ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -8065,613 +8306,89 @@ -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +# Set options -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + enable_shared=yes fi - test -n "$ac_ct_CXX" && break -done - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" else - GXX= + pic_mode=default fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +test -z "$pic_mode" && pic_mode=default -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" ;; - none) break ;; esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -_lt_caught_CXX_error=yes; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - _lt_caught_CXX_error=yes -fi - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes + enable_fast_install=yes fi @@ -8714,6 +8431,7 @@ + test -z "$LN_S" && LN_S="ln -s" @@ -8763,19 +8481,6 @@ - - - - - - - - - - - - - case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some @@ -8788,23 +8493,6 @@ ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -8833,7 +8521,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it @@ -9042,7 +8730,12 @@ lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } @@ -9062,15 +8755,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9065: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9069: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes @@ -9148,6 +8841,12 @@ lt_prog_compiler_pic='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -9190,6 +8889,13 @@ lt_prog_compiler_pic='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + lt_prog_compiler_pic='-Xcompiler -fPIC' + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -9231,7 +8937,7 @@ lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -9252,7 +8958,7 @@ lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -9264,25 +8970,25 @@ # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_wl='' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker + *Sun\ C*) + # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' + lt_prog_compiler_wl='-Wl,' ;; esac ;; @@ -9314,7 +9020,7 @@ lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; @@ -9401,15 +9107,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9404: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9408: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes @@ -9457,7 +9163,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes @@ -9506,16 +9212,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9509: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9513: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -9561,16 +9267,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9564: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9568: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -9683,7 +9389,33 @@ esac ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -9701,6 +9433,7 @@ fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -9716,11 +9449,12 @@ ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -9756,6 +9490,7 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -9777,6 +9512,11 @@ fi ;; + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no @@ -9792,7 +9532,7 @@ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -9806,11 +9546,12 @@ tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -9821,13 +9562,17 @@ lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -9843,17 +9588,17 @@ fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -9974,8 +9719,10 @@ else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -10093,7 +9840,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' @@ -10137,8 +9884,13 @@ # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -10177,7 +9929,7 @@ # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. @@ -10193,7 +9945,11 @@ hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec='' + fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in @@ -10201,7 +9957,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -10267,7 +10023,7 @@ ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' @@ -10286,7 +10042,7 @@ ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -10307,7 +10063,46 @@ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if test "${lt_cv_prog_compiler__b+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + ;; esac fi @@ -10335,7 +10130,7 @@ irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. @@ -10346,15 +10141,15 @@ int foo(void) {} _ACEOF if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -10416,17 +10211,17 @@ hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -10436,13 +10231,13 @@ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -10645,44 +10440,50 @@ # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext +if test "${lt_cv_archive_cmds_need_lc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi @@ -10853,16 +10654,23 @@ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -10875,7 +10683,7 @@ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -10895,7 +10703,13 @@ if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -10983,7 +10797,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -11036,23 +10850,12 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' @@ -11152,8 +10955,21 @@ hardcode_into_libs=yes ;; -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no @@ -11194,8 +11010,10 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[3-9]*) @@ -11253,7 +11071,7 @@ ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -11262,12 +11080,17 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -11280,13 +11103,17 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - shlibpath_overrides_runpath=yes + lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -11298,8 +11125,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -11601,6 +11429,11 @@ + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= @@ -11931,7 +11764,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11934 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11972,7 +11805,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +void fnord () __attribute__((visibility("default"))); +#endif + +void fnord () { int i=42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -11981,7 +11820,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -12027,7 +11870,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12030 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12068,7 +11911,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +void fnord () __attribute__((visibility("default"))); +#endif + +void fnord () { int i=42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -12077,7 +11926,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -12234,6 +12087,145 @@ CC="$lt_save_CC" + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' @@ -12260,6 +12252,8 @@ module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no @@ -12342,7 +12336,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then @@ -12442,7 +12436,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : @@ -12504,7 +12498,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -12646,7 +12640,7 @@ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' @@ -12690,8 +12684,13 @@ # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. @@ -12724,6 +12723,7 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes @@ -12750,7 +12750,11 @@ hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec_CXX='' + fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in @@ -12758,7 +12762,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -12811,6 +12815,11 @@ gnu*) ;; + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -12835,7 +12844,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -12900,7 +12909,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -12943,7 +12952,7 @@ case $cc_basename in CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -12954,9 +12963,9 @@ *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes @@ -12967,7 +12976,7 @@ inherit_rpath_CXX=yes ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -12985,7 +12994,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' @@ -13022,26 +13031,26 @@ pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in - *pgCC\ [1-5]* | *pgcpp\ [1-5]*) + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; - *) # Version 6 will use weak symbols + *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; @@ -13049,7 +13058,7 @@ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ @@ -13068,9 +13077,9 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; - xl*) + xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' @@ -13090,13 +13099,13 @@ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -13165,7 +13174,7 @@ export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi @@ -13200,15 +13209,15 @@ case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; @@ -13224,17 +13233,17 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -13244,7 +13253,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -13280,7 +13289,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' @@ -13301,7 +13310,7 @@ esac link_all_deplibs_CXX=yes - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -13328,7 +13337,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. @@ -13339,7 +13348,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' @@ -13393,6 +13402,10 @@ CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -13574,7 +13587,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as @@ -13690,6 +13703,11 @@ # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. @@ -13795,7 +13813,7 @@ ;; esac ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -13828,8 +13846,8 @@ lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' @@ -13891,7 +13909,7 @@ ;; solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' @@ -13983,15 +14001,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13986: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13990: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes @@ -14036,7 +14054,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes @@ -14082,16 +14100,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14085: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14089: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes @@ -14134,16 +14152,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14137: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14141: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes @@ -14198,8 +14216,10 @@ aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -14246,44 +14266,50 @@ # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext +if test "${lt_cv_archive_cmds_need_lc_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5 -$as_echo "$archive_cmds_need_lc_CXX" >&6; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi @@ -14440,7 +14466,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -14493,23 +14519,11 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' @@ -14608,6 +14622,19 @@ hardcode_into_libs=yes ;; +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. @@ -14650,8 +14677,10 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[3-9]*) @@ -14709,7 +14738,7 @@ ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -14718,12 +14747,17 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -14736,13 +14770,17 @@ _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - shlibpath_overrides_runpath=yes + lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -14754,8 +14792,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -15006,6 +15045,8 @@ + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= @@ -15090,35 +15131,25 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if g++ supports C++0x features without additional flags" >&5 -$as_echo_n "checking if g++ supports C++0x features without additional flags... " >&6; } -if test "${ac_cv_cxx_compile_cxx0x_native+set}" = set; then : + + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 +$as_echo_n "checking for simple visibility declarations... " >&6; } + if test "${gl_cv_cc_visibility+set}" = set; then : $as_echo_n "(cached) " >&6 else - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = c; +extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); int main () { @@ -15127,144 +15158,51 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_cxx_compile_cxx0x_native=yes +if ac_fn_c_try_compile "$LINENO"; then : + + case "$host_os" in + *darwin*) + gl_cv_cc_visibility=no + ;; + *) + gl_cv_cc_visibility=yes + ;; + esac + else - ac_cv_cxx_compile_cxx0x_native=no + gl_cv_cc_visibility=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - + CFLAGS="$gl_save_CFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compile_cxx0x_native" >&5 -$as_echo "$ac_cv_cxx_compile_cxx0x_native" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if g++ supports C++0x features with -std=c++0x" >&5 -$as_echo_n "checking if g++ supports C++0x features with -std=c++0x... " >&6; } -if test "${ac_cv_cxx_compile_cxx0x_cxx+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -std=c++0x" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check> right_angle_brackets; - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = c; -int -main () -{ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 +$as_echo "$gl_cv_cc_visibility" >&6; } + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + CXXFLAG_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden" + NO_VISIBILITY="-fvisibility=default" + HAVE_VISIBILITY=1 + fi - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_cxx_compile_cxx0x_cxx=yes -else - ac_cv_cxx_compile_cxx0x_cxx=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS="$ac_save_CXXFLAGS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test "x$SUNCC" = "xyes"; then : + CFLAG_VISIBILITY="-xldscope=hidden" + CXXFLAG_VISIBILITY="-xldscope=hidden" + NO_VISIBILITY="-xldscope=global" + HAVE_VISIBILITY=1 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compile_cxx0x_cxx" >&5 -$as_echo "$ac_cv_cxx_compile_cxx0x_cxx" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if g++ supports C++0x features with -std=gnu++0x" >&5 -$as_echo_n "checking if g++ supports C++0x features with -std=gnu++0x... " >&6; } -if test "${ac_cv_cxx_compile_cxx0x_gxx+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -std=gnu++0x" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - typedef check> right_angle_brackets; - int a; - decltype(a) b; - typedef check check_type; - check_type c; - check_type&& cr = c; -int -main () -{ - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_VISIBILITY $HAVE_VISIBILITY _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_cxx_compile_cxx0x_gxx=yes -else - ac_cv_cxx_compile_cxx0x_gxx=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS="$ac_save_CXXFLAGS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compile_cxx0x_gxx" >&5 -$as_echo "$ac_cv_cxx_compile_cxx0x_gxx" >&6; } - - if test "$ac_cv_cxx_compile_cxx0x_native" = yes || - test "$ac_cv_cxx_compile_cxx0x_cxx" = yes || - test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then - -$as_echo "#define HAVE_STDCXX_0X /**/" >>confdefs.h - - fi @@ -15283,8 +15221,8 @@ if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run test program while cross compiling -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15359,138 +15297,21 @@ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - -$as_echo "#define malloc rpl_malloc" >>confdefs.h -fi -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF -fi -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 -$as_echo_n "checking for GNU libc compatible realloc... " >&6; } -if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_realloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif -int -main () -{ -return ! realloc (0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_realloc_0_nonnull=yes -else - ac_cv_func_realloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } -if test $ac_cv_func_realloc_0_nonnull = yes; then : -$as_echo "#define HAVE_REALLOC 1" >>confdefs.h -else - $as_echo "#define HAVE_REALLOC 0" >>confdefs.h - case " $LIBOBJS " in - *" realloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS realloc.$ac_objext" - ;; -esac -$as_echo "#define realloc rpl_realloc" >>confdefs.h -fi @@ -15502,19 +15323,27 @@ + ac_config_headers="$ac_config_headers config.h" + if test "x${prefix}" = "x"; then : + if test "x${pandora_cv_skip_requires}" != "xno"; then : + as_fn_error $? "--prefix requires an argument" "$LINENO" 5 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --prefix requires an argument" >&5 +$as_echo "$as_me: WARNING: --prefix requires an argument" >&2;} +fi - ac_config_headers="$ac_config_headers config.h" +fi # We need to prevent canonical target @@ -15536,7 +15365,7 @@ am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -15552,7 +15381,7 @@ # Define the identity of the package. PACKAGE='gearmand' - VERSION='0.14' + VERSION='0.23' cat >>confdefs.h <<_ACEOF @@ -15586,7 +15415,88 @@ AMTAR=${AMTAR-"${am_missing_run}tar"} -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 +$as_echo_n "checking how to create a ustar tar archive... " >&6; } +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar plaintar pax cpio none' +_am_tools=${am_cv_prog_tar_ustar-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x ustar -w "$$tardir"' + am__tar_='pax -L -x ustar -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H ustar -L' + am__tar_='find "$tardir" -print | cpio -o -H ustar -L' + am__untar='cpio -i -H ustar -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_ustar}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +if test "${am_cv_prog_tar_ustar+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + am_cv_prog_tar_ustar=$_am_tool +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 +$as_echo "$am_cv_prog_tar_ustar" >&6; } @@ -15615,6 +15525,15 @@ + + + + + + vc_changelog=no + + + pandora_building_from_vc=no if test -d ".bzr" ; then @@ -15646,6 +15565,19 @@ fi + PANDORA_RELEASE_ID=`echo $VERSION | sed 's/[^0-9]//g'` + + PANDORA_RELEASE_COMMENT="" + +cat >>confdefs.h <<_ACEOF +#define PANDORA_RELEASE_VERSION "$VERSION" +_ACEOF + + + + + + PANDORA_HEX_VERSION=`echo $VERSION | sed 's|\-a-z0-9*$||' | \ @@ -15681,7 +15613,6 @@ - cat >>confdefs.h <<_ACEOF #define HOST_VENDOR "$host_vendor" _ACEOF @@ -15715,7 +15646,7 @@ case "$host_os" in - *solaris*|*freebsd*) + *solaris*) if test "x${ac_cv_env_CPPFLAGS_set}" = "x"; then : CPPFLAGS="${CPPFLAGS} -I/usr/local/include" @@ -15728,13 +15659,26 @@ fi ;; - esac + *freebsd*) + if test "x${ac_cv_env_CPPFLAGS_set}" = "x"; then : - PANDORA_OPTIMIZE_BITFIELD=1 + CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include" - case "$target_os" in - *linux*) - TARGET_LINUX="true" +fi + + if test "x${ac_cv_env_LDFLAGS_set}" = "x"; then : + + LDFLAGS="${LDFLAGS} -L/usr/local/lib" + +fi + ;; + esac + + PANDORA_OPTIMIZE_BITFIELD=1 + + case "$target_os" in + *linux*) + TARGET_LINUX="true" $as_echo "#define TARGET_OS_LINUX 1" >>confdefs.h @@ -15750,6 +15694,9 @@ *solaris*) TARGET_SOLARIS="true" PANDORA_OPTIMIZE_BITFIELD=0 + if test "x${USE_NLS}" = "xyes"; then : + LIBS="${LIBS} -lintl" +fi $as_echo "#define TARGET_OS_SOLARIS 1" >>confdefs.h @@ -15765,9 +15712,43 @@ $as_echo "#define __APPLE_CC__ 1" >>confdefs.h ;; - *) + *mingw32*) + TARGET_WINDOWS="true" + + +$as_echo "#define TARGET_OS_WINDOWS 1" >>confdefs.h + + +$as_echo "#define WINVER WindowsXP" >>confdefs.h + + +$as_echo "#define _WIN32_WINNT 0x0501" >>confdefs.h + + +$as_echo "#define EAI_SYSTEM 11" >>confdefs.h + + + + LIBS="$LIBS -lwsock32 -lws2_32" + AM_CFLAGS="${AM_CFLAGS} -I\${top_srcdir}/win32/mingw -I\${top_builddir}/win32/mingw -I\${top_srcdir}/win32 -I\${top_builddir}/win32" ;; esac + if test "x${TARGET_WINDOWS}" = "xtrue"; then + BUILD_WIN32_TRUE= + BUILD_WIN32_FALSE='#' +else + BUILD_WIN32_TRUE='#' + BUILD_WIN32_FALSE= +fi + + if test "x${TARGET_OSX}" = "xtrue"; then + TARGET_OSX_TRUE= + TARGET_OSX_FALSE='#' +else + TARGET_OSX_TRUE='#' + TARGET_OSX_FALSE= +fi + @@ -15820,11 +15801,20 @@ if test "$SUNCC" = "yes" -a "${pandora_have_old_libtool}" = "yes"; then : - as_fn_error "Building ${PACKAGE} with Sun Studio requires at least libtool 2.2" "$LINENO" 5 + + if test "x${pandora_cv_skip_requires}" != "xno"; then : + + as_fn_error $? "Building ${PACKAGE} with Sun Studio requires at least libtool 2.2" "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Building ${PACKAGE} with Sun Studio requires at least libtool 2.2" >&5 +$as_echo "$as_me: WARNING: Building ${PACKAGE} with Sun Studio requires at least libtool 2.2" >&2;} fi +fi @@ -15832,7 +15822,8 @@ - if test "$GCC" = "yes"; then : + + if test "$GCC" = "yes"; then : if test "$ac_cv_cxx_compile_cxx0x_native" = "yes"; then : else @@ -15855,6 +15846,7 @@ if test "${ac_cv_cxx_stdcxx_98+set}" = set; then : $as_echo_n "(cached) " >&6 else + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -15951,9 +15943,136 @@ if test "$ac_cv_cxx_stdcxx_98" = "no"; then : - as_fn_error "No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98" "$LINENO" 5 + if test "x${pandora_cv_skip_requires}" != "xno"; then : + + as_fn_error $? "No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98" "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98" >&5 +$as_echo "$as_me: WARNING: No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98" >&2;} + +fi + + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking the location of cstdint" >&5 +$as_echo_n "checking the location of cstdint... " >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" + ac_cv_cxx_cstdint="" + for location in tr1/cstdint boost/cstdint cstdint; do + if test -z "$ac_cv_cxx_cstdint"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$location> +int +main () +{ +uint32_t t + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_cxx_cstdint="<$location>"; +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + CXXFLAGS="${save_CXXFLAGS}" + if test -n "$ac_cv_cxx_cstdint"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_cstdint" >&5 +$as_echo "$ac_cv_cxx_cstdint" >&6; } + else + +$as_echo "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h + + +$as_echo "#define __STDC_FORMAT_MACROS 1" >>confdefs.h + + ac_cv_cxx_cstdint="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find a cstdint header." >&5 +$as_echo "$as_me: WARNING: Could not find a cstdint header." >&2;} + fi + +cat >>confdefs.h <<_ACEOF +#define CSTDINT_H $ac_cv_cxx_cstdint +_ACEOF + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking the location of cinttypes" >&5 +$as_echo_n "checking the location of cinttypes... " >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" + ac_cv_cxx_cinttypes="" + for location in tr1/cinttypes boost/cinttypes cinttypes; do + if test -z "$ac_cv_cxx_cinttypes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include $ac_cv_cxx_cstdint; + #include <$location> +int +main () +{ +uint32_t foo= UINT32_C(1) + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_cxx_cinttypes="<$location>"; fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + CXXFLAGS="${save_CXXFLAGS}" + if test -n "$ac_cv_cxx_cinttypes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_cinttypes" >&5 +$as_echo "$ac_cv_cxx_cinttypes" >&6; } + else + ac_cv_cxx_cinttypes="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find a cinttypes header." >&5 +$as_echo "$as_me: WARNING: Could not find a cinttypes header." >&2;} + fi + +$as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define CINTTYPES_H $ac_cv_cxx_cinttypes +_ACEOF @@ -16227,7 +16346,7 @@ ;; #( *) - as_fn_error "unknown endianness + as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -16779,6 +16898,19 @@ fi + for ac_header in sys/socket.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_SOCKET_H 1 +_ACEOF + +fi + +done + + # off_t is not a builtin type # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects @@ -16795,9 +16927,8 @@ if test "$ac_cv_type_off_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (off_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (off_t) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_off_t=0 fi @@ -16816,7 +16947,18 @@ if test "$ac_cv_sizeof_off_t" -eq 0; then : - as_fn_error "\"${PACKAGE} needs an off_t type.\"" "$LINENO" 5 + + if test "x${pandora_cv_skip_requires}" != "xno"; then : + + as_fn_error $? "\"${PACKAGE} needs an off_t type.\"" "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"${PACKAGE} needs an off_t type.\"" >&5 +$as_echo "$as_me: WARNING: \"${PACKAGE} needs an off_t type.\"" >&2;} + +fi + fi @@ -16835,9 +16977,8 @@ if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (size_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_size_t=0 fi @@ -16856,7 +16997,18 @@ if test "$ac_cv_sizeof_size_t" -eq 0; then : - as_fn_error "\"${PACKAGE} needs an size_t type.\"" "$LINENO" 5 + + if test "x${pandora_cv_skip_requires}" != "xno"; then : + + as_fn_error $? "\"${PACKAGE} needs an size_t type.\"" "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"${PACKAGE} needs an size_t type.\"" >&5 +$as_echo "$as_me: WARNING: \"${PACKAGE} needs an size_t type.\"" >&2;} + +fi + fi @@ -16880,9 +17032,8 @@ if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi @@ -16948,9 +17099,54 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if system defines RUSAGE_THREAD" >&5 +$as_echo_n "checking if system defines RUSAGE_THREAD... " >&6; } +if test "${ac_cv_rusage_thread+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + + int x= RUSAGE_THREAD; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_rusage_thread=yes + +else + + ac_cv_rusage_thread=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_rusage_thread" >&5 +$as_echo "$ac_cv_rusage_thread" >&6; } + if test "$ac_cv_rusage_thread" = "no"; then : + + +$as_echo "#define RUSAGE_THREAD RUSAGE_SELF" >>confdefs.h + + +fi + LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -17081,6 +17277,7 @@ + ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" if test "x$ac_cv_func_setsockopt" = x""yes; then : @@ -17199,25 +17396,23 @@ CC="${CC} -std=gnu99" - AM_CPPFLAGS="-ggdb3 ${AM_CPPFLAGS}" + AM_CPPFLAGS="-g ${AM_CPPFLAGS}" DEBUG_CFLAGS="-O0" DEBUG_CXXFLAGS="-O0" - OPTIMIZE_CFLAGS="-O3" - OPTIMIZE_CXXFLAGS="-O3" + OPTIMIZE_CFLAGS="-O2" + OPTIMIZE_CXXFLAGS="-O2" fi if test "$INTELCC" = "yes"; then : - CC="${CC} -std=c99" - AM_CPPFLAGS="-g ${AM_CPPFLAGS}" DEBUG_CFLAGS="-O0" DEBUG_CXXFLAGS="-O0" - OPTIMIZE_CFLAGS="-xHOST -O3 -no-prec-div -static" + OPTIMIZE_CFLAGS="-xHOST -O2 -no-prec-div -static" OPTIMIZE_CXXFLAGS="${OPTIMIZE_CFLAGS}" @@ -17345,69 +17540,11 @@ - save_CFLAGS="${CFLAGS}" - CFLAGS="${CFLAGS} -Werror" - - - - CFLAG_VISIBILITY= - HAVE_VISIBILITY=0 - if test -n "$GCC"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 -$as_echo_n "checking for simple visibility declarations... " >&6; } - if test "${gl_cv_cc_visibility+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -extern __attribute__((__visibility__("hidden"))) int hiddenvar; - extern __attribute__((__visibility__("default"))) int exportedvar; - extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void); -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_cc_visibility=yes -else - gl_cv_cc_visibility=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$gl_save_CFLAGS" -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 -$as_echo "$gl_cv_cc_visibility" >&6; } - if test $gl_cv_cc_visibility = yes; then - CFLAG_VISIBILITY="-fvisibility=hidden" - HAVE_VISIBILITY=1 - fi - -fi - if test "x$SUNCC" = "xyes"; then : - - CFLAG_VISIBILITY="-xldscope=hidden" - HAVE_VISIBILITY=1 - -fi - - -cat >>confdefs.h <<_ACEOF -#define HAVE_VISIBILITY $HAVE_VISIBILITY -_ACEOF + AM_CFLAGS="${AM_CFLAGS} ${CFLAG_VISIBILITY}" + AM_CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAG_VISIBILITY}" - CFLAGS="${save_CFLAGS}" @@ -17452,12 +17589,22 @@ + + if test "$pandora_building_from_vc" = "yes"; then : ac_cv_warnings_as_errors=yes else ac_cv_warnings_as_errors=no fi + # Check whether --enable-gcc-profile-mode was given. +if test "${enable_gcc_profile_mode+set}" = set; then : + enableval=$enable_gcc_profile_mode; ac_gcc_profile_mode="$enableval" +else + ac_gcc_profile_mode="no" +fi + + # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; then : enableval=$enable_profiling; ac_profiling="$enableval" @@ -17548,7 +17695,11 @@ if test "$ac_cv_warnings_as_errors" = "yes"; then : - W_FAIL="-Werror" + + W_FAIL="-Werror" + SPHINX_WARNINGS="-W" + INTLTOOL_WARNINGS="yes" + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -fdiagnostics-show-option" >&5 @@ -17586,81 +17737,38 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wconversion" >&5 -$as_echo_n "checking whether it is safe to use -Wconversion... " >&6; } -if test "${ac_cv_safe_to_use_wconversion_+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -floop-parallelize-all" >&5 +$as_echo_n "checking whether it is safe to use -floop-parallelize-all... " >&6; } +if test "${ac_cv_safe_to_use_floop_parallelize_all_+set}" = set; then : $as_echo_n "(cached) " >&6 else save_CFLAGS="$CFLAGS" - CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + CFLAGS="-floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -void foo(bool a) -{ - (void)a; -} - int main () { -foo(0); - ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_use_wconversion_=yes + ac_cv_safe_to_use_floop_parallelize_all_=yes else - ac_cv_safe_to_use_wconversion_=no + ac_cv_safe_to_use_floop_parallelize_all_=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_wconversion_" >&5 -$as_echo "$ac_cv_safe_to_use_wconversion_" >&6; } - - if test "$ac_cv_safe_to_use_wconversion_" = "yes"; then : - W_CONVERSION="-Wconversion" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wconversion with htons" >&5 -$as_echo_n "checking whether it is safe to use -Wconversion with htons... " >&6; } -if test "${ac_cv_safe_to_use_Wconversion_+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - save_CFLAGS="$CFLAGS" - CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include - -int -main () -{ - -uint16_t x= htons(80); +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_floop_parallelize_all_" >&5 +$as_echo "$ac_cv_safe_to_use_floop_parallelize_all_" >&6; } - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_use_Wconversion_=yes -else - ac_cv_safe_to_use_Wconversion_=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_Wconversion_" >&5 -$as_echo "$ac_cv_safe_to_use_Wconversion_" >&6; } + if test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"; then : - if test "$ac_cv_safe_to_use_Wconversion_" = "no"; then : - NO_CONVERSION="-Wno-conversion" -fi + F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all" fi @@ -17670,18 +17778,21 @@ if test "$INTELCC" = "yes"; then : - BASE_WARNINGS="-w1 -Werror -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual" + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188" CC_WARNINGS="${BASE_WARNINGS}" CXX_WARNINGS="${BASE_WARNINGS}" + PROTOSKIP_WARNINGS="-diag-disable 188,981,967,2259,1683,1684,2203" + else - BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing" + BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing -Wswitch-enum " CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings" - CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast" + CXX_WARNINGS_FULL="-Wold-style-cast" NO_OLD_STYLE_CAST="-Wno-old-style-cast" + NO_EFF_CXX="-Wno-effc++" if test "${ac_cv_assert}" = "no"; then : @@ -17721,13 +17832,145 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_Wextra_" >&5 $as_echo "$ac_cv_safe_to_use_Wextra_" >&6; } - BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" + BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} ${BASE_WARNINGS_FULL}" if test "$ac_cv_safe_to_use_Wextra_" = "yes"; then : BASE_WARNINGS="${BASE_WARNINGS} -Wextra" else BASE_WARNINGS="${BASE_WARNINGS} -W" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wformat" >&5 +$as_echo_n "checking whether it is safe to use -Wformat... " >&6; } +if test "${ac_cv_safe_to_use_wformat_+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +void foo(); +void foo() +{ + uint64_t test_u= 0; + printf("This is a %" PRIu64 "test\n", test_u); +} + +int +main () +{ + +foo(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_use_wformat_=yes +else + ac_cv_safe_to_use_wformat_=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_wformat_" >&5 +$as_echo "$ac_cv_safe_to_use_wformat_" >&6; } + if test "$ac_cv_safe_to_use_wformat_" = "yes"; then : + + BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wno-format-security" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wno-format-security" + +else + + BASE_WARNINGS="${BASE_WARNINGS} -Wno-format" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format" + +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wconversion" >&5 +$as_echo_n "checking whether it is safe to use -Wconversion... " >&6; } +if test "${ac_cv_safe_to_use_wconversion_+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +void foo(bool a) +{ + (void)a; +} + +int +main () +{ + +foo(0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_use_wconversion_=yes +else + ac_cv_safe_to_use_wconversion_=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_wconversion_" >&5 +$as_echo "$ac_cv_safe_to_use_wconversion_" >&6; } + + if test "$ac_cv_safe_to_use_wconversion_" = "yes"; then : + W_CONVERSION="-Wconversion" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wconversion with htons" >&5 +$as_echo_n "checking whether it is safe to use -Wconversion with htons... " >&6; } +if test "${ac_cv_safe_to_use_Wconversion_+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ + +uint16_t x= htons(80); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_use_Wconversion_=yes +else + ac_cv_safe_to_use_Wconversion_=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_Wconversion_" >&5 +$as_echo "$ac_cv_safe_to_use_Wconversion_" >&6; } + + if test "$ac_cv_safe_to_use_Wconversion_" = "no"; then : + NO_CONVERSION="-Wno-conversion" +fi + +fi + CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}" CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}" @@ -17780,6 +18023,55 @@ CXX_WARNINGS="${CXX_WARNINGS} -Wmissing-declarations" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wframe-larger-than" >&5 +$as_echo_n "checking whether it is safe to use -Wframe-larger-than... " >&6; } +if test "${ac_cv_safe_to_use_Wframe_larger_than_+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-Werror -pedantic -Wframe-larger-than=32768 ${AM_CXXFLAGS}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_safe_to_use_Wframe_larger_than_=yes +else + ac_cv_safe_to_use_Wframe_larger_than_=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS="$save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_Wframe_larger_than_" >&5 +$as_echo "$ac_cv_safe_to_use_Wframe_larger_than_" >&6; } + if test "$ac_cv_safe_to_use_Wframe_larger_than_" = "yes"; then : + CXX_WARNINGS="${CXX_WARNINGS} -Wframe-larger-than=32768" +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to use -Wlogical-op" >&5 $as_echo_n "checking whether it is safe to use -Wlogical-op... " >&6; } if test "${ac_cv_safe_to_use_Wlogical_op_+set}" = set; then : @@ -17976,8 +18268,13 @@ NO_REDUNDANT_DECLS="-Wno-redundant-decls" PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}" NO_WERROR="-Wno-error" - INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align" + PERMISSIVE_WARNINGS="-Wno-error -Wno-unused-function -fpermissive" + PERMISSIVE_C_WARNINGS="-Wno-error -Wno-redundant-decls" + if test "$host_vendor" = "apple"; then : + BOOSTSKIP_WARNINGS="-Wno-uninitialized" + +fi fi @@ -18033,13 +18330,16 @@ - CC_WARNINGS_FULL="-erroff=E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" + CC_WARNINGS_FULL="-erroff=E_STATEMENT_NOT_REACHED,E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" CXX_WARNINGS_FULL="-erroff=inllargeuse" - CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL} ${CFLAG_VISIBILITY}" - CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL} ${CFLAG_VISIBILITY}" + CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}" + CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}" PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit" + BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem" + PERMISSIVE_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem,notused,badargtype2w,wunreachable" + INNOBASE_SKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit,wunreachable" NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED" NO_WERROR="-errwarn=%none" @@ -18060,11 +18360,17 @@ + + + + + + # Check whether --enable-dtrace was given. if test "${enable_dtrace+set}" = set; then : - enableval=$enable_dtrace; ac_cv_enable_dtrace="yes" + enableval=$enable_dtrace; ac_cv_enable_dtrace="$enableval" else - ac_cv_enable_dtrace="no" + ac_cv_enable_dtrace="yes" fi @@ -18112,33 +18418,79 @@ test -n "$DTRACE" && break done - if test "x$ac_cv_prog_DTRACE" = "xdtrace"; then : + for ac_header in sys/sdt.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/sdt.h" "ac_cv_header_sys_sdt_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sdt_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_SDT_H 1 +_ACEOF + +fi + +done + + + if test "x$ac_cv_prog_DTRACE" = "xdtrace" -a "x${ac_cv_header_sys_sdt_h}" = "xyes"; then : + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if dtrace works" >&5 +$as_echo_n "checking if dtrace works... " >&6; } +if test "${ac_cv_dtrace_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat >conftest.d <<_ACEOF +provider Example { + probe increment(int); +}; +_ACEOF + $DTRACE -h -o conftest.h -s conftest.d 2>/dev/zero + if test $? -eq 0; then : + ac_cv_dtrace_works=yes +else + ac_cv_dtrace_works=no +fi + rm -f conftest.h conftest.d + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_dtrace_works" >&5 +$as_echo "$ac_cv_dtrace_works" >&6; } + if test "x$ac_cv_dtrace_works" = "xyes"; then : $as_echo "#define HAVE_DTRACE 1" >>confdefs.h + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if dtrace should instrument object files" >&5 $as_echo_n "checking if dtrace should instrument object files... " >&6; } - cat >conftest.d <<_ACEOF +if test "${ac_cv_dtrace_needs_objects+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat >conftest.d <<_ACEOF provider Example { probe increment(int); }; _ACEOF - $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero - if test $? -eq 0; then : + $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero + if test $? -eq 0; then : ac_cv_dtrace_needs_objects=yes else ac_cv_dtrace_needs_objects=no fi - rm -f conftest.d.o conftest.d - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_dtrace_needs_objects" >&5 + rm -f conftest.d.o conftest.d + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_dtrace_needs_objects" >&5 $as_echo "$ac_cv_dtrace_needs_objects" >&6; } ac_cv_have_dtrace=yes fi fi - if test "x$ac_cv_have_dtrace" = "xyes"; then + if test "x$ac_cv_dtrace_works" = "xyes"; then HAVE_DTRACE_TRUE= HAVE_DTRACE_FALSE='#' else @@ -18274,8 +18626,6 @@ - - # Check whether --enable-umem was given. if test "${enable_umem+set}" = set; then : enableval=$enable_umem; ac_enable_umem="$enableval" @@ -18522,6 +18872,30 @@ + + +# Check whether --with-valgrind was given. +if test "${with_valgrind+set}" = set; then : + withval=$with_valgrind; with_valgrind=yes +else + with_valgrind=no +fi + + if test "x${with_valgrind}" = "xyes"; then + HAVE_VALGRIND_TRUE= + HAVE_VALGRIND_FALSE='#' +else + HAVE_VALGRIND_TRUE='#' + HAVE_VALGRIND_FALSE= +fi + + if test "x$with_valgrind" = "xyes"; then : + +$as_echo "#define HAVE_VALGRIND 1" >>confdefs.h + +fi + + for ac_prog in doxygen do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -18649,23 +19023,182 @@ done test -n "$DPKG_GENSYMBOLS" || DPKG_GENSYMBOLS=":" - - if test "x${DPKG_GENSYMBOLS}" != "x:"; then - HAVE_DPKG_GENSYMBOLS_TRUE= - HAVE_DPKG_GENSYMBOLS_FALSE='#' + for ac_prog in lcov +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LCOV+set}" = set; then : + $as_echo_n "(cached) " >&6 else - HAVE_DPKG_GENSYMBOLS_TRUE='#' - HAVE_DPKG_GENSYMBOLS_FALSE= -fi - - - - - - - - - + if test -n "$LCOV"; then + ac_cv_prog_LCOV="$LCOV" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LCOV="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LCOV=$ac_cv_prog_LCOV +if test -n "$LCOV"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5 +$as_echo "$LCOV" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LCOV" && break +done +test -n "$LCOV" || LCOV="echo lcov not found" + + for ac_prog in genhtml +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LCOV_GENHTML+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LCOV_GENHTML"; then + ac_cv_prog_LCOV_GENHTML="$LCOV_GENHTML" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LCOV_GENHTML="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LCOV_GENHTML=$ac_cv_prog_LCOV_GENHTML +if test -n "$LCOV_GENHTML"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV_GENHTML" >&5 +$as_echo "$LCOV_GENHTML" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LCOV_GENHTML" && break +done +test -n "$LCOV_GENHTML" || LCOV_GENHTML="echo genhtml not found" + + + for ac_prog in sphinx-build +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_SPHINXBUILD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$SPHINXBUILD"; then + ac_cv_prog_SPHINXBUILD="$SPHINXBUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_SPHINXBUILD="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +SPHINXBUILD=$ac_cv_prog_SPHINXBUILD +if test -n "$SPHINXBUILD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SPHINXBUILD" >&5 +$as_echo "$SPHINXBUILD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$SPHINXBUILD" && break +done +test -n "$SPHINXBUILD" || SPHINXBUILD=":" + + if test "x${SPHINXBUILD}" != "x:"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sphinx is new enough" >&5 +$as_echo_n "checking if sphinx is new enough... " >&6; } +if test "${ac_cv_recent_sphinx+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + + ${SPHINXBUILD} -Q -C -b man -d conftest.d . . >/dev/null 2>&1 + if test $? -eq 0; then : + ac_cv_recent_sphinx=yes +else + ac_cv_recent_sphinx=no +fi + rm -rf conftest.d + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_recent_sphinx" >&5 +$as_echo "$ac_cv_recent_sphinx" >&6; } + +fi + + if test "x${DPKG_GENSYMBOLS}" != "x:"; then + HAVE_DPKG_GENSYMBOLS_TRUE= + HAVE_DPKG_GENSYMBOLS_FALSE='#' +else + HAVE_DPKG_GENSYMBOLS_TRUE='#' + HAVE_DPKG_GENSYMBOLS_FALSE= +fi + + if test "x${SPHINXBUILD}" != "x:"; then + HAVE_SPHINX_TRUE= + HAVE_SPHINX_FALSE='#' +else + HAVE_SPHINX_TRUE='#' + HAVE_SPHINX_FALSE= +fi + + if test "x${ac_cv_recent_sphinx}" = "xyes"; then + HAVE_RECENT_SPHINX_TRUE= + HAVE_RECENT_SPHINX_FALSE='#' +else + HAVE_RECENT_SPHINX_TRUE='#' + HAVE_RECENT_SPHINX_FALSE= +fi if test "x${gl_LIBOBJS}" != "x"; then : @@ -18728,6 +19261,23 @@ + mkdir -p config + cat > config/top.h.stamp </dev/null 2>&1 || mv config/top.h.stamp config/top.h + rm -f config/top.h.stamp + + + AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" @@ -18738,7 +19288,7 @@ -GEARMAN_LIBRARY_VERSION=4:0:0 +GEARMAN_LIBRARY_VERSION=6:0:0 # | | | # +------+ | +---+ # | | | @@ -18752,145 +19302,569 @@ # +- increment if interfaces have been added, removed or changed +echo "$as_me: this is boost.m4 serial 16" >&5 +boost_save_IFS=$IFS +boost_version_req=1.39.0 +IFS=. +set x $boost_version_req 0 0 0 +IFS=$boost_save_IFS +shift +boost_version_req=`expr "$1" '*' 100000 + "$2" '*' 100 + "$3"` +boost_version_req_string=$1.$2.$3 +# Check whether --with-boost was given. +if test "${with_boost+set}" = set; then : + withval=$with_boost; +fi +# If BOOST_ROOT is set and the user has not provided a value to +# --with-boost, then treat BOOST_ROOT as if it the user supplied it. +if test x"$BOOST_ROOT" != x; then + if test x"$with_boost" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT" >&5 +$as_echo "$as_me: Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT" >&6;} + with_boost=$BOOST_ROOT + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost" >&5 +$as_echo "$as_me: Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost" >&6;} + fi +fi +DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'" +boost_save_CPPFLAGS=$CPPFLAGS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boost headers version >= $boost_version_req_string" >&5 +$as_echo_n "checking for Boost headers version >= $boost_version_req_string... " >&6; } +if test "${boost_cv_inc_path+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + boost_cv_inc_path=no +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#if !defined BOOST_VERSION +# error BOOST_VERSION is not defined +#elif BOOST_VERSION < $boost_version_req +# error Boost headers version < $boost_version_req +#endif +int +main () +{ + ; + return 0; +} +_ACEOF + # If the user provided a value to --with-boost, use it and only it. + case $with_boost in #( + ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \ + /usr/include C:/Boost/include;; #( + *) set x "$with_boost/include" "$with_boost";; + esac + shift + for boost_dir + do + # Without --layout=system, Boost (or at least some versions) installs + # itself in /include/boost-. This inner loop helps to + # find headers in such directories. + # + # Any ${boost_dir}/boost-x_xx directories are searched in reverse version + # order followed by ${boost_dir}. The final '.' is a sentinel for + # searching $boost_dir" itself. Entries are whitespace separated. + # + # I didn't indent this loop on purpose (to avoid over-indented code) + boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ + && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ + && echo .` + for boost_inc in $boost_layout_system_search_list + do + if test x"$boost_inc" != x.; then + boost_inc="$boost_dir/$boost_inc" + else + boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list + fi + if test x"$boost_inc" != x; then + # We are going to check whether the version of Boost installed + # in $boost_inc is usable by running a compilation that + # #includes it. But if we pass a -I/some/path in which Boost + # is not installed, the compiler will just skip this -I and + # use other locations (either from CPPFLAGS, or from its list + # of system include directories). As a result we would use + # header installed on the machine instead of the /some/path + # specified by the user. So in that precise case (trying + # $boost_inc), make sure the version.hpp exists. + # + # Use test -e as there can be symlinks. + test -e "$boost_inc/boost/version.hpp" || continue + CPPFLAGS="$CPPFLAGS -I$boost_inc" + fi + if ac_fn_cxx_try_compile "$LINENO"; then : + boost_cv_inc_path=yes +else + boost_cv_version=no +fi +rm -f core conftest.err conftest.$ac_objext + if test x"$boost_cv_inc_path" = xyes; then + if test x"$boost_inc" != x; then + boost_cv_inc_path=$boost_inc + fi + break 2 + fi + done + done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -acx_pthread_ok=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boost_cv_inc_path" >&5 +$as_echo "$boost_cv_inc_path" >&6; } + case $boost_cv_inc_path in #( + no) + boost_errmsg="cannot find Boost headers version >= $boost_version_req_string" + as_fn_error $? "$boost_errmsg" "$LINENO" 5 + + ;;#( + yes) + BOOST_CPPFLAGS= + ;;#( + *) + BOOST_CPPFLAGS="-I$boost_cv_inc_path" + ;; + esac + if test x"$boost_cv_inc_path" != xno; then -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). -# It gets checked for in the link test anyway. +$as_echo "#define HAVE_BOOST 1" >>confdefs.h -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 -$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boost's header version" >&5 +$as_echo_n "checking for Boost's header version... " >&6; } +if test "${boost_cv_lib_version+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +boost-lib-version = BOOST_LIB_VERSION +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + tr -d '\r' | + $SED -n -e "/^boost-lib-version = /{s///;s/\"//g;p;q;}" >conftest.i 2>&1; then : + boost_cv_lib_version=`cat conftest.i` +fi +rm -rf conftest* -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boost_cv_lib_version" >&5 +$as_echo "$boost_cv_lib_version" >&6; } + # e.g. "134" for 1_34_1 or "135" for 1_35 + boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` + case $boost_major_version in #( + '' | *[!0-9]*) + as_fn_error $? "invalid value: boost_major_version=$boost_major_version" "$LINENO" 5 + ;; + esac +fi +CPPFLAGS=$boost_save_CPPFLAGS + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the toolset name used by Boost for $CXX" >&5 +$as_echo_n "checking for the toolset name used by Boost for $CXX... " >&6; } +if test "${boost_cv_lib_tag+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + boost_cv_lib_tag=unknown +if test x$boost_cv_inc_path != xno; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + # The following tests are mostly inspired by boost/config/auto_link.hpp + # The list is sorted to most recent/common to oldest compiler (in order + # to increase the likelihood of finding the right compiler with the + # least number of compilation attempt). + # Beware that some tests are sensible to the order (for instance, we must + # look for MinGW before looking for GCC3). + # I used one compilation test per compiler with a #error to recognize + # each compiler so that it works even when cross-compiling (let me know + # if you know a better approach). + # Known missing tags (known from Boost's tools/build/v2/tools/common.jam): + # como, edg, kcc, bck, mp, sw, tru, xlc + # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines + # the same defines as GCC's). + for i in \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 6 && !defined __ICC @ gcc46" \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 5 && !defined __ICC @ gcc45" \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 4 && !defined __ICC @ gcc44" \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 3 && !defined __ICC @ gcc43" \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && !defined __ICC @ gcc42" \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 1 && !defined __ICC @ gcc41" \ + "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && !defined __ICC @ gcc40" \ + "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \ + && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ + || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \ + "defined __GNUC__ && __GNUC__ == 3 && __GNUC_MINOR__ == 4 && !defined __ICC @ gcc34" \ + "defined __GNUC__ && __GNUC__ == 3 && __GNUC_MINOR__ == 3 && !defined __ICC @ gcc33" \ + "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ + "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ + "defined __GNUC__ && __GNUC__ == 3 && __GNUC_MINOR__ == 2 && !defined __ICC @ gcc32" \ + "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ + "defined __GNUC__ && __GNUC__ == 3 && __GNUC_MINOR__ == 1 && !defined __ICC @ gcc31" \ + "defined __GNUC__ && __GNUC__ == 3 && __GNUC_MINOR__ == 0 && !defined __ICC @ gcc30" \ + "defined __BORLANDC__ @ bcb" \ + "defined __ICC && (defined __unix || defined ) @ il" \ + "defined __ICL @ iw" \ + "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ + "defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ == 95 && !defined __ICC @ gcc295" \ + "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ + "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \ + "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \ + "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8" + do + boost_tag_test=`expr "X$i" : 'X\([^@]*\) @ '` + boost_tag=`expr "X$i" : 'X[^@]* @ \(.*\)'` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if $boost_tag_test +/* OK */ +#else +# error $boost_tag_test #endif -char pthread_join (); + int main () { -return pthread_join (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - acx_pthread_ok=yes +if ac_fn_cxx_try_compile "$LINENO"; then : + boost_cv_lib_tag=$boost_tag; break fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 -$as_echo "$acx_pthread_ok" >&6; } - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + case $boost_cv_lib_tag in #( + # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed + # to "gcc41" for instance. + *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there. + gcc*) + boost_tag_x= + case $host_os in #( + darwin*) + if test $boost_major_version -ge 136; then + # The `x' added in r46793 of Boost. + boost_tag_x=x + fi;; + esac + # We can specify multiple tags in this variable because it's used by + # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... + boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" + ;; #( + unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not figure out which toolset name to use for $CXX" >&5 +$as_echo "$as_me: WARNING: could not figure out which toolset name to use for $CXX" >&2;} + boost_cv_lib_tag= + ;; + esac +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boost_cv_lib_tag" >&5 +$as_echo "$boost_cv_lib_tag" >&6; } +# Check whether --enable-static-boost was given. +if test "${enable_static_boost+set}" = set; then : + enableval=$enable_static_boost; enable_static_boost=yes +else + enable_static_boost=no fi -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). +# Check whether we do better use `mt' even though we weren't ask to. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. +#if defined _REENTRANT || defined _MT || defined __MT__ +/* use -mt */ +#else +# error MT not needed +#endif -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +int +main () +{ -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + boost_guess_use_mt=: +else + boost_guess_use_mt=false +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) -case "${host_cpu}-${host_os}" in - *solaris*) +if test x"$boost_cv_inc_path" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Boost not available, not searching for the Boost program_options library" >&5 +$as_echo "$as_me: Boost not available, not searching for the Boost program_options library" >&6;} +else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test x"$boost_cv_inc_path" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Boost not available, not searching for boost/program_options.hpp" >&5 +$as_echo "$as_me: Boost not available, not searching for boost/program_options.hpp" >&6;} +else +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +ac_fn_cxx_check_header_mongrel "$LINENO" "boost/program_options.hpp" "ac_cv_header_boost_program_options_hpp" "$ac_includes_default" +if test "x$ac_cv_header_boost_program_options_hpp" = x""yes; then : - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: +$as_echo "#define HAVE_BOOST_PROGRAM_OPTIONS_HPP 1" >>confdefs.h - acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" - ;; +else + as_fn_error $? "cannot find boost/program_options.hpp" "$LINENO" 5 +fi + + +CPPFLAGS=$boost_save_CPPFLAGS +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +fi + +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +# Now let's try to find the library. The algorithm is as follows: first look +# for a given library name according to the user's PREFERRED-RT-OPT. For each +# library name, we prefer to use the ones that carry the tag (toolset name). +# Each library is searched through the various standard paths were Boost is +# usually installed. If we can't find the standard variants, we try to +# enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist +# but there's -obviously- libboost_threads-mt.dylib). +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the Boost program_options library" >&5 +$as_echo_n "checking for the Boost program_options library... " >&6; } +if test "${boost_cv_lib_program_options+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + boost_cv_lib_program_options=no + case "mt-" in #( + mt | mt-) boost_mt=-mt; boost_rtopt=;; #( + mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "Xmt-" : 'Xmt-*\(.*\)'`;; #( + *) boost_mt=; boost_rtopt=mt-;; + esac + if test $enable_static_boost = yes; then + boost_rtopt="s$boost_rtopt" + fi + # Find the proper debug variant depending on what we've been asked to find. + case $boost_rtopt in #( + *d*) boost_rt_d=$boost_rtopt;; #( + *[sgpn]*) # Insert the `d' at the right place (in between `sg' and `pn') + boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( + *) boost_rt_d='-d';; + esac + # If the PREFERRED-RT-OPT are not empty, prepend a `-'. + test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" + $boost_guess_use_mt && boost_mt=-mt + # Look for the abs path the static archive. + # $libext is computed by Libtool but let's make sure it's non empty. + test -z "$libext" && + as_fn_error $? "the libext variable is empty, did you invoke Libtool?" "$LINENO" 5 + boost_save_ac_objext=$ac_objext + # Generate the test file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +boost::program_options::options_description d("test"); + ; + return 0; +} +_ACEOF + if ac_fn_cxx_try_compile "$LINENO"; then : + ac_objext=do_not_rm_me_plz +else + as_fn_error $? "cannot compile a test that uses Boost program_options" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext + ac_objext=$boost_save_ac_objext + boost_failed_libs= +# Don't bother to ident the 6 nested for loops, only the 2 innermost ones +# matter. +for boost_tag_ in -$boost_cv_lib_tag ''; do +for boost_ver_ in -$boost_cv_lib_version ''; do +for boost_mt_ in $boost_mt -mt ''; do +for boost_rtopt_ in $boost_rtopt '' -d; do + for boost_lib in \ + boost_program_options$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ + boost_program_options$boost_tag_$boost_rtopt_$boost_ver_ \ + boost_program_options$boost_tag_$boost_mt_$boost_ver_ \ + boost_program_options$boost_tag_$boost_ver_ + do + # Avoid testing twice the same lib + case $boost_failed_libs in #( + *@$boost_lib@*) continue;; + esac + # If with_boost is empty, we'll search in /lib first, which is not quite + # right so instead we'll try to a location based on where the headers are. + boost_tmp_lib=$with_boost + test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} + for boost_ldpath in "$boost_tmp_lib/lib" '' \ + /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \ + "$with_boost" C:/Boost/lib /lib* + do + test -e "$boost_ldpath" || continue + boost_save_LDFLAGS=$LDFLAGS + # Are we looking for a static library? + case $boost_ldpath:$boost_rtopt_ in #( + *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) + boost_cv_lib_program_options_LIBS="$boost_ldpath/lib$boost_lib.$libext" + test -e "$boost_cv_lib_program_options_LIBS" || continue;; #( + *) # No: use -lboost_foo to find the shared library. + boost_cv_lib_program_options_LIBS="-l$boost_lib";; + esac + boost_save_LIBS=$LIBS + LIBS="$boost_cv_lib_program_options_LIBS $LIBS" + test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" + rm -f conftest$ac_exeext +boost_save_ac_ext=$ac_ext +boost_use_source=: +# If we already have a .o, re-use it. We change $ac_ext so that $ac_link +# tries to link the existing object file instead of compiling from source. +test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && + $as_echo "$as_me:${as_lineno-$LINENO}: re-using the existing conftest.$ac_objext" >&5 +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_executable_p conftest$ac_exeext + }; then : + boost_cv_lib_program_options=yes +else + if $boost_use_source; then + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do + fi + boost_cv_lib_program_options=no +fi +ac_objext=$boost_save_ac_objext +ac_ext=$boost_save_ac_ext +rm -f core conftest.err conftest_ipa8_conftest.oo \ + conftest$ac_exeext + ac_objext=$boost_save_ac_objext + LDFLAGS=$boost_save_LDFLAGS + LIBS=$boost_save_LIBS + if test x"$boost_cv_lib_program_options" = xyes; then +# Because Boost is often installed in non-standard locations we want to +# hardcode the path to the library (with rpath). Here we assume that +# Libtool's macro was already invoked so we can steal its variable +# hardcode_libdir_flag_spec in order to get the right flags for ld. + boost_save_libdir=$libdir + libdir=$boost_ldpath + eval boost_rpath=\"$hardcode_libdir_flag_spec\" + libdir=$boost_save_libdir + boost_cv_lib_program_options_LDFLAGS="-L$boost_ldpath $boost_rpath" + boost_cv_lib_program_options_LDPATH="$boost_ldpath" + break 6 + else + boost_failed_libs="$boost_failed_libs@$boost_lib@" + fi + done + done +done +done +done +done +rm -f conftest.$ac_objext - case $flag in - none) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 -$as_echo_n "checking whether pthreads work without any flags... " >&6; } - ;; +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $boost_cv_lib_program_options" >&5 +$as_echo "$boost_cv_lib_program_options" >&6; } +case $boost_cv_lib_program_options in #( + no) $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - -*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 -$as_echo_n "checking whether pthreads work with $flag... " >&6; } - PTHREAD_CFLAGS="$flag" - ;; + as_fn_error $? "cannot find the flags to link with Boost program_options" "$LINENO" 5 + ;; +esac +BOOST_PROGRAM_OPTIONS_LDFLAGS=$boost_cv_lib_program_options_LDFLAGS +BOOST_PROGRAM_OPTIONS_LDPATH=$boost_cv_lib_program_options_LDPATH +BOOST_LDPATH=$boost_cv_lib_program_options_LDPATH +BOOST_PROGRAM_OPTIONS_LIBS=$boost_cv_lib_program_options_LIBS +CPPFLAGS=$boost_save_CPPFLAGS +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi - pthread-config) - # Extract the first word of "pthread-config", so it can be a program name with args. -set dummy pthread-config; ac_word=$2 + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_acx_pthread_config+set}" = set; then : +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test -n "$acx_pthread_config"; then - ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_acx_pthread_config="yes" + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -18898,155 +19872,230 @@ done IFS=$as_save_IFS - test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" -fi + ;; +esac fi -acx_pthread_config=$ac_cv_prog_acx_pthread_config -if test -n "$acx_pthread_config"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 -$as_echo "$acx_pthread_config" >&6; } +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test x"$acx_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 -$as_echo_n "checking for the pthreads library -l$flag... " >&6; } - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - acx_pthread_ok=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 -$as_echo "$acx_pthread_ok" >&6; } - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done -fi + done +IFS=$as_save_IFS -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 -$as_echo_n "checking for joinable pthread attribute... " >&6; } - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -int attr=$attr; return attr; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - attr_name=$attr; break + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 -$as_echo "$attr_name" >&6; } - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then -cat >>confdefs.h <<_ACEOF -#define PTHREAD_CREATE_JOINABLE $attr_name -_ACEOF +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi - fi +fi + # Check whether --enable-libmemcached was given. +if test "${enable_libmemcached+set}" = set; then : + enableval=$enable_libmemcached; ac_enable_libmemcached="$enableval" +else + ac_enable_libmemcached="yes" +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 -$as_echo_n "checking if more special flags are required for pthreads... " >&6; } - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; - *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 -$as_echo "${flag}" >&6; } - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + + if test "x$ac_enable_libmemcached" = "xyes"; then : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmemcached" >&5 +$as_echo_n "checking for libmemcached... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$libmemcached_CFLAGS"; then + pkg_cv_libmemcached_CFLAGS="$libmemcached_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libmemcached >= 0.42 \""; } >&5 + ($PKG_CONFIG --exists --print-errors " libmemcached >= 0.42 ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libmemcached_CFLAGS=`$PKG_CONFIG --cflags " libmemcached >= 0.42 " 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$libmemcached_LIBS"; then + pkg_cv_libmemcached_LIBS="$libmemcached_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libmemcached >= 0.42 \""; } >&5 + ($PKG_CONFIG --exists --print-errors " libmemcached >= 0.42 ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libmemcached_LIBS=`$PKG_CONFIG --libs " libmemcached >= 0.42 " 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + libmemcached_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors " libmemcached >= 0.42 "` + else + libmemcached_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors " libmemcached >= 0.42 "` fi + # Put the nasty error message in config.log where it belongs + echo "$libmemcached_PKG_ERRORS" >&5 - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_enable_libmemcached="no" +elif test $pkg_failed = untried; then + ac_enable_libmemcached="no" +else + libmemcached_CFLAGS=$pkg_cv_libmemcached_CFLAGS + libmemcached_LIBS=$pkg_cv_libmemcached_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then - for ac_prog in xlc_r cc_r -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +$as_echo "#define HAVE_LIBMEMCACHED 1 " >>confdefs.h + +fi +fi + + if test "x${ac_enable_libmemcached}" = "xyes"; then + HAVE_LIBMEMCACHED_TRUE= + HAVE_LIBMEMCACHED_FALSE='#' +else + HAVE_LIBMEMCACHED_TRUE='#' + HAVE_LIBMEMCACHED_FALSE= +fi + + + + +# Check whether --with-memcached was given. +if test "${with_memcached+set}" = set; then : + withval=$with_memcached; ac_cv_with_memcached="$withval" +else + ac_cv_with_memcached=memcached +fi + + + # just ignore the user if --without-memcached is passed.. it is + # only used by make test + if test "x$withval" = "xno"; then : + + ac_cv_with_memcached=memcached + MEMCACHED_BINARY=memcached + +else + + if test -f "$withval"; then : + + ac_cv_with_memcached=$withval + MEMCACHED_BINARY=$withval + +else + + # Extract the first word of "$ac_cv_with_memcached", so it can be a program name with args. +set dummy $ac_cv_with_memcached; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then : +if test "${ac_cv_path_MEMCACHED_BINARY+set}" = set; then : $as_echo_n "(cached) " >&6 else - if test -n "$PTHREAD_CC"; then - ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + case $MEMCACHED_BINARY in + [\\/]* | ?:[\\/]*) + ac_cv_path_MEMCACHED_BINARY="$MEMCACHED_BINARY" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_PTHREAD_CC="$ac_prog" + ac_cv_path_MEMCACHED_BINARY="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -19054,533 +20103,960 @@ done IFS=$as_save_IFS + test -z "$ac_cv_path_MEMCACHED_BINARY" && ac_cv_path_MEMCACHED_BINARY=""no"" + ;; +esac fi -fi -PTHREAD_CC=$ac_cv_prog_PTHREAD_CC -if test -n "$PTHREAD_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 -$as_echo "$PTHREAD_CC" >&6; } +MEMCACHED_BINARY=$ac_cv_path_MEMCACHED_BINARY +if test -n "$MEMCACHED_BINARY"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MEMCACHED_BINARY" >&5 +$as_echo "$MEMCACHED_BINARY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$PTHREAD_CC" && break -done -test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" - else - PTHREAD_CC=$CC - fi -else - PTHREAD_CC="$CC" fi +fi + if test "x${ac_cv_with_memcached}" != "xno"; then + HAVE_MEMCACHED_TRUE= + HAVE_MEMCACHED_FALSE='#' +else + HAVE_MEMCACHED_TRUE='#' + HAVE_MEMCACHED_FALSE= +fi +cat >>confdefs.h <<_ACEOF +#define MEMCACHED_BINARY "$MEMCACHED_BINARY" +_ACEOF -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - -$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h - : + # Check whether --enable-libdrizzle was given. +if test "${enable_libdrizzle+set}" = set; then : + enableval=$enable_libdrizzle; ac_enable_libdrizzle="$enableval" else - acx_pthread_ok=no - + ac_enable_libdrizzle="yes" fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - LIBS="${PTHREAD_LIBS} ${LIBS}" - AM_CFLAGS="${PTHREAD_CFLAGS} ${AM_CFLAGS}" - AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}" + if test "x$ac_enable_libdrizzle" = "xyes"; then : - save_CFLAGS="${CFLAGS}" - save_CXXFLAGS="${CXXFLAGS}" - CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}" - CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}" - for ac_func in pthread_yield_np -do : - ac_fn_c_check_func "$LINENO" "pthread_yield_np" "ac_cv_func_pthread_yield_np" -if test "x$ac_cv_func_pthread_yield_np" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_YIELD_NP 1 -_ACEOF +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrizzle" >&5 +$as_echo_n "checking for libdrizzle... " >&6; } -fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes zero arguments" >&5 -$as_echo_n "checking if pthread_yield takes zero arguments... " >&6; } -if test "${pandora_cv_pthread_yield_zero_arg+set}" = set; then : - $as_echo_n "(cached) " >&6 +if test -n "$PKG_CONFIG"; then + if test -n "$libdrizzle_CFLAGS"; then + pkg_cv_libdrizzle_CFLAGS="$libdrizzle_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libdrizzle-1.0 >= 2011.03.13 \""; } >&5 + ($PKG_CONFIG --exists --print-errors " libdrizzle-1.0 >= 2011.03.13 ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libdrizzle_CFLAGS=`$PKG_CONFIG --cflags " libdrizzle-1.0 >= 2011.03.13 " 2>/dev/null` else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$libdrizzle_LIBS"; then + pkg_cv_libdrizzle_LIBS="$libdrizzle_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libdrizzle-1.0 >= 2011.03.13 \""; } >&5 + ($PKG_CONFIG --exists --print-errors " libdrizzle-1.0 >= 2011.03.13 ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libdrizzle_LIBS=`$PKG_CONFIG --libs " libdrizzle-1.0 >= 2011.03.13 " 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi -#include -int -main () -{ +if test $pkg_failed = yes; then - pthread_yield(); +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + libdrizzle_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors " libdrizzle-1.0 >= 2011.03.13 "` + else + libdrizzle_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors " libdrizzle-1.0 >= 2011.03.13 "` + fi + # Put the nasty error message in config.log where it belongs + echo "$libdrizzle_PKG_ERRORS" >&5 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pandora_cv_pthread_yield_zero_arg=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_enable_libdrizzle="no" +elif test $pkg_failed = untried; then + ac_enable_libdrizzle="no" else - pandora_cv_pthread_yield_zero_arg=no + libdrizzle_CFLAGS=$pkg_cv_libdrizzle_CFLAGS + libdrizzle_LIBS=$pkg_cv_libdrizzle_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_LIBDRIZZLE 1 " >>confdefs.h + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_pthread_yield_zero_arg" >&5 -$as_echo "$pandora_cv_pthread_yield_zero_arg" >&6; } - if test "$pandora_cv_pthread_yield_zero_arg" = "yes"; then : + if test "x${ac_enable_libdrizzle}" = "xyes"; then + HAVE_LIBDRIZZLE_TRUE= + HAVE_LIBDRIZZLE_FALSE='#' +else + HAVE_LIBDRIZZLE_TRUE='#' + HAVE_LIBDRIZZLE_FALSE= +fi -$as_echo "#define HAVE_PTHREAD_YIELD_ZERO_ARG 1" >>confdefs.h -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes one argument" >&5 -$as_echo_n "checking if pthread_yield takes one argument... " >&6; } -if test "${pandora_cv_pthread_yield_one_arg+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -#include +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 +$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_join (); int main () { - - pthread_yield(0); - +return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - pandora_cv_pthread_yield_one_arg=yes -else - pandora_cv_pthread_yield_one_arg=no + acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 +$as_echo "$acx_pthread_ok" >&6; } + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_pthread_yield_one_arg" >&5 -$as_echo "$pandora_cv_pthread_yield_one_arg" >&6; } - if test "$pandora_cv_pthread_yield_one_arg" = "yes"; then : +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). -$as_echo "#define HAVE_PTHREAD_YIELD_ONE_ARG 1" >>confdefs.h +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" -fi +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: - for ac_func in pthread_attr_getstacksize pthread_attr_setprio \ - pthread_attr_setschedparam \ - pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \ - pthread_key_delete pthread_rwlock_rdlock pthread_setprio \ - pthread_setprio_np pthread_setschedparam pthread_sigmask \ - pthread_attr_create rwlock_init +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +case "${host_cpu}-${host_os}" in + *solaris*) -fi -done + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ;; +esac +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + case $flag in + none) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +$as_echo_n "checking whether pthreads work without any flags... " >&6; } + ;; + -*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 +$as_echo_n "checking whether pthreads work with $flag... " >&6; } + PTHREAD_CFLAGS="$flag" + ;; -# Check definition of pthread_getspecific -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking args to pthread_getspecific" >&5 -$as_echo_n "checking args to pthread_getspecific... " >&6; } -if test "${pandora_cv_getspecific_args+set}" = set; then : + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_acx_pthread_config+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test -n "$acx_pthread_config"; then + ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_acx_pthread_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -#if !defined(_REENTRANT) -#define _REENTRANT -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS -#endif -#include + test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" +fi +fi +acx_pthread_config=$ac_cv_prog_acx_pthread_config +if test -n "$acx_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 +$as_echo "$acx_pthread_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -int -main () -{ -void *pthread_getspecific(pthread_key_t key); -pthread_getspecific((pthread_key_t) NULL); + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - pandora_cv_getspecific_args=POSIX -else - pandora_cv_getspecific_args=other -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_getspecific_args" >&5 -$as_echo "$pandora_cv_getspecific_args" >&6; } - if test "$pandora_cv_getspecific_args" = "other" - then - -$as_echo "#define HAVE_NONPOSIX_PTHREAD_GETSPECIFIC 1" >>confdefs.h + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 +$as_echo_n "checking for the pthreads library -l$flag... " >&6; } + PTHREAD_LIBS="-l$flag" + ;; + esac - fi + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - # Check definition of pthread_mutex_init - { $as_echo "$as_me:${as_lineno-$LINENO}: checking args to pthread_mutex_init" >&5 -$as_echo_n "checking args to pthread_mutex_init... " >&6; } -if test "${pandora_cv_mutex_init_args+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS -#endif #include int main () { - - pthread_mutexattr_t attr; - pthread_mutex_t mp; - pthread_mutex_init(&mp,&attr); +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - pandora_cv_mutex_init_args=POSIX -else - pandora_cv_mutex_init_args=other -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if ac_fn_c_try_link "$LINENO"; then : + acx_pthread_ok=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_mutex_init_args" >&5 -$as_echo "$pandora_cv_mutex_init_args" >&6; } - if test "$pandora_cv_mutex_init_args" = "other" - then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -$as_echo "#define HAVE_NONPOSIX_PTHREAD_MUTEX_INIT 1" >>confdefs.h + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" - fi -#---END: + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 +$as_echo "$acx_pthread_ok" >&6; } + if test "x$acx_pthread_ok" = xyes; then + break; + fi -#---START: Used in for client configure -# Check definition of readdir_r -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking args to readdir_r" >&5 -$as_echo_n "checking args to readdir_r... " >&6; } -if test "${pandora_cv_readdir_r+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS -#endif +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +$as_echo_n "checking for joinable pthread attribute... " >&6; } + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ #include -#include int main () { - int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); -readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); +int attr=$attr; return attr; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - pandora_cv_readdir_r=POSIX -else - pandora_cv_readdir_r=other + attr_name=$attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_readdir_r" >&5 -$as_echo "$pandora_cv_readdir_r" >&6; } -if test "$pandora_cv_readdir_r" = "POSIX" -then + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 +$as_echo "$attr_name" >&6; } + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then -$as_echo "#define HAVE_READDIR_R 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $attr_name +_ACEOF -fi + fi -# Check definition of posix sigwait() -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking style of sigwait" >&5 -$as_echo_n "checking style of sigwait... " >&6; } -if test "${pandora_cv_sigwait+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 +$as_echo_n "checking if more special flags are required for pthreads... " >&6; } + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 +$as_echo "${flag}" >&6; } + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + for ac_prog in xlc_r cc_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_PTHREAD_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS -#endif -#include -#include +fi +fi +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +$as_echo "$PTHREAD_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -int -main () -{ -#ifndef _AIX -sigset_t set; -int sig; -sigwait(&set,&sig); -#endif + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pandora_cv_sigwait=POSIX + else + PTHREAD_CC=$CC + fi else - pandora_cv_sigwait=other -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + PTHREAD_CC="$CC" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_sigwait" >&5 -$as_echo "$pandora_cv_sigwait" >&6; } -if test "$pandora_cv_sigwait" = "POSIX" -then -$as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h -fi -if test "$pandora_cv_sigwait" != "POSIX" -then -unset pandora_cv_sigwait -# Check definition of posix sigwait() -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking style of sigwait" >&5 -$as_echo_n "checking style of sigwait... " >&6; } -if test "${pandora_cv_sigwait+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS -#endif -#include -#include -int -main () +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + +$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h + + : +else + acx_pthread_ok=no + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + LIBS="${PTHREAD_LIBS} ${LIBS}" + AM_CFLAGS="${PTHREAD_CFLAGS} ${AM_CFLAGS}" + AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}" + + + + save_CFLAGS="${CFLAGS}" + save_CXXFLAGS="${CXXFLAGS}" + CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}" + CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}" + for ac_func in pthread_yield_np +do : + ac_fn_c_check_func "$LINENO" "pthread_yield_np" "ac_cv_func_pthread_yield_np" +if test "x$ac_cv_func_pthread_yield_np" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_YIELD_NP 1 +_ACEOF + +fi +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes zero arguments" >&5 +$as_echo_n "checking if pthread_yield takes zero arguments... " >&6; } +if test "${pandora_cv_pthread_yield_zero_arg+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () { -sigset_t set; -int sig; -sigwait(&set); + pthread_yield(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - pandora_cv_sigwait=NONPOSIX + pandora_cv_pthread_yield_zero_arg=yes else - pandora_cv_sigwait=other + pandora_cv_pthread_yield_zero_arg=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_sigwait" >&5 -$as_echo "$pandora_cv_sigwait" >&6; } -if test "$pandora_cv_sigwait" = "NONPOSIX" -then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_pthread_yield_zero_arg" >&5 +$as_echo "$pandora_cv_pthread_yield_zero_arg" >&6; } + if test "$pandora_cv_pthread_yield_zero_arg" = "yes"; then : + + +$as_echo "#define HAVE_PTHREAD_YIELD_ZERO_ARG 1" >>confdefs.h -$as_echo "#define HAVE_NONPOSIX_SIGWAIT 1" >>confdefs.h fi -fi -#---END: -# Check if pthread_attr_setscope() exists -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setscope" >&5 -$as_echo_n "checking for pthread_attr_setscope... " >&6; } -if test "${pandora_cv_pthread_attr_setscope+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes one argument" >&5 +$as_echo_n "checking if pthread_yield takes one argument... " >&6; } +if test "${pandora_cv_pthread_yield_one_arg+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS -#endif + #include int main () { -pthread_attr_t thr_attr; -pthread_attr_setscope(&thr_attr,0); + pthread_yield(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - pandora_cv_pthread_attr_setscope=yes + pandora_cv_pthread_yield_one_arg=yes else - pandora_cv_pthread_attr_setscope=no + pandora_cv_pthread_yield_one_arg=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_pthread_attr_setscope" >&5 -$as_echo "$pandora_cv_pthread_attr_setscope" >&6; } -if test "$pandora_cv_pthread_attr_setscope" = "yes" -then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_pthread_yield_one_arg" >&5 +$as_echo "$pandora_cv_pthread_yield_one_arg" >&6; } + if test "$pandora_cv_pthread_yield_one_arg" = "yes"; then : -$as_echo "#define HAVE_PTHREAD_ATTR_SETSCOPE 1" >>confdefs.h + +$as_echo "#define HAVE_PTHREAD_YIELD_ONE_ARG 1" >>confdefs.h + + +fi + + for ac_func in pthread_attr_getstacksize pthread_attr_setprio \ + pthread_attr_setschedparam \ + pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \ + pthread_key_delete pthread_rwlock_rdlock pthread_setprio \ + pthread_setprio_np pthread_setschedparam pthread_sigmask \ + pthread_attr_create rwlock_init + +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF fi +done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes zero arguments" >&5 -$as_echo_n "checking if pthread_yield takes zero arguments... " >&6; } -if test "${ac_cv_pthread_yield_zero_arg+set}" = set; then : + + +# Check definition of pthread_getspecific +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking args to pthread_getspecific" >&5 +$as_echo_n "checking args to pthread_getspecific... " >&6; } +if test "${pandora_cv_getspecific_args+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#define _GNU_SOURCE -#include -#ifdef __cplusplus -extern "C" + +#if !defined(_REENTRANT) +#define _REENTRANT +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS #endif +#include int main () { - pthread_yield(); +void *pthread_getspecific(pthread_key_t key); +pthread_getspecific((pthread_key_t) NULL); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_pthread_yield_zero_arg=yes +if ac_fn_c_try_compile "$LINENO"; then : + pandora_cv_getspecific_args=POSIX else - ac_cv_pthread_yield_zero_arg=yeso + pandora_cv_getspecific_args=other fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pthread_yield_zero_arg" >&5 -$as_echo "$ac_cv_pthread_yield_zero_arg" >&6; } -if test "$ac_cv_pthread_yield_zero_arg" = "yes" -then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_getspecific_args" >&5 +$as_echo "$pandora_cv_getspecific_args" >&6; } + if test "$pandora_cv_getspecific_args" = "other" + then -$as_echo "#define HAVE_PTHREAD_YIELD_ZERO_ARG 1" >>confdefs.h +$as_echo "#define HAVE_NONPOSIX_PTHREAD_GETSPECIFIC 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes 1 argument" >&5 -$as_echo_n "checking if pthread_yield takes 1 argument... " >&6; } -if test "${ac_cv_pthread_yield_one_arg+set}" = set; then : + fi + + # Check definition of pthread_mutex_init + { $as_echo "$as_me:${as_lineno-$LINENO}: checking args to pthread_mutex_init" >&5 +$as_echo_n "checking args to pthread_mutex_init... " >&6; } +if test "${pandora_cv_mutex_init_args+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#define _GNU_SOURCE -#include -#ifdef __cplusplus -extern "C" -#endif +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS +#endif +#include int main () { - pthread_yield(0); + pthread_mutexattr_t attr; + pthread_mutex_t mp; + pthread_mutex_init(&mp,&attr); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pandora_cv_mutex_init_args=POSIX +else + pandora_cv_mutex_init_args=other +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_mutex_init_args" >&5 +$as_echo "$pandora_cv_mutex_init_args" >&6; } + if test "$pandora_cv_mutex_init_args" = "other" + then + +$as_echo "#define HAVE_NONPOSIX_PTHREAD_MUTEX_INIT 1" >>confdefs.h + fi +#---END: + +#---START: Used in for client configure +# Check definition of readdir_r +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking args to readdir_r" >&5 +$as_echo_n "checking args to readdir_r... " >&6; } +if test "${pandora_cv_readdir_r+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS +#endif +#include +#include +int +main () +{ + int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); +readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_pthread_yield_one_arg=yes + pandora_cv_readdir_r=POSIX else - ac_cv_pthread_yield_one_arg=no + pandora_cv_readdir_r=other fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pthread_yield_one_arg" >&5 -$as_echo "$ac_cv_pthread_yield_one_arg" >&6; } -if test "$ac_cv_pthread_yield_one_arg" = "yes" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_readdir_r" >&5 +$as_echo "$pandora_cv_readdir_r" >&6; } +if test "$pandora_cv_readdir_r" = "POSIX" then -$as_echo "#define HAVE_PTHREAD_YIELD_ONE_ARG 1" >>confdefs.h +$as_echo "#define HAVE_READDIR_R 1" >>confdefs.h fi - CFLAGS="${save_CFLAGS}" - CXXFLAGS="${save_CXXFLAGS}" +# Check definition of posix sigwait() +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking style of sigwait" >&5 +$as_echo_n "checking style of sigwait... " >&6; } +if test "${pandora_cv_sigwait+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS +#endif +#include +#include + +int +main () +{ + +#ifndef _AIX +sigset_t set; +int sig; +sigwait(&set,&sig); +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pandora_cv_sigwait=POSIX +else + pandora_cv_sigwait=other +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_sigwait" >&5 +$as_echo "$pandora_cv_sigwait" >&6; } +if test "$pandora_cv_sigwait" = "POSIX" +then + +$as_echo "#define HAVE_SIGWAIT 1" >>confdefs.h + +fi + +if test "$pandora_cv_sigwait" != "POSIX" +then +unset pandora_cv_sigwait +# Check definition of posix sigwait() +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking style of sigwait" >&5 +$as_echo_n "checking style of sigwait... " >&6; } +if test "${pandora_cv_sigwait+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS +#endif +#include +#include + +int +main () +{ + +sigset_t set; +int sig; +sigwait(&set); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pandora_cv_sigwait=NONPOSIX +else + pandora_cv_sigwait=other +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_sigwait" >&5 +$as_echo "$pandora_cv_sigwait" >&6; } +if test "$pandora_cv_sigwait" = "NONPOSIX" +then + +$as_echo "#define HAVE_NONPOSIX_SIGWAIT 1" >>confdefs.h + +fi +fi +#---END: + +# Check if pthread_attr_setscope() exists +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setscope" >&5 +$as_echo_n "checking for pthread_attr_setscope... " >&6; } +if test "${pandora_cv_pthread_attr_setscope+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS +#endif +#include + +int +main () +{ + +pthread_attr_t thr_attr; +pthread_attr_setscope(&thr_attr,0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pandora_cv_pthread_attr_setscope=yes +else + pandora_cv_pthread_attr_setscope=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_pthread_attr_setscope" >&5 +$as_echo "$pandora_cv_pthread_attr_setscope" >&6; } +if test "$pandora_cv_pthread_attr_setscope" = "yes" +then + +$as_echo "#define HAVE_PTHREAD_ATTR_SETSCOPE 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes zero arguments" >&5 +$as_echo_n "checking if pthread_yield takes zero arguments... " >&6; } +if test "${ac_cv_pthread_yield_zero_arg+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _GNU_SOURCE +#include +#ifdef __cplusplus +extern "C" +#endif + +int +main () +{ + + pthread_yield(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_pthread_yield_zero_arg=yes +else + ac_cv_pthread_yield_zero_arg=yeso +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pthread_yield_zero_arg" >&5 +$as_echo "$ac_cv_pthread_yield_zero_arg" >&6; } +if test "$ac_cv_pthread_yield_zero_arg" = "yes" +then + +$as_echo "#define HAVE_PTHREAD_YIELD_ZERO_ARG 1" >>confdefs.h + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_yield takes 1 argument" >&5 +$as_echo_n "checking if pthread_yield takes 1 argument... " >&6; } +if test "${ac_cv_pthread_yield_one_arg+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _GNU_SOURCE +#include +#ifdef __cplusplus +extern "C" +#endif + +int +main () +{ + + pthread_yield(0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_pthread_yield_one_arg=yes +else + ac_cv_pthread_yield_one_arg=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pthread_yield_one_arg" >&5 +$as_echo "$ac_cv_pthread_yield_one_arg" >&6; } +if test "$ac_cv_pthread_yield_one_arg" = "yes" +then + +$as_echo "#define HAVE_PTHREAD_YIELD_ONE_ARG 1" >>confdefs.h + +fi + + CFLAGS="${save_CFLAGS}" + CXXFLAGS="${save_CXXFLAGS}" @@ -19590,7 +21066,18 @@ if test "x$acx_pthread_ok" != "xyes"; then : - as_fn_error "could not find libpthread" "$LINENO" 5 + + if test "x${pandora_cv_skip_requires}" != "xno"; then : + + as_fn_error $? "could not find libpthread" "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find libpthread" >&5 +$as_echo "$as_me: WARNING: could not find libpthread" >&2;} + +fi + fi @@ -19687,7 +21174,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${acl_cv_prog_gnu_ld+set}" = set; then : @@ -20362,7 +21849,18 @@ if test x$ac_cv_libevent = xno; then : - as_fn_error "libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel." "$LINENO" 5 + + if test "x${pandora_cv_skip_requires}" != "xno"; then : + + as_fn_error $? "libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel." "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel." >&5 +$as_echo "$as_me: WARNING: libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel." >&2;} + +fi + fi @@ -20956,35 +22454,20 @@ if test "x$ac_cv_header_uuid_uuid_h" = "xno"; then : - as_fn_error "Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On Redhat this can be found in e2fsprogs-devel." "$LINENO" 5 - -fi - - + if test "x${pandora_cv_skip_requires}" != "xno"; then : + as_fn_error $? "Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On RHEL 4 this can be found in e2fsprogs-devel and Fedora/RHEL 6 in libuuid-devel." "$LINENO" 5 - - - - - # Check whether --enable-libgtest was given. -if test "${enable_libgtest+set}" = set; then : - enableval=$enable_libgtest; ac_enable_libgtest="$enableval" else - ac_enable_libgtest="yes" -fi - - if test "x$ac_enable_libgtest" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On RHEL 4 this can be found in e2fsprogs-devel and Fedora/RHEL 6 in libuuid-devel." >&5 +$as_echo "$as_me: WARNING: Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On RHEL 4 this can be found in e2fsprogs-devel and Fedora/RHEL 6 in libuuid-devel." >&2;} - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +fi +fi @@ -20993,349 +22476,416 @@ + # Check whether --enable-umem was given. +if test "${enable_umem+set}" = set; then : + enableval=$enable_umem; ac_enable_umem="$enableval" +else + case "$target_os" in + *solaris*) + ac_enable_umem="yes" + ;; + *) + ac_enable_umem="no" + ;; + esac +fi - use_additional=yes - if test "x$GCC" = "xyes" -a "x" = "xsystem" - then - i_system="-isystem " - else - i_system="-I" - fi + # Check whether --enable-tcmalloc was given. +if test "${enable_tcmalloc+set}" = set; then : + enableval=$enable_tcmalloc; ac_enable_tcmalloc="$enableval" +else + ac_enable_tcmalloc="no" +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" + # Check whether --enable-mtmalloc was given. +if test "${enable_mtmalloc+set}" = set; then : + enableval=$enable_mtmalloc; ac_enable_mtmalloc="$enableval" +else + ac_enable_mtmalloc="yes" +fi - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + save_LIBS="${LIBS}" + LIBS= + if test "x$ac_enable_umem" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lumem" >&5 +$as_echo_n "checking for malloc in -lumem... " >&6; } +if test "${ac_cv_lib_umem_malloc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lumem $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -# Check whether --with-libgtest-prefix was given. -if test "${with_libgtest_prefix+set}" = set; then : - withval=$with_libgtest_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char malloc (); +int +main () +{ +return malloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_umem_malloc=yes +else + ac_cv_lib_umem_malloc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_umem_malloc" >&5 +$as_echo "$ac_cv_lib_umem_malloc" >&6; } +if test "x$ac_cv_lib_umem_malloc" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUMEM 1 +_ACEOF - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" + LIBS="-lumem $LIBS" - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +fi - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi +else + + case "$target_os" in + *linux*) + if test "x$ac_enable_tcmalloc" != "xno"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -ltcmalloc-minimal" >&5 +$as_echo_n "checking for malloc in -ltcmalloc-minimal... " >&6; } +if test "${ac_cv_lib_tcmalloc_minimal_malloc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltcmalloc-minimal $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char malloc (); +int +main () +{ +return malloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tcmalloc_minimal_malloc=yes +else + ac_cv_lib_tcmalloc_minimal_malloc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcmalloc_minimal_malloc" >&5 +$as_echo "$ac_cv_lib_tcmalloc_minimal_malloc" >&6; } +if test "x$ac_cv_lib_tcmalloc_minimal_malloc" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCMALLOC_MINIMAL 1 +_ACEOF + + LIBS="-ltcmalloc-minimal $LIBS" + +fi + + if test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -ltcmalloc" >&5 +$as_echo_n "checking for malloc in -ltcmalloc... " >&6; } +if test "${ac_cv_lib_tcmalloc_malloc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltcmalloc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char malloc (); +int +main () +{ +return malloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tcmalloc_malloc=yes +else + ac_cv_lib_tcmalloc_malloc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcmalloc_malloc" >&5 +$as_echo "$ac_cv_lib_tcmalloc_malloc" >&6; } +if test "x$ac_cv_lib_tcmalloc_malloc" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCMALLOC 1 +_ACEOF + + LIBS="-ltcmalloc $LIBS" + +fi + + +fi + +fi + ;; + *solaris*) + if test "x$ac_enable_mtmalloc" != "xno"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lmtmalloc" >&5 +$as_echo_n "checking for malloc in -lmtmalloc... " >&6; } +if test "${ac_cv_lib_mtmalloc_malloc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmtmalloc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char malloc (); +int +main () +{ +return malloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_mtmalloc_malloc=yes +else + ac_cv_lib_mtmalloc_malloc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mtmalloc_malloc" >&5 +$as_echo "$ac_cv_lib_mtmalloc_malloc" >&6; } +if test "x$ac_cv_lib_mtmalloc_malloc" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMTMALLOC 1 +_ACEOF + + LIBS="-lmtmalloc $LIBS" + +fi + + +fi + ;; + esac + +fi + BETTER_MALLOC_LIBS="${LIBS}" + LIBS="${save_LIBS}" + + + + + + + + # Check whether --enable-libsqlite3 was given. +if test "${enable_libsqlite3+set}" = set; then : + enableval=$enable_libsqlite3; ac_enable_libsqlite3="$enableval" +else + ac_enable_libsqlite3="yes" +fi + + + if test "x$ac_enable_libsqlite3" = "xyes"; then : + + + + + + + + + + - LIBGTEST= - LTLIBGTEST= - INCGTEST= - LIBGTEST_PREFIX= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='gtest ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBGTEST="${LTLIBGTEST}${LTLIBGTEST:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBGTEST; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBGTEST="${LTLIBGTEST}${LTLIBGTEST:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBGTEST; do + + use_additional=yes + if test "x$GCC" = "xyes" -a "x" = "xsystem" + then + i_system="-isystem " + else + i_system="-I" + fi + acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$found_so" - else - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$found_a" - else - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'gtest'; then - LIBGTEST_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'gtest'; then - LIBGTEST_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCGTEST; do + +# Check whether --with-libsqlite3-prefix was given. +if test "${with_libsqlite3_prefix+set}" = set; then : + withval=$with_libsqlite3_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X${i_system}$additional_includedir"; then - haveit=yes + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBSQLITE3= + LTLIBSQLITE3= + INCSQLITE3= + LIBSQLITE3_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='sqlite3 ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" break fi done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCGTEST="${INCGTEST}${INCGTEST:+ }${i_system}$additional_includedir" - fi - fi fi fi fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBGTEST; do + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBSQLITE3; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -21345,18 +22895,90 @@ exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" break fi done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBGTEST; do + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBSQLITE3; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -21366,44 +22988,173 @@ exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBGTEST="${LTLIBGTEST}${LTLIBGTEST:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break fi + done + if test -z "$haveit"; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-L$found_dir" fi - ;; + if test "$acl_hardcode_minus_L" != no; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + else + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_a" + else + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'sqlite3'; then + LIBSQLITE3_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'sqlite3'; then + LIBSQLITE3_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCSQLITE3; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X${i_system}$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCSQLITE3="${INCSQLITE3}${INCSQLITE3:+ }${i_system}$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBSQLITE3; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBSQLITE3; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; @@ -21411,15 +23162,15 @@ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$dep" - LTLIBGTEST="${LTLIBGTEST}${LTLIBGTEST:+ }$dep" + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$dep" + LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }$dep" ;; esac done fi else - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }-l$name" - LTLIBGTEST="${LTLIBGTEST}${LTLIBGTEST:+ }-l$name" + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-l$name" + LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-l$name" fi fi fi @@ -21435,20 +23186,20 @@ libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$flag" + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBGTEST="${LIBGTEST}${LIBGTEST:+ }$flag" + LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do - LTLIBGTEST="${LTLIBGTEST}${LTLIBGTEST:+ }-R$found_dir" + LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-R$found_dir" done fi @@ -21460,7 +23211,7 @@ ac_save_CPPFLAGS="$CPPFLAGS" - for element in $INCGTEST; do + for element in $INCSQLITE3; do haveit= for x in $CPPFLAGS; do @@ -21483,58 +23234,58 @@ done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgtest" >&5 -$as_echo_n "checking for libgtest... " >&6; } -if test "${ac_cv_libgtest+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsqlite3" >&5 +$as_echo_n "checking for libsqlite3... " >&6; } +if test "${ac_cv_libsqlite3+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBGTEST" + LIBS="$LIBS $LIBSQLITE3" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include -TEST(pandora_test_libgtest, PandoraTest) -{ - ASSERT_EQ(1, 1); -} + #include + #include int main () { + sqlite3 *db; + sqlite3_open(NULL, &db); + ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_libgtest=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_libsqlite3=yes else - ac_cv_libgtest=no + ac_cv_libsqlite3=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libgtest" >&5 -$as_echo "$ac_cv_libgtest" >&6; } - if test "$ac_cv_libgtest" = yes; then - HAVE_LIBGTEST=yes - -$as_echo "#define HAVE_LIBGTEST 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libgtest" >&5 -$as_echo_n "checking how to link with libgtest... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGTEST" >&5 -$as_echo "$LIBGTEST" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libsqlite3" >&5 +$as_echo "$ac_cv_libsqlite3" >&6; } + if test "$ac_cv_libsqlite3" = yes; then + HAVE_LIBSQLITE3=yes + +$as_echo "#define HAVE_LIBSQLITE3 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libsqlite3" >&5 +$as_echo_n "checking how to link with libsqlite3... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBSQLITE3" >&5 +$as_echo "$LIBSQLITE3" >&6; } else - HAVE_LIBGTEST=no + HAVE_LIBSQLITE3=no CPPFLAGS="$ac_save_CPPFLAGS" - LIBGTEST= - LTLIBGTEST= - LIBGTEST_PREFIX= + LIBSQLITE3= + LTLIBSQLITE3= + LIBSQLITE3_PREFIX= fi @@ -21543,25 +23294,19 @@ - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - else - ac_cv_libgtest="no" + ac_cv_libsqlite3="no" fi - if test "x${ac_cv_libgtest}" = "xyes"; then - HAVE_LIBGTEST_TRUE= - HAVE_LIBGTEST_FALSE='#' + if test "x${ac_cv_libsqlite3}" = "xyes"; then + HAVE_LIBSQLITE3_TRUE= + HAVE_LIBSQLITE3_FALSE='#' else - HAVE_LIBGTEST_TRUE='#' - HAVE_LIBGTEST_FALSE= + HAVE_LIBSQLITE3_TRUE='#' + HAVE_LIBSQLITE3_FALSE= fi @@ -21572,265 +23317,27 @@ - - # Check whether --enable-umem was given. -if test "${enable_umem+set}" = set; then : - enableval=$enable_umem; ac_enable_umem="$enableval" + # Check whether --enable-libpq was given. +if test "${enable_libpq+set}" = set; then : + enableval=$enable_libpq; ac_enable_libpq="$enableval" else + ac_enable_libpq="yes" +fi - case "$target_os" in - *solaris*) - ac_enable_umem="yes" - ;; - *) - ac_enable_umem="no" - ;; - esac -fi + if test "x$ac_enable_libpq" = "xyes"; then : + for ac_header in libpq-fe.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libpq-fe.h" "ac_cv_header_libpq_fe_h" "$ac_includes_default" +if test "x$ac_cv_header_libpq_fe_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPQ_FE_H 1 +_ACEOF - # Check whether --enable-tcmalloc was given. -if test "${enable_tcmalloc+set}" = set; then : - enableval=$enable_tcmalloc; ac_enable_tcmalloc="$enableval" -else - ac_enable_tcmalloc="no" fi - - # Check whether --enable-mtmalloc was given. -if test "${enable_mtmalloc+set}" = set; then : - enableval=$enable_mtmalloc; ac_enable_mtmalloc="$enableval" -else - ac_enable_mtmalloc="yes" -fi - - - save_LIBS="${LIBS}" - LIBS= - if test "x$ac_enable_umem" = "xyes"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lumem" >&5 -$as_echo_n "checking for malloc in -lumem... " >&6; } -if test "${ac_cv_lib_umem_malloc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lumem $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char malloc (); -int -main () -{ -return malloc (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_umem_malloc=yes -else - ac_cv_lib_umem_malloc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_umem_malloc" >&5 -$as_echo "$ac_cv_lib_umem_malloc" >&6; } -if test "x$ac_cv_lib_umem_malloc" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUMEM 1 -_ACEOF - - LIBS="-lumem $LIBS" - -fi - - -else - - case "$target_os" in - *linux*) - if test "x$ac_enable_tcmalloc" != "xno"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -ltcmalloc-minimal" >&5 -$as_echo_n "checking for malloc in -ltcmalloc-minimal... " >&6; } -if test "${ac_cv_lib_tcmalloc_minimal_malloc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ltcmalloc-minimal $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char malloc (); -int -main () -{ -return malloc (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_tcmalloc_minimal_malloc=yes -else - ac_cv_lib_tcmalloc_minimal_malloc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcmalloc_minimal_malloc" >&5 -$as_echo "$ac_cv_lib_tcmalloc_minimal_malloc" >&6; } -if test "x$ac_cv_lib_tcmalloc_minimal_malloc" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBTCMALLOC_MINIMAL 1 -_ACEOF - - LIBS="-ltcmalloc-minimal $LIBS" - -fi - - if test "x$ac_cv_lib_tcmalloc_minimal_malloc" != "xyes"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -ltcmalloc" >&5 -$as_echo_n "checking for malloc in -ltcmalloc... " >&6; } -if test "${ac_cv_lib_tcmalloc_malloc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ltcmalloc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char malloc (); -int -main () -{ -return malloc (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_tcmalloc_malloc=yes -else - ac_cv_lib_tcmalloc_malloc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcmalloc_malloc" >&5 -$as_echo "$ac_cv_lib_tcmalloc_malloc" >&6; } -if test "x$ac_cv_lib_tcmalloc_malloc" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBTCMALLOC 1 -_ACEOF - - LIBS="-ltcmalloc $LIBS" - -fi - - -fi - -fi - ;; - *solaris*) - if test "x$ac_enable_mtmalloc" != "xno"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc in -lmtmalloc" >&5 -$as_echo_n "checking for malloc in -lmtmalloc... " >&6; } -if test "${ac_cv_lib_mtmalloc_malloc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmtmalloc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char malloc (); -int -main () -{ -return malloc (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_mtmalloc_malloc=yes -else - ac_cv_lib_mtmalloc_malloc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mtmalloc_malloc" >&5 -$as_echo "$ac_cv_lib_mtmalloc_malloc" >&6; } -if test "x$ac_cv_lib_mtmalloc_malloc" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBMTMALLOC 1 -_ACEOF - - LIBS="-lmtmalloc $LIBS" - -fi - - -fi - ;; - esac - -fi - BETTER_MALLOC_LIBS="${LIBS}" - LIBS="${save_LIBS}" - - - - - - - - # Check whether --enable-libsqlite3 was given. -if test "${enable_libsqlite3+set}" = set; then : - enableval=$enable_libsqlite3; ac_enable_libsqlite3="$enableval" -else - ac_enable_libsqlite3="yes" -fi - - - if test "x$ac_enable_libsqlite3" = "xyes"; then : +done @@ -21866,9 +23373,9 @@ prefix="$acl_save_prefix" -# Check whether --with-libsqlite3-prefix was given. -if test "${with_libsqlite3_prefix+set}" = set; then : - withval=$with_libsqlite3_prefix; +# Check whether --with-libpq-prefix was given. +if test "${with_libpq_prefix+set}" = set; then : + withval=$with_libpq_prefix; if test "X$withval" = "Xno"; then use_additional=no else @@ -21897,14 +23404,14 @@ fi - LIBSQLITE3= - LTLIBSQLITE3= - INCSQLITE3= - LIBSQLITE3_PREFIX= + LIBPQ= + LTLIBPQ= + INCPQ= + LIBPQ_PREFIX= rpathdirs= ltrpathdirs= names_already_handled= - names_next_round='sqlite3 ' + names_next_round='pq ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= @@ -21923,9 +23430,9 @@ if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" - test -z "$value" || LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$value" + test -z "$value" || LIBPQ="${LIBPQ}${LIBPQ:+ }$value" eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }$value" + test -z "$value" || LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }$value" else : fi @@ -21982,7 +23489,7 @@ fi fi if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBSQLITE3; do + for x in $LDFLAGS $LTLIBPQ; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22041,12 +23548,12 @@ done fi if test "X$found_dir" != "X"; then - LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-L$found_dir -l$name" + LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" else haveit= for x in $ltrpathdirs; do @@ -22059,10 +23566,10 @@ ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then @@ -22075,7 +23582,7 @@ fi else haveit= - for x in $LDFLAGS $LIBSQLITE3; do + for x in $LDFLAGS $LIBPQ; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22091,36 +23598,36 @@ fi done if test -z "$haveit"; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-L$found_dir" + LIBPQ="${LIBPQ}${LIBPQ:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_so" + LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" else - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-l$name" + LIBPQ="${LIBPQ}${LIBPQ:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$found_a" + LIBPQ="${LIBPQ}${LIBPQ:+ }$found_a" else - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-L$found_dir -l$name" + LIBPQ="${LIBPQ}${LIBPQ:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'sqlite3'; then - LIBSQLITE3_PREFIX="$basedir" + if test "$name" = 'pq'; then + LIBPQ_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'sqlite3'; then - LIBSQLITE3_PREFIX="$basedir" + if test "$name" = 'pq'; then + LIBPQ_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; @@ -22136,7 +23643,7 @@ fi fi if test -z "$haveit"; then - for x in $CPPFLAGS $INCSQLITE3; do + for x in $CPPFLAGS $INCPQ; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22153,7 +23660,7 @@ done if test -z "$haveit"; then if test -d "$additional_includedir"; then - INCSQLITE3="${INCSQLITE3}${INCSQLITE3:+ }${i_system}$additional_includedir" + INCPQ="${INCPQ}${INCPQ:+ }${i_system}$additional_includedir" fi fi fi @@ -22183,7 +23690,7 @@ fi if test -z "$haveit"; then haveit= - for x in $LDFLAGS $LIBSQLITE3; do + for x in $LDFLAGS $LIBPQ; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22200,11 +23707,11 @@ done if test -z "$haveit"; then if test -d "$additional_libdir"; then - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-L$additional_libdir" + LIBPQ="${LIBPQ}${LIBPQ:+ }-L$additional_libdir" fi fi haveit= - for x in $LDFLAGS $LTLIBSQLITE3; do + for x in $LDFLAGS $LTLIBPQ; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22221,7 +23728,7 @@ done if test -z "$haveit"; then if test -d "$additional_libdir"; then - LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-L$additional_libdir" + LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-L$additional_libdir" fi fi fi @@ -22259,15 +23766,15 @@ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$dep" - LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }$dep" + LIBPQ="${LIBPQ}${LIBPQ:+ }$dep" + LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }$dep" ;; esac done fi else - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }-l$name" - LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-l$name" + LIBPQ="${LIBPQ}${LIBPQ:+ }-l$name" + LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-l$name" fi fi fi @@ -22283,20 +23790,20 @@ libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$flag" + LIBPQ="${LIBPQ}${LIBPQ:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBSQLITE3="${LIBSQLITE3}${LIBSQLITE3:+ }$flag" + LIBPQ="${LIBPQ}${LIBPQ:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do - LTLIBSQLITE3="${LTLIBSQLITE3}${LTLIBSQLITE3:+ }-R$found_dir" + LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-R$found_dir" done fi @@ -22308,7 +23815,7 @@ ac_save_CPPFLAGS="$CPPFLAGS" - for element in $INCSQLITE3; do + for element in $INCPQ; do haveit= for x in $CPPFLAGS; do @@ -22331,58 +23838,61 @@ done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsqlite3" >&5 -$as_echo_n "checking for libsqlite3... " >&6; } -if test "${ac_cv_libsqlite3+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpq" >&5 +$as_echo_n "checking for libpq... " >&6; } +if test "${ac_cv_libpq+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBSQLITE3" + LIBS="$LIBS $LIBPQ" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #ifdef HAVE_LIBPQ_FE_H + # include + #else + # include + #endif int main () { - sqlite3 *db; - sqlite3_open(NULL, &db); + PGconn *conn; + conn = PQconnectdb(NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libsqlite3=yes + ac_cv_libpq=yes else - ac_cv_libsqlite3=no + ac_cv_libpq=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libsqlite3" >&5 -$as_echo "$ac_cv_libsqlite3" >&6; } - if test "$ac_cv_libsqlite3" = yes; then - HAVE_LIBSQLITE3=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libpq" >&5 +$as_echo "$ac_cv_libpq" >&6; } + if test "$ac_cv_libpq" = yes; then + HAVE_LIBPQ=yes -$as_echo "#define HAVE_LIBSQLITE3 1" >>confdefs.h +$as_echo "#define HAVE_LIBPQ 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libsqlite3" >&5 -$as_echo_n "checking how to link with libsqlite3... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBSQLITE3" >&5 -$as_echo "$LIBSQLITE3" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libpq" >&5 +$as_echo_n "checking how to link with libpq... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPQ" >&5 +$as_echo "$LIBPQ" >&6; } else - HAVE_LIBSQLITE3=no + HAVE_LIBPQ=no CPPFLAGS="$ac_save_CPPFLAGS" - LIBSQLITE3= - LTLIBSQLITE3= - LIBSQLITE3_PREFIX= + LIBPQ= + LTLIBPQ= + LIBPQ_PREFIX= fi @@ -22394,16 +23904,16 @@ else - ac_cv_libsqlite3="no" + ac_cv_libpq="no" fi - if test "x${ac_cv_libsqlite3}" = "xyes"; then - HAVE_LIBSQLITE3_TRUE= - HAVE_LIBSQLITE3_FALSE='#' + if test "x${ac_cv_libpq}" = "xyes"; then + HAVE_LIBPQ_TRUE= + HAVE_LIBPQ_FALSE='#' else - HAVE_LIBSQLITE3_TRUE='#' - HAVE_LIBSQLITE3_FALSE= + HAVE_LIBPQ_TRUE='#' + HAVE_LIBPQ_FALSE= fi @@ -22414,15 +23924,15 @@ - # Check whether --enable-libdrizzle was given. -if test "${enable_libdrizzle+set}" = set; then : - enableval=$enable_libdrizzle; ac_enable_libdrizzle="$enableval" + # Check whether --enable-libtokyocabinet was given. +if test "${enable_libtokyocabinet+set}" = set; then : + enableval=$enable_libtokyocabinet; ac_enable_libtokyocabinet="$enableval" else - ac_enable_libdrizzle="yes" + ac_enable_libtokyocabinet="yes" fi - if test "x$ac_enable_libdrizzle" = "xyes"; then : + if test "x$ac_enable_libtokyocabinet" = "xyes"; then : @@ -22458,9 +23968,9 @@ prefix="$acl_save_prefix" -# Check whether --with-libdrizzle-prefix was given. -if test "${with_libdrizzle_prefix+set}" = set; then : - withval=$with_libdrizzle_prefix; +# Check whether --with-libtokyocabinet-prefix was given. +if test "${with_libtokyocabinet_prefix+set}" = set; then : + withval=$with_libtokyocabinet_prefix; if test "X$withval" = "Xno"; then use_additional=no else @@ -22489,14 +23999,14 @@ fi - LIBDRIZZLE= - LTLIBDRIZZLE= - INCDRIZZLE= - LIBDRIZZLE_PREFIX= + LIBTOKYOCABINET= + LTLIBTOKYOCABINET= + INCTOKYOCABINET= + LIBTOKYOCABINET_PREFIX= rpathdirs= ltrpathdirs= names_already_handled= - names_next_round='drizzle ' + names_next_round='tokyocabinet ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= @@ -22515,9 +24025,9 @@ if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" - test -z "$value" || LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$value" + test -z "$value" || LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$value" eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBDRIZZLE="${LTLIBDRIZZLE}${LTLIBDRIZZLE:+ }$value" + test -z "$value" || LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }$value" else : fi @@ -22574,7 +24084,7 @@ fi fi if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBDRIZZLE; do + for x in $LDFLAGS $LTLIBTOKYOCABINET; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22633,12 +24143,12 @@ done fi if test "X$found_dir" != "X"; then - LTLIBDRIZZLE="${LTLIBDRIZZLE}${LTLIBDRIZZLE:+ }-L$found_dir -l$name" + LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$found_so" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" else haveit= for x in $ltrpathdirs; do @@ -22651,10 +24161,10 @@ ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$found_so" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$found_so" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then @@ -22667,7 +24177,7 @@ fi else haveit= - for x in $LDFLAGS $LIBDRIZZLE; do + for x in $LDFLAGS $LIBTOKYOCABINET; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22683,36 +24193,36 @@ fi done if test -z "$haveit"; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }-L$found_dir" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$found_so" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" else - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }-l$name" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$found_a" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_a" else - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }-L$found_dir -l$name" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'drizzle'; then - LIBDRIZZLE_PREFIX="$basedir" + if test "$name" = 'tokyocabinet'; then + LIBTOKYOCABINET_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'drizzle'; then - LIBDRIZZLE_PREFIX="$basedir" + if test "$name" = 'tokyocabinet'; then + LIBTOKYOCABINET_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; @@ -22728,7 +24238,7 @@ fi fi if test -z "$haveit"; then - for x in $CPPFLAGS $INCDRIZZLE; do + for x in $CPPFLAGS $INCTOKYOCABINET; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22745,7 +24255,7 @@ done if test -z "$haveit"; then if test -d "$additional_includedir"; then - INCDRIZZLE="${INCDRIZZLE}${INCDRIZZLE:+ }${i_system}$additional_includedir" + INCTOKYOCABINET="${INCTOKYOCABINET}${INCTOKYOCABINET:+ }${i_system}$additional_includedir" fi fi fi @@ -22775,7 +24285,7 @@ fi if test -z "$haveit"; then haveit= - for x in $LDFLAGS $LIBDRIZZLE; do + for x in $LDFLAGS $LIBTOKYOCABINET; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22792,11 +24302,11 @@ done if test -z "$haveit"; then if test -d "$additional_libdir"; then - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }-L$additional_libdir" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-L$additional_libdir" fi fi haveit= - for x in $LDFLAGS $LTLIBDRIZZLE; do + for x in $LDFLAGS $LTLIBTOKYOCABINET; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" @@ -22813,7 +24323,7 @@ done if test -z "$haveit"; then if test -d "$additional_libdir"; then - LTLIBDRIZZLE="${LTLIBDRIZZLE}${LTLIBDRIZZLE:+ }-L$additional_libdir" + LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-L$additional_libdir" fi fi fi @@ -22851,15 +24361,15 @@ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$dep" - LTLIBDRIZZLE="${LTLIBDRIZZLE}${LTLIBDRIZZLE:+ }$dep" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$dep" + LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }$dep" ;; esac done fi else - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }-l$name" - LTLIBDRIZZLE="${LTLIBDRIZZLE}${LTLIBDRIZZLE:+ }-l$name" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-l$name" + LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-l$name" fi fi fi @@ -22875,20 +24385,20 @@ libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$flag" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" - LIBDRIZZLE="${LIBDRIZZLE}${LIBDRIZZLE:+ }$flag" + LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do - LTLIBDRIZZLE="${LTLIBDRIZZLE}${LTLIBDRIZZLE:+ }-R$found_dir" + LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-R$found_dir" done fi @@ -22900,7 +24410,7 @@ ac_save_CPPFLAGS="$CPPFLAGS" - for element in $INCDRIZZLE; do + for element in $INCTOKYOCABINET; do haveit= for x in $CPPFLAGS; do @@ -22923,57 +24433,58 @@ done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrizzle" >&5 -$as_echo_n "checking for libdrizzle... " >&6; } -if test "${ac_cv_libdrizzle+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtokyocabinet" >&5 +$as_echo_n "checking for libtokyocabinet... " >&6; } +if test "${ac_cv_libtokyocabinet+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBDRIZZLE" + LIBS="$LIBS $LIBTOKYOCABINET" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include +#include +#include int main () { - drizzle_st drizzle; - drizzle_version(); +const char *test= tcversion; +bool ret= tcadboptimize(NULL, "params"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libdrizzle=yes + ac_cv_libtokyocabinet=yes else - ac_cv_libdrizzle=no + ac_cv_libtokyocabinet=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libdrizzle" >&5 -$as_echo "$ac_cv_libdrizzle" >&6; } - if test "$ac_cv_libdrizzle" = yes; then - HAVE_LIBDRIZZLE=yes - -$as_echo "#define HAVE_LIBDRIZZLE 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libdrizzle" >&5 -$as_echo_n "checking how to link with libdrizzle... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBDRIZZLE" >&5 -$as_echo "$LIBDRIZZLE" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libtokyocabinet" >&5 +$as_echo "$ac_cv_libtokyocabinet" >&6; } + if test "$ac_cv_libtokyocabinet" = yes; then + HAVE_LIBTOKYOCABINET=yes + +$as_echo "#define HAVE_LIBTOKYOCABINET 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libtokyocabinet" >&5 +$as_echo_n "checking how to link with libtokyocabinet... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBTOKYOCABINET" >&5 +$as_echo "$LIBTOKYOCABINET" >&6; } else - HAVE_LIBDRIZZLE=no + HAVE_LIBTOKYOCABINET=no CPPFLAGS="$ac_save_CPPFLAGS" - LIBDRIZZLE= - LTLIBDRIZZLE= - LIBDRIZZLE_PREFIX= + LIBTOKYOCABINET= + LTLIBTOKYOCABINET= + LIBTOKYOCABINET_PREFIX= fi @@ -22985,1179 +24496,1018 @@ else - ac_cv_libdrizzle="no" - -fi + ac_cv_libtokyocabinet="no" - if test "x${ac_cv_libdrizzle}" = "xyes"; then - HAVE_LIBDRIZZLE_TRUE= - HAVE_LIBDRIZZLE_FALSE='#' -else - HAVE_LIBDRIZZLE_TRUE='#' - HAVE_LIBDRIZZLE_FALSE= fi + if test "${ac_cv_libtokyocabinet}" = "no" -a "${ac_enable_libtokyocabinet}" = "yes"; then : +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBTOKYOCABINET" >&5 +$as_echo_n "checking for LIBTOKYOCABINET... " >&6; } - - - - - # Check whether --enable-libmemcached was given. -if test "${enable_libmemcached+set}" = set; then : - enableval=$enable_libmemcached; ac_enable_libmemcached="$enableval" +if test -n "$PKG_CONFIG"; then + if test -n "$LIBTOKYOCABINET_CFLAGS"; then + pkg_cv_LIBTOKYOCABINET_CFLAGS="$LIBTOKYOCABINET_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtokyocabinet >= 1.4.15\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libtokyocabinet >= 1.4.15") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBTOKYOCABINET_CFLAGS=`$PKG_CONFIG --cflags "libtokyocabinet >= 1.4.15" 2>/dev/null` else - ac_enable_libmemcached="yes" + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$LIBTOKYOCABINET_LIBS"; then + pkg_cv_LIBTOKYOCABINET_LIBS="$LIBTOKYOCABINET_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtokyocabinet >= 1.4.15\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libtokyocabinet >= 1.4.15") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBTOKYOCABINET_LIBS=`$PKG_CONFIG --libs "libtokyocabinet >= 1.4.15" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried fi - if test "x$ac_enable_libmemcached" = "xyes"; then : - +if test $pkg_failed = yes; then +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBTOKYOCABINET_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libtokyocabinet >= 1.4.15"` + else + LIBTOKYOCABINET_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libtokyocabinet >= 1.4.15"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBTOKYOCABINET_PKG_ERRORS" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + test x = y +elif test $pkg_failed = untried; then + test x = y +else + LIBTOKYOCABINET_CFLAGS=$pkg_cv_LIBTOKYOCABINET_CFLAGS + LIBTOKYOCABINET_LIBS=$pkg_cv_LIBTOKYOCABINET_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ac_cv_libtokyocabinet=yes + LTLIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS} + LIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS} +fi +fi + if test "${ac_cv_libtokyocabinet}" = "yes"; then + HAVE_LIBTOKYOCABINET_TRUE= + HAVE_LIBTOKYOCABINET_FALSE='#' +else + HAVE_LIBTOKYOCABINET_TRUE='#' + HAVE_LIBTOKYOCABINET_FALSE= +fi +ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" +if test "x$ac_cv_have_decl_strerror_r" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi - use_additional=yes - if test "x$GCC" = "xyes" -a "x" = "xsystem" - then - i_system="-isystem " - else - i_system="-I" - fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R $ac_have_decl +_ACEOF +for ac_func in strerror_r +do : + ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" +if test "x$ac_cv_func_strerror_r" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRERROR_R 1 +_ACEOF - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" +fi +done - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +$as_echo_n "checking whether strerror_r returns char *... " >&6; } +if test "${ac_cv_func_strerror_r_char_p+set}" = set; then : + $as_echo_n "(cached) " >&6 +else - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; -# Check whether --with-libmemcached-prefix was given. -if test "${with_libmemcached_prefix+set}" = set; then : - withval=$with_libmemcached_prefix; - if test "X$withval" = "Xno"; then - use_additional=no + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - if test "X$withval" = "X"; then + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + extern char *strerror_r (); +int +main () +{ +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" + fi - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +$as_echo "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL" >&5 +$as_echo_n "checking for MSG_NOSIGNAL... " >&6; } +if test "${ac_cv_msg_nosignal+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I${srcdir}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int +main () +{ + +int flags= MSG_NOSIGNAL; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_msg_nosignal=yes +else + ac_cv_msg_nosignal=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - LIBMEMCACHED= - LTLIBMEMCACHED= - INCMEMCACHED= - LIBMEMCACHED_PREFIX= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='memcached ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBMEMCACHED="${LTLIBMEMCACHED}${LTLIBMEMCACHED:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBMEMCACHED; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_nosignal" >&5 +$as_echo "$ac_cv_msg_nosignal" >&6; } - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBMEMCACHED="${LTLIBMEMCACHED}${LTLIBMEMCACHED:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBMEMCACHED; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_DONTWAIT" >&5 +$as_echo_n "checking for MSG_DONTWAIT... " >&6; } +if test "${ac_cv_msg_dontwait+set}" = set; then : + $as_echo_n "(cached) " >&6 +else - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$found_so" - else - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$found_a" - else - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'memcached'; then - LIBMEMCACHED_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'memcached'; then - LIBMEMCACHED_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCMEMCACHED; do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I${srcdir}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +#include - if test "X$x" = "X${i_system}$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCMEMCACHED="${INCMEMCACHED}${INCMEMCACHED:+ }${i_system}$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBMEMCACHED; do +int +main () +{ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +int flags= MSG_DONTWAIT; - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBMEMCACHED; do + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_msg_dontwait=yes +else + ac_cv_msg_dontwait=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBMEMCACHED="${LTLIBMEMCACHED}${LTLIBMEMCACHED:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$dep" - LTLIBMEMCACHED="${LTLIBMEMCACHED}${LTLIBMEMCACHED:+ }$dep" - ;; - esac - done - fi - else - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }-l$name" - LTLIBMEMCACHED="${LTLIBMEMCACHED}${LTLIBMEMCACHED:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBMEMCACHED="${LIBMEMCACHED}${LIBMEMCACHED:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBMEMCACHED="${LTLIBMEMCACHED}${LTLIBMEMCACHED:+ }-R$found_dir" - done - fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_dontwait" >&5 +$as_echo "$ac_cv_msg_dontwait" >&6; } + if test "x$ac_cv_msg_nosignal" = "xyes"; then : +$as_echo "#define HAVE_MSG_NOSIGNAL 1" >>confdefs.h +fi + if test "x$ac_cv_msg_dontwait" = "xyes"; then : +$as_echo "#define HAVE_MSG_DONTWAIT 1" >>confdefs.h - ac_save_CPPFLAGS="$CPPFLAGS" +fi - for element in $INCMEMCACHED; do - haveit= - for x in $CPPFLAGS; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi +# Checks for programs. +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmemcached" >&5 -$as_echo_n "checking for libmemcached... " >&6; } -if test "${ac_cv_libmemcached+set}" = set; then : + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBMEMCACHED" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done - #include +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ int main () { - - memcached_st memc; - memcached_dump_func *df; - memcached_lib_version(); +#ifndef __GNUC__ + choke me +#endif ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libmemcached=yes +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes else - ac_cv_libmemcached=no + ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_save_LIBS" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libmemcached" >&5 -$as_echo "$ac_cv_libmemcached" >&6; } - if test "$ac_cv_libmemcached" = yes; then - HAVE_LIBMEMCACHED=yes - -$as_echo "#define HAVE_LIBMEMCACHED 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libmemcached" >&5 -$as_echo_n "checking how to link with libmemcached... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBMEMCACHED" >&5 -$as_echo "$LIBMEMCACHED" >&6; } - else - HAVE_LIBMEMCACHED=no - CPPFLAGS="$ac_save_CPPFLAGS" - LIBMEMCACHED= - LTLIBMEMCACHED= - LIBMEMCACHED_PREFIX= - fi - - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ac_cv_libmemcached="no" +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x$ac_enable_libmemcached" = "xyes"; then : - - - - - +depcc="$CXX" am_compiler_list= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi - use_additional=yes - if test "x$GCC" = "xyes" -a "x" = "xsystem" - then - i_system="-isystem " - else - i_system="-I" +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done + done +IFS=$as_save_IFS +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + test -n "$AWK" && break +done +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : -# Check whether --with-libmemcachedprotocol-prefix was given. -if test "${with_libmemcachedprotocol_prefix+set}" = set; then : - withval=$with_libmemcachedprotocol_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + done + ac_cv_prog_CPP=$CPP - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : +else + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.$ac_ext - LIBMEMCACHEDPROTOCOL= - LTLIBMEMCACHEDPROTOCOL= - INCMEMCACHEDPROTOCOL= - LIBMEMCACHEDPROTOCOL_PREFIX= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='memcachedprotocol ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBMEMCACHEDPROTOCOL="${LTLIBMEMCACHEDPROTOCOL}${LTLIBMEMCACHEDPROTOCOL:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBMEMCACHEDPROTOCOL; do + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBMEMCACHEDPROTOCOL="${LTLIBMEMCACHEDPROTOCOL}${LTLIBMEMCACHEDPROTOCOL:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBMEMCACHEDPROTOCOL; do +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$found_so" - else - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$found_a" - else - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'memcachedprotocol'; then - LIBMEMCACHEDPROTOCOL_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'memcachedprotocol'; then - LIBMEMCACHEDPROTOCOL_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCMEMCACHEDPROTOCOL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X${i_system}$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCMEMCACHEDPROTOCOL="${INCMEMCACHEDPROTOCOL}${INCMEMCACHEDPROTOCOL:+ }${i_system}$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBMEMCACHEDPROTOCOL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBMEMCACHEDPROTOCOL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBMEMCACHEDPROTOCOL="${LTLIBMEMCACHEDPROTOCOL}${LTLIBMEMCACHEDPROTOCOL:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$dep" - LTLIBMEMCACHEDPROTOCOL="${LTLIBMEMCACHEDPROTOCOL}${LTLIBMEMCACHEDPROTOCOL:+ }$dep" - ;; - esac - done - fi - else - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }-l$name" - LTLIBMEMCACHEDPROTOCOL="${LTLIBMEMCACHEDPROTOCOL}${LTLIBMEMCACHEDPROTOCOL:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBMEMCACHEDPROTOCOL="${LIBMEMCACHEDPROTOCOL}${LIBMEMCACHEDPROTOCOL:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBMEMCACHEDPROTOCOL="${LTLIBMEMCACHEDPROTOCOL}${LTLIBMEMCACHEDPROTOCOL:+ }-R$found_dir" - done - fi - - - - - - - - ac_save_CPPFLAGS="$CPPFLAGS" - - for element in $INCMEMCACHEDPROTOCOL; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmemcachedprotocol" >&5 -$as_echo_n "checking for libmemcachedprotocol... " >&6; } -if test "${ac_cv_libmemcachedprotocol+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else - - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBMEMCACHEDPROTOCOL" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int -main () -{ - - struct memcached_protocol_st *protocol_handle; - protocol_handle= memcached_protocol_create_instance(); - - ; - return 0; -} + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libmemcachedprotocol=yes -else - ac_cv_libmemcachedprotocol=no +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_save_LIBS" - +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libmemcachedprotocol" >&5 -$as_echo "$ac_cv_libmemcachedprotocol" >&6; } - if test "$ac_cv_libmemcachedprotocol" = yes; then - HAVE_LIBMEMCACHEDPROTOCOL=yes - -$as_echo "#define HAVE_LIBMEMCACHEDPROTOCOL 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libmemcachedprotocol" >&5 -$as_echo_n "checking how to link with libmemcachedprotocol... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBMEMCACHEDPROTOCOL" >&5 -$as_echo "$LIBMEMCACHEDPROTOCOL" >&6; } - else - HAVE_LIBMEMCACHEDPROTOCOL=no - CPPFLAGS="$ac_save_CPPFLAGS" - LIBMEMCACHEDPROTOCOL= - LTLIBMEMCACHEDPROTOCOL= - LIBMEMCACHEDPROTOCOL_PREFIX= - fi - - - - +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ac_cv_libmemcachedprotocol="no" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libmemcached has memcached_server_fn" >&5 -$as_echo_n "checking if libmemcached has memcached_server_fn... " >&6; } -if test "${pandora_cv_libmemcached_server_fn+set}" = set; then : + +# Checks for header files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -memcached_server_fn callbacks[1]; +#include +#include +#include +#include int main () @@ -24168,1647 +25518,1571 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - pandora_cv_libmemcached_server_fn=yes + ac_cv_header_stdc=yes else - pandora_cv_libmemcached_server_fn=no + ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_libmemcached_server_fn" >&5 -$as_echo "$pandora_cv_libmemcached_server_fn" >&6; } - - if test "x$pandora_cv_libmemcached_server_fn" = "xyes"; then : +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -$as_echo "#define HAVE_MEMCACHED_SERVER_FN 1" >>confdefs.h +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : +else + ac_cv_header_stdc=no +fi +rm -f conftest* fi +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : +else + ac_cv_header_stdc=no +fi +rm -f conftest* +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libmemcached is recent enough" >&5 -$as_echo_n "checking if libmemcached is recent enough... " >&6; } -if test "${pandora_cv_recent_libmemcached+set}" = set; then : - $as_echo_n "(cached) " >&6 +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif - if test "x${ac_cv_libmemcached}" = "xno"; then : - - pandora_cv_recent_libmemcached=no +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - if test "x0.39" != "x"; then : +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then - pandora_need_libmemcached_version=`echo "0.39" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d000", $1, $2 ;'` - if test "x${pandora_need_libmemcached_version}" = "x0000000"; then : +$as_echo "#define STDC_HEADERS 1" >>confdefs.h - pandora_cv_recent_libmemcached=yes +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test "${ac_cv_header_sys_wait_h+set}" = set; then : + $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include - -#if !defined(LIBMEMCACHED_VERSION_HEX) || LIBMEMCACHED_VERSION_HEX < 0x${pandora_need_libmemcached_version} -# error libmemcached too old! +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { - + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } - _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - - pandora_cv_recent_libmemcached=yes - + ac_cv_header_sys_wait_h=yes else + ac_cv_header_sys_wait_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } +if test $ac_cv_header_sys_wait_h = yes; then - pandora_cv_recent_libmemcached=no +$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +for ac_header in arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h netinet/tcp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -else +done - pandora_cv_recent_libmemcached=yes +for ac_header in errno.h getopt.h pwd.h signal.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -fi +done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pandora_cv_recent_libmemcached" >&5 -$as_echo "$pandora_cv_recent_libmemcached" >&6; } +for ac_header in stdarg.h stddef.h stdio.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - if test "x${ac_cv_libmemcached}" = "xyes" -a "x${pandora_cv_recent_libmemcached}" = "xyes"; then - HAVE_LIBMEMCACHED_TRUE= - HAVE_LIBMEMCACHED_FALSE='#' -else - HAVE_LIBMEMCACHED_TRUE='#' - HAVE_LIBMEMCACHED_FALSE= fi +done +for ac_header in sys/resource.h sys/stat.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi +done +for ac_header in sys/socket.h sys/types.h sys/utsname.h strings.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - -# Check whether --with-memcached was given. -if test "${with_memcached+set}" = set; then : - withval=$with_memcached; ac_cv_with_memcached="$withval" -else - ac_cv_with_memcached=memcached fi +done - # just ignore the user if --without-memcached is passed.. it is - # only used by make test - if test "x$ac_cv_with_memcached" = "xno"; then : - - ac_cv_with_memcached=memcached - MEMCACHED_BINARY=memcached +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if test "${ac_cv_header_stdbool_h+set}" = set; then : + $as_echo_n "(cached) " >&6 else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test -f "$ac_cv_with_memcached"; then : +#include +#ifndef bool + "error: bool is not defined" +#endif +#ifndef false + "error: false is not defined" +#endif +#if false + "error: false is not 0" +#endif +#ifndef true + "error: true is not defined" +#endif +#if true != 1 + "error: true is not 1" +#endif +#ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" +#endif - MEMCACHED_BINARY=$ac_cv_with_memcached + struct s { _Bool s: 1; _Bool t; } s; -else - - # Extract the first word of "$ac_cv_with_memcached", so it can be a program name with args. -set dummy $ac_cv_with_memcached; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MEMCACHED_BINARY+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - case $MEMCACHED_BINARY in - [\\/]* | ?:[\\/]*) - ac_cv_path_MEMCACHED_BINARY="$MEMCACHED_BINARY" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_MEMCACHED_BINARY="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_MEMCACHED_BINARY" && ac_cv_path_MEMCACHED_BINARY=""no"" - ;; -esac -fi -MEMCACHED_BINARY=$ac_cv_path_MEMCACHED_BINARY -if test -n "$MEMCACHED_BINARY"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MEMCACHED_BINARY" >&5 -$as_echo "$MEMCACHED_BINARY" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +# if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a runtime + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); +# endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; +int +main () +{ + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } +ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define MEMCACHED_BINARY "$MEMCACHED_BINARY" +#define HAVE__BOOL 1 _ACEOF - if test "x$MEMCACHED_BINARY" != "xno"; then - HAVE_MEMCACHED_TRUE= - HAVE_MEMCACHED_FALSE='#' -else - HAVE_MEMCACHED_TRUE='#' - HAVE_MEMCACHED_FALSE= -fi - - - - +fi +if test $ac_cv_header_stdbool_h = yes; then +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h +fi - # Check whether --enable-libpq was given. -if test "${enable_libpq+set}" = set; then : - enableval=$enable_libpq; ac_enable_libpq="$enableval" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : + $as_echo_n "(cached) " >&6 else - ac_enable_libpq="yes" -fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; - if test "x$ac_enable_libpq" = "xyes"; then : + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif - for ac_header in libpq-fe.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "libpq-fe.h" "ac_cv_header_libpq_fe_h" "$ac_includes_default" -if test "x$ac_cv_header_libpq_fe_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPQ_FE_H 1 + ; + return 0; +} _ACEOF - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no fi - -done - - - - - - - - - - - - - - - use_additional=yes - if test "x$GCC" = "xyes" -a "x" = "xsystem" - then - i_system="-isystem " - else - i_system="-I" - fi - - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libpq-prefix was given. -if test "${with_libpq_prefix+set}" = set; then : - withval=$with_libpq_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then - LIBPQ= - LTLIBPQ= - INCPQ= - LIBPQ_PREFIX= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='pq ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBPQ="${LIBPQ}${LIBPQ:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBPQ; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBPQ; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +$as_echo "#define const /**/" >>confdefs.h - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBPQ="${LIBPQ}${LIBPQ:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBPQ="${LIBPQ}${LIBPQ:+ }$found_so" - else - LIBPQ="${LIBPQ}${LIBPQ:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBPQ="${LIBPQ}${LIBPQ:+ }$found_a" - else - LIBPQ="${LIBPQ}${LIBPQ:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'pq'; then - LIBPQ_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'pq'; then - LIBPQ_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCPQ; do +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif - if test "X$x" = "X${i_system}$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCPQ="${INCPQ}${INCPQ:+ }${i_system}$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBPQ; do +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBPQ="${LIBPQ}${LIBPQ:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBPQ; do +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" +case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBPQ="${LIBPQ}${LIBPQ:+ }$dep" - LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }$dep" - ;; - esac - done - fi - else - LIBPQ="${LIBPQ}${LIBPQ:+ }-l$name" - LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBPQ="${LIBPQ}${LIBPQ:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBPQ="${LIBPQ}${LIBPQ:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBPQ="${LTLIBPQ}${LTLIBPQ:+ }-R$found_dir" - done - fi +cat >>confdefs.h <<_ACEOF +#define int32_t $ac_cv_c_int32_t +_ACEOF +;; +esac +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = x""yes; then : +else +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF +fi +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = x""yes; then : +else - ac_save_CPPFLAGS="$CPPFLAGS" +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF - for element in $INCPQ; do - haveit= - for x in $CPPFLAGS; do +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = x""yes; then : - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done +else +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpq" >&5 -$as_echo_n "checking for libpq... " >&6; } -if test "${ac_cv_libpq+set}" = set; then : +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else - - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBPQ" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #ifdef HAVE_LIBPQ_FE_H - # include - #else - # include - #endif +#include +#include +#include int main () { - - PGconn *conn; - conn = PQconnectdb(NULL); - +if ((struct tm *) 0) +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libpq=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes else - ac_cv_libpq=no + ac_cv_header_time=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_save_LIBS" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libpq" >&5 -$as_echo "$ac_cv_libpq" >&6; } - if test "$ac_cv_libpq" = yes; then - HAVE_LIBPQ=yes -$as_echo "#define HAVE_LIBPQ 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +if test "${ac_cv_type_uid_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libpq" >&5 -$as_echo_n "checking how to link with libpq... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPQ" >&5 -$as_echo "$LIBPQ" >&6; } - else - HAVE_LIBPQ=no - CPPFLAGS="$ac_save_CPPFLAGS" - LIBPQ= - LTLIBPQ= - LIBPQ_PREFIX= - fi +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then : + ac_cv_type_uid_t=yes +else + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +$as_echo "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then + +$as_echo "#define uid_t int" >>confdefs.h + + +$as_echo "#define gid_t int" >>confdefs.h + +fi + +ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" +case $ac_cv_c_uint16_t in #( + no|yes) ;; #( + *) + + +cat >>confdefs.h <<_ACEOF +#define uint16_t $ac_cv_c_uint16_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) +$as_echo "#define _UINT32_T 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define uint32_t $ac_cv_c_uint32_t +_ACEOF +;; + esac +ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" +case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) +$as_echo "#define _UINT64_T 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define uint64_t $ac_cv_c_uint64_t +_ACEOF +;; + esac -else +ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" +case $ac_cv_c_uint8_t in #( + no|yes) ;; #( + *) - ac_cv_libpq="no" +$as_echo "#define _UINT8_T 1" >>confdefs.h -fi - if test "x${ac_cv_libpq}" = "xyes"; then - HAVE_LIBPQ_TRUE= - HAVE_LIBPQ_FALSE='#' +cat >>confdefs.h <<_ACEOF +#define uint8_t $ac_cv_c_uint8_t +_ACEOF +;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 +$as_echo_n "checking for working volatile... " >&6; } +if test "${ac_cv_c_volatile+set}" = set; then : + $as_echo_n "(cached) " >&6 else - HAVE_LIBPQ_TRUE='#' - HAVE_LIBPQ_FALSE= -fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ +volatile int x; +int * volatile y = (int *) 0; +return !x && !y; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_volatile=yes +else + ac_cv_c_volatile=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 +$as_echo "$ac_cv_c_volatile" >&6; } +if test $ac_cv_c_volatile = no; then +$as_echo "#define volatile /**/" >>confdefs.h +fi +ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = x""yes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE_PTRDIFF_T 1 +_ACEOF -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : +# Checks for library functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 +$as_echo_n "checking for error_at_line... " >&6; } +if test "${ac_cv_lib_error_at_line+set}" = set; then : $as_echo_n "(cached) " >&6 else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +error_at_line (0, 0, "", 0, "an error occurred"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_error_at_line=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_lib_error_at_line=no fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 +$as_echo "$ac_cv_lib_error_at_line" >&6; } +if test $ac_cv_lib_error_at_line = no; then + case " $LIBOBJS " in + *" error.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS error.$ac_objext" + ;; +esac fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if test "${ac_cv_working_alloca_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_working_alloca_h=yes +else + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if test "${ac_cv_func_alloca_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif - # Check whether --enable-libtokyocabinet was given. -if test "${enable_libtokyocabinet+set}" = set; then : - enableval=$enable_libtokyocabinet; ac_enable_libtokyocabinet="$enableval" +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_alloca_works=yes else - ac_enable_libtokyocabinet="yes" + ac_cv_func_alloca_works=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } +if test $ac_cv_func_alloca_works = yes; then - if test "x$ac_enable_libtokyocabinet" = "xyes"; then : - - - - - - - - - +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext +$as_echo "#define C_ALLOCA 1" >>confdefs.h - use_additional=yes - if test "x$GCC" = "xyes" -a "x" = "xsystem" - then - i_system="-isystem " - else - i_system="-I" - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if test "${ac_cv_os_cray+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + break +fi + done +fi -# Check whether --with-libtokyocabinet-prefix was given. -if test "${with_libtokyocabinet_prefix+set}" = set; then : - withval=$with_libtokyocabinet_prefix; - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if test "${ac_cv_c_stack_direction+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_c_stack_direction=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" +int +main () +{ + return find_stack_direction () < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_stack_direction=1 +else + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 +$as_echo_n "checking for mbstate_t... " >&6; } +if test "${ac_cv_type_mbstate_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +# include +int +main () +{ +mbstate_t x; return sizeof x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_mbstate_t=yes +else + ac_cv_type_mbstate_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 +$as_echo "$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then - LIBTOKYOCABINET= - LTLIBTOKYOCABINET= - INCTOKYOCABINET= - LIBTOKYOCABINET_PREFIX= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='tokyocabinet ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBTOKYOCABINET; do +$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + else - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$acl_hardcode_direct" = yes; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBTOKYOCABINET; do +$as_echo "#define mbstate_t int" >>confdefs.h + + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working POSIX fnmatch" >&5 +$as_echo_n "checking for working POSIX fnmatch... " >&6; } +if test "${ac_cv_func_fnmatch_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Some versions of Solaris, SCO, and the GNU C Library + # have a broken or incompatible fnmatch. + # So we run a test program. If we are cross-compiling, take no chance. + # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. + if test "$cross_compiling" = yes; then : + ac_cv_func_fnmatch_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# define y(a, b, c) (fnmatch (a, b, c) == 0) +# define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH) + +int +main () +{ +return + (!(y ("a*", "abc", 0) + && n ("d*/*1", "d/s/1", FNM_PATHNAME) + && y ("a\\\\bc", "abc", 0) + && n ("a\\\\bc", "abc", FNM_NOESCAPE) + && y ("*x", ".x", 0) + && n ("*x", ".x", FNM_PERIOD) + && 1)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fnmatch_works=yes +else + ac_cv_func_fnmatch_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fnmatch_works" >&5 +$as_echo "$ac_cv_func_fnmatch_works" >&6; } +if test $ac_cv_func_fnmatch_works = yes; then : + rm -f "$ac_config_libobj_dir/fnmatch.h" +else + ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default" +if test "x$ac_cv_have_decl_getenv" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_so" - else - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$found_a" - else - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = 'tokyocabinet'; then - LIBTOKYOCABINET_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = 'tokyocabinet'; then - LIBTOKYOCABINET_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCTOKYOCABINET; do +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV $ac_have_decl +_ACEOF - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +for ac_func in btowc mbsrtowcs mempcpy wmempcpy +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - if test "X$x" = "X${i_system}$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCTOKYOCABINET="${INCTOKYOCABINET}${INCTOKYOCABINET:+ }${i_system}$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBTOKYOCABINET; do +fi +done - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +for ac_header in wchar.h wctype.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBTOKYOCABINET; do +fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +done + +case " $LIBOBJS " in + *" fnmatch.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fnmatch.$ac_objext" + ;; +esac + +ac_config_links="$ac_config_links $ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h" + + +$as_echo "#define fnmatch rpl_fnmatch" >>confdefs.h - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$dep" - LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }$dep" - ;; - esac - done - fi - else - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }-l$name" - LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBTOKYOCABINET="${LIBTOKYOCABINET}${LIBTOKYOCABINET:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBTOKYOCABINET="${LTLIBTOKYOCABINET}${LTLIBTOKYOCABINET:+ }-R$found_dir" - done - fi +fi +for ac_header in vfork.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" +if test "x$ac_cv_header_vfork_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VFORK_H 1 +_ACEOF +fi +done +for ac_func in fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - ac_save_CPPFLAGS="$CPPFLAGS" +fi +done - for element in $INCTOKYOCABINET; do - haveit= - for x in $CPPFLAGS; do +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if test "${ac_cv_func_fork_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_fork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + /* By Ruediger Kuhlmann. */ + return fork () < 0; - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fork_works=yes +else + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtokyocabinet" >&5 -$as_echo_n "checking for libtokyocabinet... " >&6; } -if test "${ac_cv_libtokyocabinet+set}" = set; then : +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if test "${ac_cv_func_vfork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else + if test "$cross_compiling" = yes; then : + ac_cv_func_vfork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIBTOKYOCABINET" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_vfork_works=yes +else + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +$as_echo "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_malloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_malloc_0_nonnull=yes +else + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then : + +$as_echo "#define HAVE_MALLOC 1" >>confdefs.h + +else + $as_echo "#define HAVE_MALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +$as_echo "#define malloc rpl_malloc" >>confdefs.h + +fi -#include -#include +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 +$as_echo_n "checking for working memcmp... " >&6; } +if test "${ac_cv_func_memcmp_working+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_memcmp_working=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default int main () { -const char *test= tcversion; -bool ret= tcadboptimize(NULL, "params"); + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = '\100', c1 = '\200', c2 = '\201'; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + return 1; + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + return 1; + } + return 0; + } ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_libtokyocabinet=yes +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_memcmp_working=yes else - ac_cv_libtokyocabinet=no + ac_cv_func_memcmp_working=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libtokyocabinet" >&5 -$as_echo "$ac_cv_libtokyocabinet" >&6; } - if test "$ac_cv_libtokyocabinet" = yes; then - HAVE_LIBTOKYOCABINET=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 +$as_echo "$ac_cv_func_memcmp_working" >&6; } +test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" + ;; +esac -$as_echo "#define HAVE_LIBTOKYOCABINET 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libtokyocabinet" >&5 -$as_echo_n "checking how to link with libtokyocabinet... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBTOKYOCABINET" >&5 -$as_echo "$LIBTOKYOCABINET" >&6; } - else - HAVE_LIBTOKYOCABINET=no - CPPFLAGS="$ac_save_CPPFLAGS" - LIBTOKYOCABINET= - LTLIBTOKYOCABINET= - LIBTOKYOCABINET_PREFIX= - fi +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 +$as_echo_n "checking for GNU libc compatible realloc... " >&6; } +if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_realloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *realloc (); +#endif + +int +main () +{ +return ! realloc (0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_realloc_0_nonnull=yes +else + ac_cv_func_realloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } +if test $ac_cv_func_realloc_0_nonnull = yes; then : +$as_echo "#define HAVE_REALLOC 1" >>confdefs.h +else + $as_echo "#define HAVE_REALLOC 0" >>confdefs.h + case " $LIBOBJS " in + *" realloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realloc.$ac_objext" + ;; +esac +$as_echo "#define realloc rpl_realloc" >>confdefs.h +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if test "${ac_cv_type_signal+set}" = set; then : + $as_echo_n "(cached) " >&6 else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include - ac_cv_libtokyocabinet="no" - +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } - if test "${ac_cv_libtokyocabinet}" = "no" -a "${ac_enable_libtokyocabinet}" = "yes"; then : - - +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBTOKYOCABINET" >&5 -$as_echo_n "checking for LIBTOKYOCABINET... " >&6; } -if test -n "$PKG_CONFIG"; then - if test -n "$LIBTOKYOCABINET_CFLAGS"; then - pkg_cv_LIBTOKYOCABINET_CFLAGS="$LIBTOKYOCABINET_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtokyocabinet >= 1.4.15\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libtokyocabinet >= 1.4.15") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBTOKYOCABINET_CFLAGS=`$PKG_CONFIG --cflags "libtokyocabinet >= 1.4.15" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$LIBTOKYOCABINET_LIBS"; then - pkg_cv_LIBTOKYOCABINET_LIBS="$LIBTOKYOCABINET_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtokyocabinet >= 1.4.15\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libtokyocabinet >= 1.4.15") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBTOKYOCABINET_LIBS=`$PKG_CONFIG --libs "libtokyocabinet >= 1.4.15" 2>/dev/null` -else - pkg_failed=yes -fi - fi +ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" +if test "x$ac_cv_have_decl_strerror_r" = x""yes; then : + ac_have_decl=1 else - pkg_failed=untried + ac_have_decl=0 fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R $ac_have_decl +_ACEOF +for ac_func in strerror_r +do : + ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" +if test "x$ac_cv_func_strerror_r" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRERROR_R 1 +_ACEOF -if test $pkg_failed = yes; then - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no fi - if test $_pkg_short_errors_supported = yes; then - LIBTOKYOCABINET_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libtokyocabinet >= 1.4.15"` - else - LIBTOKYOCABINET_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libtokyocabinet >= 1.4.15"` - fi - # Put the nasty error message in config.log where it belongs - echo "$LIBTOKYOCABINET_PKG_ERRORS" >&5 +done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - test x = y -elif test $pkg_failed = untried; then - test x = y +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +$as_echo_n "checking whether strerror_r returns char *... " >&6; } +if test "${ac_cv_func_strerror_r_char_p+set}" = set; then : + $as_echo_n "(cached) " >&6 else - LIBTOKYOCABINET_CFLAGS=$pkg_cv_LIBTOKYOCABINET_CFLAGS - LIBTOKYOCABINET_LIBS=$pkg_cv_LIBTOKYOCABINET_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ac_cv_libtokyocabinet=yes - LTLIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS} - LIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS} + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ -fi + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_func_strerror_r_char_p=yes fi - - if test "${ac_cv_libtokyocabinet}" = "yes"; then - HAVE_LIBTOKYOCABINET_TRUE= - HAVE_LIBTOKYOCABINET_FALSE='#' +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then : + : else - HAVE_LIBTOKYOCABINET_TRUE='#' - HAVE_LIBTOKYOCABINET_FALSE= + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + extern char *strerror_r (); +int +main () +{ +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +$as_echo "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then - - - - -for ac_header in errno.h fcntl.h getopt.h netinet/tcp.h pwd.h signal.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi -done - -for ac_header in stdarg.h stddef.h stdio.h stdlib.h string.h +for ac_func in vprintf do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : + ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" +if test "x$ac_cv_func_vprintf" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_VPRINTF 1 _ACEOF -fi - -done +ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = x""yes; then : -for ac_header in sys/resource.h sys/stat.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi +fi done -for ac_header in sys/socket.h sys/types.h sys/utsname.h unistd.h strings.h + +for ac_func in dup2 gettimeofday memchr memmove memset socket strcasecmp strdup strerror strncasecmp uname do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi - done - -ac_config_files="$ac_config_files Makefile libgearman/configure.h scripts/gearmand scripts/gearmand-init scripts/gearmand.xml scripts/smf_install.sh support/gearmand.pc support/gearmand.spec" +ac_config_files="$ac_config_files Makefile docs/conf.py libgearman/version.h scripts/gearmand scripts/gearmand-init scripts/gearmand.xml scripts/smf_install.sh support/gearmand.pc support/gearmand.spec" cat >confcache <<\_ACEOF @@ -25894,6 +27168,7 @@ ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -25917,68 +27192,84 @@ fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. + as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error "conditional \"am__fastdepCXX\" was never defined. + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error "conditional \"am__fastdepCXX\" was never defined. +if test -z "${BUILD_WIN32_TRUE}" && test -z "${BUILD_WIN32_FALSE}"; then + as_fn_error $? "conditional \"BUILD_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${TARGET_OSX_TRUE}" && test -z "${TARGET_OSX_FALSE}"; then + as_fn_error $? "conditional \"TARGET_OSX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DTRACE_TRUE}" && test -z "${HAVE_DTRACE_FALSE}"; then - as_fn_error "conditional \"HAVE_DTRACE\" was never defined. + as_fn_error $? "conditional \"HAVE_DTRACE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DTRACE_NEEDS_OBJECTS_TRUE}" && test -z "${DTRACE_NEEDS_OBJECTS_FALSE}"; then - as_fn_error "conditional \"DTRACE_NEEDS_OBJECTS\" was never defined. + as_fn_error $? "conditional \"DTRACE_NEEDS_OBJECTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_VALGRIND_TRUE}" && test -z "${HAVE_VALGRIND_FALSE}"; then + as_fn_error $? "conditional \"HAVE_VALGRIND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DPKG_GENSYMBOLS_TRUE}" && test -z "${HAVE_DPKG_GENSYMBOLS_FALSE}"; then - as_fn_error "conditional \"HAVE_DPKG_GENSYMBOLS\" was never defined. + as_fn_error $? "conditional \"HAVE_DPKG_GENSYMBOLS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_LIBEVENT_TRUE}" && test -z "${HAVE_LIBEVENT_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBEVENT\" was never defined. +if test -z "${HAVE_SPHINX_TRUE}" && test -z "${HAVE_SPHINX_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SPHINX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_LIBUUID_TRUE}" && test -z "${HAVE_LIBUUID_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBUUID\" was never defined. +if test -z "${HAVE_RECENT_SPHINX_TRUE}" && test -z "${HAVE_RECENT_SPHINX_FALSE}"; then + as_fn_error $? "conditional \"HAVE_RECENT_SPHINX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_LIBGTEST_TRUE}" && test -z "${HAVE_LIBGTEST_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBGTEST\" was never defined. +if test -z "${HAVE_LIBMEMCACHED_TRUE}" && test -z "${HAVE_LIBMEMCACHED_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBMEMCACHED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_LIBSQLITE3_TRUE}" && test -z "${HAVE_LIBSQLITE3_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBSQLITE3\" was never defined. +if test -z "${HAVE_MEMCACHED_TRUE}" && test -z "${HAVE_MEMCACHED_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MEMCACHED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBDRIZZLE_TRUE}" && test -z "${HAVE_LIBDRIZZLE_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBDRIZZLE\" was never defined. + as_fn_error $? "conditional \"HAVE_LIBDRIZZLE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_LIBMEMCACHED_TRUE}" && test -z "${HAVE_LIBMEMCACHED_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBMEMCACHED\" was never defined. +if test -z "${HAVE_LIBEVENT_TRUE}" && test -z "${HAVE_LIBEVENT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBEVENT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_MEMCACHED_TRUE}" && test -z "${HAVE_MEMCACHED_FALSE}"; then - as_fn_error "conditional \"HAVE_MEMCACHED\" was never defined. +if test -z "${HAVE_LIBUUID_TRUE}" && test -z "${HAVE_LIBUUID_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBUUID\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBSQLITE3_TRUE}" && test -z "${HAVE_LIBSQLITE3_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBSQLITE3\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBPQ_TRUE}" && test -z "${HAVE_LIBPQ_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBPQ\" was never defined. + as_fn_error $? "conditional \"HAVE_LIBPQ\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBTOKYOCABINET_TRUE}" && test -z "${HAVE_LIBTOKYOCABINET_FALSE}"; then - as_fn_error "conditional \"HAVE_LIBTOKYOCABINET\" was never defined. + as_fn_error $? "conditional \"HAVE_LIBTOKYOCABINET\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi @@ -26128,19 +27419,19 @@ (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -26336,7 +27627,7 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -26389,8 +27680,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gearmand $as_me 0.14, which was -generated by GNU Autoconf 2.65. Invocation command line was +This file was extended by gearmand $as_me 0.23, which was +generated by GNU Autoconf 2.66. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -26416,6 +27707,7 @@ # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" +config_links="$ac_config_links" config_commands="$ac_config_commands" _ACEOF @@ -26446,6 +27738,9 @@ Configuration headers: $config_headers +Configuration links: +$config_links + Configuration commands: $config_commands @@ -26455,11 +27750,11 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gearmand config.status 0.14 -configured by $0, generated by GNU Autoconf 2.65, +gearmand config.status 0.23 +configured by $0, generated by GNU Autoconf 2.66, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -26515,7 +27810,7 @@ ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -26524,7 +27819,7 @@ ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -26578,184 +27873,198 @@ sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`' -predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`' -postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`' -predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`' -postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`' -LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`' -GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`' -predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' -postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' -predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' -postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' -compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +fix_srcfile_path_CXX='`$ECHO "$fix_srcfile_path_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + # Quote evaled strings. -for var in SED \ +for var in SHELL \ +ECHO \ +SED \ GREP \ EGREP \ FGREP \ @@ -26779,8 +28088,6 @@ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ @@ -26810,6 +28117,7 @@ libname_spec \ library_names_spec \ soname_spec \ +install_override_mode \ finish_eval \ old_striplib \ striplib \ @@ -26820,6 +28128,7 @@ postdeps \ compiler_lib_search_path \ LD_CXX \ +reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_wl_CXX \ @@ -26845,9 +28154,9 @@ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -26874,6 +28183,7 @@ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ +reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ @@ -26883,9 +28193,9 @@ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -26893,12 +28203,6 @@ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' @@ -26932,8 +28236,10 @@ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "$ac_config_libobj_dir/fnmatch.h") CONFIG_LINKS="$CONFIG_LINKS $ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "libgearman/configure.h") CONFIG_FILES="$CONFIG_FILES libgearman/configure.h" ;; + "docs/conf.py") CONFIG_FILES="$CONFIG_FILES docs/conf.py" ;; + "libgearman/version.h") CONFIG_FILES="$CONFIG_FILES libgearman/version.h" ;; "scripts/gearmand") CONFIG_FILES="$CONFIG_FILES scripts/gearmand" ;; "scripts/gearmand-init") CONFIG_FILES="$CONFIG_FILES scripts/gearmand-init" ;; "scripts/gearmand.xml") CONFIG_FILES="$CONFIG_FILES scripts/gearmand.xml" ;; @@ -26941,7 +28247,7 @@ "support/gearmand.pc") CONFIG_FILES="$CONFIG_FILES support/gearmand.pc" ;; "support/gearmand.spec") CONFIG_FILES="$CONFIG_FILES support/gearmand.spec" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -26953,6 +28259,7 @@ if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi @@ -26979,7 +28286,7 @@ { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -26996,7 +28303,7 @@ fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi @@ -27010,18 +28317,18 @@ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -27110,20 +28417,28 @@ else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -27151,7 +28466,7 @@ if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -27236,11 +28551,11 @@ _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" shift for ac_tag do @@ -27249,7 +28564,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -27277,7 +28592,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -27304,7 +28619,7 @@ case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -27441,22 +28756,22 @@ $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -27467,19 +28782,19 @@ $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -27516,7 +28831,38 @@ } s/.*/./; q'`/stamp-h$_am_stamp_count ;; + :L) + # + # CONFIG_LINK + # + if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then + : + else + # Prefer the file from the source tree if names are identical. + if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then + ac_source=$srcdir/$ac_source + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 +$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + + if test ! -r "$ac_source"; then + as_fn_error $? "$ac_source: file not found" "$LINENO" 5 + fi + rm -f "$ac_file" + + # Try a relative symlink, then a hard link, then a copy. + case $ac_source in + [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; + *) ac_rel_source=$ac_top_build_prefix$ac_source ;; + esac + ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || + ln "$ac_source" "$ac_file" 2>/dev/null || + cp -p "$ac_source" "$ac_file" || + as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 + fi + ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; @@ -27640,7 +28986,8 @@ # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -27688,6 +29035,12 @@ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + # The host system. host_alias=$host_alias host=$host @@ -27737,10 +29090,6 @@ # turn newlines into spaces. NL2SP=$lt_lt_NL2SP -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - # An object symbol dumper. OBJDUMP=$lt_OBJDUMP @@ -27762,6 +29111,9 @@ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + # A C compiler. LTCC=$lt_CC @@ -27783,12 +29135,6 @@ # The name of the directory that contains temporary libtool files. objdir=$objdir -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO - # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD @@ -27851,6 +29197,9 @@ # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds @@ -27890,6 +29239,10 @@ # The linker used to build libraries. LD=$lt_LD +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds @@ -28163,7 +29516,7 @@ func_dirname () { # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else @@ -28174,7 +29527,7 @@ # func_basename file func_basename () { - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` + func_basename_result=`$ECHO "${1}" | $SED "$basename"` } @@ -28187,10 +29540,8 @@ func_stripname () { case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } @@ -28201,20 +29552,20 @@ # func_opt_split func_opt_split () { - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` + func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_xform libobj-or-source func_xform () { - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_arith arithmetic-term... @@ -28275,6 +29626,10 @@ # The linker used to build libraries. LD=$lt_LD_CXX +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX @@ -28431,7 +29786,7 @@ ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -28452,7 +29807,7 @@ exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 @@ -28471,8 +29826,8 @@ echo " * Debug enabled: $with_debug" echo " * Warnings as failure: $ac_cv_warnings_as_errors" echo " * Building with libsqlite3 $ac_cv_libsqlite3" -echo " * Building with libdrizzle $ac_cv_libdrizzle" -echo " * Building with libmemcached $ac_cv_libmemcached" +echo " * Building with libdrizzle $ac_enable_libdrizzle" +echo " * Building with libmemcached $ac_enable_libmemcached" echo " * Building with libpq $ac_cv_libpq" echo " * Building with tokyocabinet $ac_cv_libtokyocabinet" echo "" diff -Nru gearmand-0.14/configure.ac gearmand-0.23/configure.ac --- gearmand-0.14/configure.ac 2010-06-30 20:30:58.000000000 +0200 +++ gearmand-0.23/configure.ac 2011-06-29 22:30:38.000000000 +0200 @@ -1,4 +1,5 @@ # Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day, Monty Taylor # All rights reserved. # @@ -6,13 +7,14 @@ # the COPYING file in this directory for full text. AC_PREREQ(2.59) -AC_INIT([gearmand],[0.14],[https://launchpad.net/gearmand]) -AC_CONFIG_SRCDIR(libgearman/gearman.c) +AC_INIT([gearmand],[0.23],[https://launchpad.net/gearmand]) +AC_CONFIG_SRCDIR(libgearman/gearman.cc) AC_CONFIG_AUX_DIR(config) +AC_CONFIG_MACRO_DIR(m4) -PANDORA_CANONICAL_TARGET(require-cxx) +PANDORA_CANONICAL_TARGET(require-cxx, no-vc-changelog) -GEARMAN_LIBRARY_VERSION=4:0:0 +GEARMAN_LIBRARY_VERSION=6:0:0 # | | | # +------+ | +---+ # | | | @@ -26,29 +28,74 @@ # +- increment if interfaces have been added, removed or changed AC_SUBST(GEARMAN_LIBRARY_VERSION) +BOOST_REQUIRE(1.39.0) +BOOST_PROGRAM_OPTIONS(mt-) + +WITH_LIBMEMCACHED +WITH_MEMCACHED +WITH_LIBDRIZZLE PANDORA_REQUIRE_PTHREAD PANDORA_REQUIRE_LIBEVENT PANDORA_REQUIRE_LIBUUID -PANDORA_HAVE_LIBGTEST PANDORA_HAVE_BETTER_MALLOC PANDORA_HAVE_LIBSQLITE3 -PANDORA_HAVE_LIBDRIZZLE -PANDORA_HAVE_LIBMEMCACHED(0.39) -PANDORA_HAVE_MEMCACHED PANDORA_HAVE_LIBPQ PANDORA_HAVE_LIBTOKYOCABINET +AC_FUNC_STRERROR_R +SOCKET_SEND_FLAGS - -AC_CHECK_HEADERS(errno.h fcntl.h getopt.h netinet/tcp.h pwd.h signal.h) -AC_CHECK_HEADERS(stdarg.h stddef.h stdio.h stdlib.h string.h) +# Checks for programs. +AC_PROG_CXX +AC_PROG_AWK +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_RANLIB + +# Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h netinet/tcp.h) +AC_CHECK_HEADERS(errno.h getopt.h pwd.h signal.h) +AC_CHECK_HEADERS(stdarg.h stddef.h stdio.h) AC_CHECK_HEADERS(sys/resource.h sys/stat.h) -AC_CHECK_HEADERS(sys/socket.h sys/types.h sys/utsname.h unistd.h strings.h) +AC_CHECK_HEADERS(sys/socket.h sys/types.h sys/utsname.h strings.h) +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_TYPE_INT32_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_HEADER_TIME +AC_TYPE_UID_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_C_VOLATILE +AC_CHECK_TYPES([ptrdiff_t]) + +# Checks for library functions. +AC_FUNC_ERROR_AT_LINE +AC_REPLACE_FNMATCH +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_REALLOC +AC_TYPE_SIGNAL +AC_FUNC_STRERROR_R +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([dup2 gettimeofday memchr memmove memset socket strcasecmp strdup strerror strncasecmp uname]) AC_CONFIG_FILES(Makefile - libgearman/configure.h + docs/conf.py + libgearman/version.h scripts/gearmand scripts/gearmand-init scripts/gearmand.xml @@ -69,8 +116,8 @@ echo " * Debug enabled: $with_debug" echo " * Warnings as failure: $ac_cv_warnings_as_errors" echo " * Building with libsqlite3 $ac_cv_libsqlite3" -echo " * Building with libdrizzle $ac_cv_libdrizzle" -echo " * Building with libmemcached $ac_cv_libmemcached" +echo " * Building with libdrizzle $ac_enable_libdrizzle" +echo " * Building with libmemcached $ac_enable_libmemcached" echo " * Building with libpq $ac_cv_libpq" echo " * Building with tokyocabinet $ac_cv_libtokyocabinet" echo "" diff -Nru gearmand-0.14/COPYING gearmand-0.23/COPYING --- gearmand-0.14/COPYING 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/COPYING 2011-03-10 22:10:26.000000000 +0100 @@ -1,4 +1,5 @@ Gearman server and library +Copyright (C) 2011 Data Differential, http://datadifferential.com/ Copyright (C) 2008 Brian Aker, Eric Day All rights reserved. diff -Nru gearmand-0.14/debian/changelog gearmand-0.23/debian/changelog --- gearmand-0.14/debian/changelog 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/changelog 2011-07-21 14:14:17.000000000 +0200 @@ -1,3 +1,11 @@ +gearmand (0.23-0ubuntu1) oneiric; urgency=low + + * New upstream release. (LP: #682680) + * Drop ipv6 patch as this is fixed upstream. + * debian/control: update/added build-deps. + + -- Jean-Louis Dupond Thu, 21 Jul 2011 12:28:44 +0200 + gearmand (0.14-1) unstable; urgency=low * New upstream release. (Closes: #590116) diff -Nru gearmand-0.14/debian/control gearmand-0.23/debian/control --- gearmand-0.14/debian/control 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/control 2011-07-21 14:12:55.000000000 +0200 @@ -1,8 +1,9 @@ Source: gearmand Section: misc Priority: optional -Maintainer: Monty Taylor -Build-Depends: debhelper (>= 7.0.50), libevent-dev, uuid-dev, libdrizzle-dev (>= 0.3), doxygen, libmemcached-dev (>= 0.30), libsqlite3-dev, libpq-dev, memcached, procps, automake, autoconf, libtool +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Monty Taylor +Build-Depends: debhelper (>= 7.0.50), pkg-config, libevent-dev, uuid-dev, libdrizzle-dev (>= 0.3), doxygen, libmemcached-dev (>= 0.30), libsqlite3-dev, libpq-dev, memcached, procps, automake, autoconf, libtool, libboost-dev, libboost-program-options-dev, libtokyocabinet-dev Standards-Version: 3.9.1 Homepage: http://launchpad.net/gearmand Vcs-Browser: http://bazaar.launchpad.net/~gearman-developers/debian/sid/gearmand/sid/files diff -Nru gearmand-0.14/debian/docs gearmand-0.23/debian/docs --- gearmand-0.14/debian/docs 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/docs 2011-07-21 12:58:58.000000000 +0200 @@ -1,2 +1,6 @@ +AUTHORS +COPYING +HACKING NEWS README +THANKS diff -Nru gearmand-0.14/debian/libgearman-doc.doc-base.api gearmand-0.23/debian/libgearman-doc.doc-base.api --- gearmand-0.14/debian/libgearman-doc.doc-base.api 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/libgearman-doc.doc-base.api 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -Document: libgearman-api -Title: libgearman API Documentation -Author: Eric Day -Abstract: Public API doxygen descriptions for libgearman -Section: Programming/C - -Format: HTML -Index: /usr/share/doc/libgearman-doc/api/html/index.html -Files: /usr/share/doc/libgearman-doc/api/html/*.html diff -Nru gearmand-0.14/debian/libgearman-doc.doc-base.dev gearmand-0.23/debian/libgearman-doc.doc-base.dev --- gearmand-0.14/debian/libgearman-doc.doc-base.dev 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/libgearman-doc.doc-base.dev 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -Document: libgearman-dev -Title: libgearman Developer Documentation -Author: Eric Day -Abstract: Internal developer doxygen descriptions for libgearman -Section: Programming/C - -Format: HTML -Index: /usr/share/doc/libgearman-doc/dev/html/index.html -Files: /usr/share/doc/libgearman-doc/dev/html/*.html diff -Nru gearmand-0.14/debian/libgearman-doc.docs gearmand-0.23/debian/libgearman-doc.docs --- gearmand-0.14/debian/libgearman-doc.docs 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/libgearman-doc.docs 2011-07-21 13:28:32.000000000 +0200 @@ -1,2 +1 @@ -docs/api -docs/dev +docs/man diff -Nru gearmand-0.14/debian/patches/ipv6.patch gearmand-0.23/debian/patches/ipv6.patch --- gearmand-0.14/debian/patches/ipv6.patch 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/patches/ipv6.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -Description: Fix sockaddr storage for IPv6 addresses. -Forwarded: Fixed in trunk -Author: Stig Sandbeck Mathisen -Last-Update: 2011-01-21 -Index: gearmand-0.14/libgearman-server/gearmand.c -=================================================================== ---- gearmand-0.14.orig/libgearman-server/gearmand.c 2010-12-14 10:55:02.444346085 +0100 -+++ gearmand-0.14/libgearman-server/gearmand.c 2010-12-14 10:56:00.414345977 +0100 -@@ -500,14 +500,14 @@ - void *arg) - { - gearmand_port_st *port= (gearmand_port_st *)arg; -- struct sockaddr sa; -+ struct sockaddr_storage sa; - socklen_t sa_len; - char host[NI_MAXHOST]; - char port_str[NI_MAXSERV]; - int ret; - - sa_len= sizeof(sa); -- fd= accept(fd, &sa, &sa_len); -+ fd= accept(fd, (struct sockaddr *)&sa, &sa_len); - if (fd == -1) - { - if (errno == EINTR) diff -Nru gearmand-0.14/debian/patches/series gearmand-0.23/debian/patches/series --- gearmand-0.14/debian/patches/series 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -ipv6.patch diff -Nru gearmand-0.14/debian/rules gearmand-0.23/debian/rules --- gearmand-0.14/debian/rules 2011-02-05 18:21:46.000000000 +0100 +++ gearmand-0.23/debian/rules 2011-07-21 12:57:40.000000000 +0200 @@ -15,10 +15,6 @@ $(MAKE) test endif -override_dh_auto_build: - dh_auto_build - $(MAKE) docs - override_dh_installchangelogs: dh_installchangelogs ChangeLog diff -Nru gearmand-0.14/docs/api_header.html gearmand-0.23/docs/api_header.html --- gearmand-0.14/docs/api_header.html 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/api_header.html 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ - - -$title - - -

Gearman Public API Documentation

diff -Nru gearmand-0.14/docs/conf.py.in gearmand-0.23/docs/conf.py.in --- gearmand-0.14/docs/conf.py.in 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/conf.py.in 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,378 @@ +# -*- coding: utf-8 -*- +# +# Gearmand documentation build configuration file, created by +# sphinx-quickstart on Sun Mar 6 12:05:53 2011. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [] + +extensions = ['sphinxcontrib.googleanalytics'] + +# Google +googleanalytics_id = 'UA-23928702-1' +googleanalytics_enabled = 'True' + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Gearmand' +copyright = u'2011, Data Differential, http://datadifferential.com/' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '@VERSION@' +# The full version, including alpha/beta/rc tags. +release = '@VERSION@' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'colorful' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +html_favicon = '' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +html_show_sourcelink = False + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'gearmandoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'libmemcached.tex', u'libmemcached Documentation', + u'Brian Aker', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples + +# (source start file, name, description, authors, manual section). +man_pages = [ + ('bin/gearadmin', 'gearadmin', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 1), + ('bin/gearman', 'gearman', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 1), + ('gearmand', 'gearmand', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 8), + ('libgearman', 'libgearman', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_actions_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_clear_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_complete_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_context', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_created_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_data_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_exception_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_fail_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_status_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_actions_t', 'gearman_client_set_warning_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_argument_t', 'gearman_argument_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_argument_t', 'gearman_argument_make', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_allocator_t', 'gearman_allocator_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_allocator_t', 'gearman_client_set_memory_allocators', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_allocator_t', 'gearman_worker_set_memory_allocators', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_bugreport', 'gearman_bugreport', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client', 'gearman_client_clone', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client', 'gearman_client_create', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client', 'gearman_client_free', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_server', 'gearman_client_add_server', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_server', 'gearman_client_add_servers', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_server', 'gearman_client_remove_servers', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task', 'gearman_client_add_task', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task', 'gearman_client_add_task_high', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task', 'gearman_client_add_task_low', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task_background', 'gearman_client_add_task_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task_background', 'gearman_client_add_task_high_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task_background', 'gearman_client_add_task_low_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_add_task_status', 'gearman_client_add_task_status', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_do', 'gearman_client_do', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_do', 'gearman_client_do_high', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_do', 'gearman_client_do_low', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_do_background', 'gearman_client_do_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_do_background', 'gearman_client_do_high_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_do_background', 'gearman_client_do_low_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_echo', 'gearman_client_echo', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_echo', 'gearman_worker_echo', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_error', 'gearman_client_errno', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_error', 'gearman_client_error', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_job_status', 'gearman_client_job_status', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_options', 'gearman_client_options_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_options', 'gearman_client_add_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_options', 'gearman_client_has_option', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_options', 'gearman_client_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_options', 'gearman_client_remove_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_options', 'gearman_client_set_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_run_tasks', 'gearman_client_run_tasks', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_set_log_fn', 'gearman_client_set_log_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_set_log_fn', 'gearman_worker_set_log_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_context', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_do_job_handle', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_do_status', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_set_task_context_free_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_set_timeout', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_set_workload_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_set_workload_free_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_set_workload_malloc_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_st', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_task_free_all', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_st', 'gearman_client_timeout', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_client_wait', 'gearman_client_wait', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_execute', 'gearman_execute', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_handle_t', 'gearman_job_handle_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_free', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_free_all', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_function_name', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_handle', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_send_complete', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_send_data', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_send_exception', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_send_fail', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_send_status', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_send_warning', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_st', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_take_workload', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_unique', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_workload', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_job_st', 'gearman_job_workload_size', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_log_fn', 'gearman_log_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_parse_servers', 'gearman_parse_servers', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_boolean', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_integer', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_is_null', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_size', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_size', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_store_integer', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_store_string', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_store_value', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_result_t', 'gearman_result_string', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_return_t', 'gearman_continue', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_return_t', 'gearman_failed', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_return_t', 'gearman_return_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_return_t', 'gearman_strerror', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_return_t', 'gearman_success', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_string_t', 'gearman_string_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_error', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_return', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_context', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_data', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_data_size', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_denominator', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_free', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_function_name', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_give_workload', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_is_known', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_is_running', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_job_handle', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_numerator', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_recv_data', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_send_workload', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_set_context', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_st', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_take_data', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_st', 'gearman_task_unique', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_verbose_t', 'gearman_verbose_name', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_verbose_t', 'gearman_verbose_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_version', 'gearman_version', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_attr_t', 'gearman_task_attr_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_attr_t', 'gearman_task_attr_init', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_attr_t', 'gearman_task_attr_init_epoch', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_task_attr_t', 'gearman_task_attr_init_background', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_add_server', 'gearman_worker_add_server', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_add_server', 'gearman_worker_add_servers', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_add_server', 'gearman_worker_remove_servers', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_create', 'gearman_worker_clone', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_create', 'gearman_worker_create', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_create', 'gearman_worker_free', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_define_function', 'gearman_worker_define_function', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_error', 'gearman_worker_errno', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_error', 'gearman_worker_error', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_options', 'gearman_worker_options_t', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_options', 'gearman_worker_add_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_options', 'gearman_worker_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_options', 'gearman_worker_remove_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_options', 'gearman_worker_set_options', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_set_log_fn', 'gearman_worker_set_log_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_add_function', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_context', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_function_exist', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_grab_job', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_register', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_set_context', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_set_timeout', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_set_workload_free_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_set_workload_malloc_fn', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_st', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_timeout', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_unregister', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_unregister_all', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_wait', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/gearman_worker_st', 'gearman_worker_work', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/namespace', 'gearman_client_set_namespace', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ('libgearman/namespace', 'gearman_worker_set_namespace', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://datadifferential.com/'], 3), + ] diff -Nru gearmand-0.14/docs/dev_header.html gearmand-0.23/docs/dev_header.html --- gearmand-0.14/docs/dev_header.html 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/dev_header.html 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ - - -$title - - -

Gearman Developer Documentation

diff -Nru gearmand-0.14/docs/Doxyfile.api gearmand-0.23/docs/Doxyfile.api --- gearmand-0.14/docs/Doxyfile.api 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/Doxyfile.api 1970-01-01 01:00:00.000000000 +0100 @@ -1,1445 +0,0 @@ -# Doxyfile 1.5.6 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = docs/api - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, -# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, -# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, -# and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = NO - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = docs/doxygen.h \ - libgearman/constants.h \ - libgearman/client.h \ - libgearman/task.h \ - libgearman/worker.h \ - libgearman/job.h \ - libgearman/gearman.h \ - libgearman/conn.h \ - libgearman/packet.h \ - libgearman-server/constants.h \ - libgearman-server/client.h \ - libgearman-server/conf.h \ - libgearman-server/conf_module.h \ - libgearman-server/conn.h \ - libgearman-server/function.h \ - libgearman-server/job.h \ - libgearman-server/packet.h \ - libgearman-server/server.h \ - libgearman-server/thread.h \ - libgearman-server/worker.h \ - libgearman-server/protocol_http.h \ - libgearman-server/queue_libdrizzle.h \ - libgearman-server/queue_libmemcached.h \ - libgearman-server/queue_libpq.h \ - libgearman-server/queue_libsqlite3.h \ - libgearman-server/gearmand.h \ - libgearman-server/gearmand_con.h \ - libgearman-server/gearmand_thread.h \ - examples - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.h *.c - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = docs/api_header.html - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to FRAME, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. Other possible values -# for this tag are: HIERARCHIES, which will generate the Groups, Directories, -# and Class Hiererachy pages using a tree view instead of an ordered list; -# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which -# disables this behavior completely. For backwards compatibility with previous -# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE -# respectively. - -GENERATE_TREEVIEW = NONE - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = GEARMAN_API= - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is enabled by default, which results in a transparent -# background. Warning: Depending on the platform used, enabling this option -# may lead to badly anti-aliased labels on the edges of a graph (i.e. they -# become hard to read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff -Nru gearmand-0.14/docs/Doxyfile.dev gearmand-0.23/docs/Doxyfile.dev --- gearmand-0.14/docs/Doxyfile.dev 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/Doxyfile.dev 1970-01-01 01:00:00.000000000 +0100 @@ -1,1447 +0,0 @@ -# Doxyfile 1.5.6 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = docs/dev - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, -# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, -# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, -# and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = NO - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = docs/doxygen.h \ - libgearman/constants.h \ - libgearman/client.h \ - libgearman/task.h \ - libgearman/worker.h \ - libgearman/job.h \ - libgearman/gearman.h \ - libgearman/conn.h \ - libgearman/packet.h \ - libgearman \ - libgearman-server/constants.h \ - libgearman-server/client.h \ - libgearman-server/conf.h \ - libgearman-server/conf_module.h \ - libgearman-server/conn.h \ - libgearman-server/function.h \ - libgearman-server/job.h \ - libgearman-server/packet.h \ - libgearman-server/server.h \ - libgearman-server/thread.h \ - libgearman-server/worker.h \ - libgearman-server/protocol_http.h \ - libgearman-server/queue_libdrizzle.h \ - libgearman-server/queue_libmemcached.h \ - libgearman-server/queue_libpq.h \ - libgearman-server/queue_libsqlite3.h \ - libgearman-server/gearmand.h \ - libgearman-server/gearmand_con.h \ - libgearman-server/gearmand_thread.h \ - libgearman-server \ - examples - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.h *.c - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = docs/dev_header.html - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to FRAME, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. Other possible values -# for this tag are: HIERARCHIES, which will generate the Groups, Directories, -# and Class Hiererachy pages using a tree view instead of an ordered list; -# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which -# disables this behavior completely. For backwards compatibility with previous -# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE -# respectively. - -GENERATE_TREEVIEW = NONE - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = GEARMAN_API= - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is enabled by default, which results in a transparent -# background. Warning: Depending on the platform used, enabling this option -# may lead to badly anti-aliased labels on the edges of a graph (i.e. they -# become hard to read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff -Nru gearmand-0.14/docs/doxygen.h gearmand-0.23/docs/doxygen.h --- gearmand-0.14/docs/doxygen.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/doxygen.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,213 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Main page for Doxygen - */ - -/** -@mainpage Gearman Library - -http://gearman.org/ - -Gearman is, at the most basic level, a job queuing system. It can be -used to farm out work to other machines, dispatch function calls to -machines that are better suited to do work, to do work in parallel, -to load balance lots of function calls, or to call functions between -languages. - -There are three components: clients, job servers, and workers. Clients -submit jobs to job servers, the job servers find an available worker, -the worker runs the job, and then the result optionally gets sent -back to the client. This package provides the C implementation of -all components. - -One note on tasks vs jobs. A task is usually used in the context of -a client, and a job is usually used in the context of the server and -worker. A task can be a job or other client request such as getting -job status. - -When using the C library for client and worker interfaces, be sure -to handle SIGPIPE. The library does not do this to be sure it does -not interfere with the calling applications signal handling. This -can be done with code such as: - -@code - -if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) -{ - fprintf(stderr, "signal:%d\n", errno); - exit(1); -} - -@endcode - -@anchor main_page_client -@section client Client - -It is best to look at the example source code (in examples/) included -in this package for complete code and error handling. You are able -to use the client interface in one of two ways: to run a single task, -or to run tasks concurrently. - -In either case, you first need to create a client structure and add -job servers to connect to. For example: - -@code - -gearman_client_st client; - -gearman_client_create(&client); - -gearman_client_add_server(&client, "127.0.0.1", 0); - -@endcode - -You can pass either of the host and port fields of -gearman_client_add_server() as NULL and 0 respectively to use the -default values. - -@anchor main_page_client_single -@subsection client_single Single Client Interface - -One you have the client object setup, you can run a single task with: - -@code - -result= gearman_client_do(&client, "function", "argument", strlen("argument"), - &result_size, &ret); - -@endcode - -This will contact the job server, request "function" to be run with -"argument" as the argument, and return the result of that function. The -size of the result is stored in result_size. The return code is stored -in "ret" and should always be checked. - -@anchor main_page_client_concurrent -@subsection client_concurrent Concurrent Client Interface - -If you need to run multiple tasks at the same time, you'll want to -use the concurrent interface. After the client setup, you will then -add tasks to be run. This just queues the task and does not actually -run it. You then call gearman_run_tasks() to submit and process the -jobs in parallel. When using the concurrent interface, you need to -specify callback functions for each action you may care about. For -example, if you want to know when a task completes, you would set a -gearman_complete_fn callback function to be run for each task. - -@code - -static gearman_return_t complete(gearman_task_st *task) -{ - printf("Completed: %s %.*s\n", gearman_task_job_handle(task), - (int)gearman_task_data_size(task), (char *)gearman_task_data(task)); - return GEARMAN_SUCCESS; -} - -static gearman_return_t fail(gearman_task_st *task) -{ - printf("Failed: %s\n", gearman_task_job_handle(task)); - return GEARMAN_SUCCESS; -} - -gearman_client_add_task(&client, &task1, NULL, "function", "argument1", - strlen("argument1"), &ret); -gearman_client_add_task(&client, &task2, NULL, "function", "argument2", - strlen("argument2"), &ret); -gearman_client_set_complete_fn(&client, complete); -gearman_client_set_fail_fn(&client, fail); -gearman_client_run_tasks(&client); - -@endcode - -After adding two tasks, they are run in parallel and the complete() -callback is called when each is done (or fail() if the job failed). - -@anchor main_page_worker -@section worker Worker - -It is best to look at the example source code (in examples/) included -in this package for complete code and error handling. The worker -interface allows you to register functions along with a callback, -and then enter into a loop answering requests from a job server. You -first need to create a worker structure and add job servers to connect -to. For example: - -@code - -gearman_worker_st worker; - -gearman_worker_create(&worker); - -gearman_worker_add_server(&worker, "127.0.0.1", 0); - -@endcode - -You can pass either of the host and port fields of -gearman_worker_add_server() as NULL and 0 respectively to use the -default values. - -Once you have the worker object setup, you then need to register -functions with the job server. For example: - -@code - -gearman_worker_add_function(&worker, "function", 0, function_callback, NULL); - -@endcode - -This notifies all job servers that this worker can perform "function", -and saves the pointer to the "function_callback" in the worker -structure for use in the worker loop. To enter the worker loop, -you would use: - -@code - -while (1) gearman_worker_work(&worker); - -@endcode - -This waits for jobs to be assigned from the job server, and calls -the callback functions associated with the job's function name. This -function also handles all result packet processing back to the job -server once the callback completes. - -The last component of the worker is the callback function. This will look like: - -@code - -void *function_callback(gearman_job_st *job, void *cb_arg, size_t *result_size, - gearman_return_t *ret_ptr) -{ - char *result; - - result= strdup((char *)gearman_job_workload(job)); - *result_size= gearman_job_workload_size(job); - - *ret_ptr= GEARMAN_SUCCESS; - return result; -} - -@endcode - -This worker function simply echos the given string back. The -gearman_job_workload() workload function returns the workload sent from -the client, and gearman_job_workload_size() returns the size of the -workload. The callback function returns the workload to be sent back to -the client, or NULL if there is not any. The result_size pointer must -be set to the size of the workload being returned. The cb_arg argument -is the same pointer that was passed into gearman_worker_add_function(), -and allows the calling application to pass data around. The ret_ptr -argument should be set to the return code of the worker function, -which is normally GEARMAN_SUCCESS. - -See the examples/ directory for the full worker code examples. - -*/ diff -Nru gearmand-0.14/docs/include.am gearmand-0.23/docs/include.am --- gearmand-0.14/docs/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/include.am 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,310 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +# Makefile for Sphinx documentation +# + +SPHINXOPTS = ${SPHINX_WARNINGS} +PAPER = +SPHINX_BUILDDIR = ${top_builddir}/docs + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(SPHINX_BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ${top_srcdir}/docs + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +man1_MANS+= \ + docs/man/gearadmin.1 \ + docs/man/gearman.1 + +man8_MANS+= \ + docs/man/gearmand.8 + +man3_MANS+= \ + docs/man/gearman_allocator_t.3 \ + docs/man/gearman_client_set_memory_allocators.3 \ + docs/man/gearman_worker_set_memory_allocators.3 \ + docs/man/gearman_actions_t.3 \ + docs/man/gearman_argument_make.3 \ + docs/man/gearman_argument_t.3 \ + docs/man/gearman_bugreport.3 \ + docs/man/gearman_client_add_options.3 \ + docs/man/gearman_client_add_server.3 \ + docs/man/gearman_client_add_servers.3 \ + docs/man/gearman_client_add_task.3 \ + docs/man/gearman_client_add_task_background.3 \ + docs/man/gearman_client_add_task_high.3 \ + docs/man/gearman_client_add_task_high_background.3 \ + docs/man/gearman_client_add_task_low.3 \ + docs/man/gearman_client_add_task_low_background.3 \ + docs/man/gearman_client_add_task_status.3 \ + docs/man/gearman_client_clear_fn.3 \ + docs/man/gearman_client_clone.3 \ + docs/man/gearman_client_context.3 \ + docs/man/gearman_client_create.3 \ + docs/man/gearman_client_do.3 \ + docs/man/gearman_client_do_background.3 \ + docs/man/gearman_client_do_high.3 \ + docs/man/gearman_client_do_high_background.3 \ + docs/man/gearman_client_do_job_handle.3 \ + docs/man/gearman_client_do_low.3 \ + docs/man/gearman_client_do_low_background.3 \ + docs/man/gearman_client_do_status.3 \ + docs/man/gearman_client_echo.3 \ + docs/man/gearman_client_errno.3 \ + docs/man/gearman_client_error.3 \ + docs/man/gearman_client_free.3 \ + docs/man/gearman_client_job_status.3 \ + docs/man/gearman_client_options.3 \ + docs/man/gearman_client_remove_options.3 \ + docs/man/gearman_client_remove_servers.3 \ + docs/man/gearman_client_run_tasks.3 \ + docs/man/gearman_client_set_complete_fn.3 \ + docs/man/gearman_client_set_context.3 \ + docs/man/gearman_client_set_created_fn.3 \ + docs/man/gearman_client_set_data_fn.3 \ + docs/man/gearman_client_set_exception_fn.3 \ + docs/man/gearman_client_set_fail_fn.3 \ + docs/man/gearman_client_set_log_fn.3 \ + docs/man/gearman_client_set_namespace.3 \ + docs/man/gearman_client_set_options.3 \ + docs/man/gearman_client_set_status_fn.3 \ + docs/man/gearman_client_set_task_context_free_fn.3 \ + docs/man/gearman_client_set_timeout.3 \ + docs/man/gearman_client_set_warning_fn.3 \ + docs/man/gearman_client_set_workload_fn.3 \ + docs/man/gearman_client_set_workload_free_fn.3 \ + docs/man/gearman_client_set_workload_malloc_fn.3 \ + docs/man/gearman_client_st.3 \ + docs/man/gearman_client_task_free_all.3 \ + docs/man/gearman_client_timeout.3 \ + docs/man/gearman_client_wait.3 \ + docs/man/gearman_continue.3 \ + docs/man/gearman_execute.3 \ + docs/man/gearman_failed.3 \ + docs/man/gearman_job_free.3 \ + docs/man/gearman_job_free_all.3 \ + docs/man/gearman_job_function_name.3 \ + docs/man/gearman_job_handle.3 \ + docs/man/gearman_job_handle_t.3 \ + docs/man/gearman_job_send_complete.3 \ + docs/man/gearman_job_send_data.3 \ + docs/man/gearman_job_send_exception.3 \ + docs/man/gearman_job_send_fail.3 \ + docs/man/gearman_job_send_status.3 \ + docs/man/gearman_job_send_warning.3 \ + docs/man/gearman_job_st.3 \ + docs/man/gearman_job_take_workload.3 \ + docs/man/gearman_job_unique.3 \ + docs/man/gearman_job_workload.3 \ + docs/man/gearman_job_workload_size.3 \ + docs/man/gearman_log_fn.3 \ + docs/man/gearman_parse_servers.3 \ + docs/man/gearman_result_boolean.3 \ + docs/man/gearman_result_integer.3 \ + docs/man/gearman_result_is_null.3 \ + docs/man/gearman_result_size.3 \ + docs/man/gearman_result_store_integer.3 \ + docs/man/gearman_result_store_string.3 \ + docs/man/gearman_result_store_value.3 \ + docs/man/gearman_result_string.3 \ + docs/man/gearman_return_t.3 \ + docs/man/gearman_strerror.3 \ + docs/man/gearman_string_t.3 \ + docs/man/gearman_success.3 \ + docs/man/gearman_task_context.3 \ + docs/man/gearman_task_data.3 \ + docs/man/gearman_task_data_size.3 \ + docs/man/gearman_task_denominator.3 \ + docs/man/gearman_task_error.3 \ + docs/man/gearman_task_free.3 \ + docs/man/gearman_task_function_name.3 \ + docs/man/gearman_task_give_workload.3 \ + docs/man/gearman_task_is_known.3 \ + docs/man/gearman_task_is_running.3 \ + docs/man/gearman_task_job_handle.3 \ + docs/man/gearman_task_numerator.3 \ + docs/man/gearman_task_recv_data.3 \ + docs/man/gearman_task_return.3 \ + docs/man/gearman_task_send_workload.3 \ + docs/man/gearman_task_set_context.3 \ + docs/man/gearman_task_st.3 \ + docs/man/gearman_task_take_data.3 \ + docs/man/gearman_task_unique.3 \ + docs/man/gearman_verbose_name.3 \ + docs/man/gearman_verbose_t.3 \ + docs/man/gearman_version.3 \ + docs/man/gearman_worker_add_function.3 \ + docs/man/gearman_worker_add_options.3 \ + docs/man/gearman_worker_add_server.3 \ + docs/man/gearman_worker_add_servers.3 \ + docs/man/gearman_worker_clone.3 \ + docs/man/gearman_worker_context.3 \ + docs/man/gearman_worker_create.3 \ + docs/man/gearman_worker_define_function.3 \ + docs/man/gearman_worker_echo.3 \ + docs/man/gearman_worker_errno.3 \ + docs/man/gearman_worker_error.3 \ + docs/man/gearman_worker_free.3 \ + docs/man/gearman_worker_function_exist.3 \ + docs/man/gearman_worker_grab_job.3 \ + docs/man/gearman_worker_options.3 \ + docs/man/gearman_worker_register.3 \ + docs/man/gearman_worker_remove_options.3 \ + docs/man/gearman_worker_remove_servers.3 \ + docs/man/gearman_worker_set_context.3 \ + docs/man/gearman_worker_set_log_fn.3 \ + docs/man/gearman_worker_set_namespace.3 \ + docs/man/gearman_worker_set_options.3 \ + docs/man/gearman_worker_set_timeout.3 \ + docs/man/gearman_worker_set_workload_free_fn.3 \ + docs/man/gearman_worker_set_workload_malloc_fn.3 \ + docs/man/gearman_worker_st.3 \ + docs/man/gearman_worker_timeout.3 \ + docs/man/gearman_worker_unregister.3 \ + docs/man/gearman_worker_unregister_all.3 \ + docs/man/gearman_worker_wait.3 \ + docs/man/gearman_worker_work.3 \ + docs/man/gearman_task_attr_init.3 \ + docs/man/gearman_task_attr_init_background.3 \ + docs/man/gearman_task_attr_init_epoch.3 \ + docs/man/gearman_task_attr_t.3 \ + docs/man/gearman_client_options_t.3 \ + docs/man/gearman_client_has_option.3 \ + docs/man/libgearman.3 + +if HAVE_SPHINX +sphinx-help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +html-local: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(SPHINX_BUILDDIR)/html." + +dirhtml: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(SPHINX_BUILDDIR)/dirhtml." + +singlehtml: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(SPHINX_BUILDDIR)/singlehtml." + +pickle: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(SPHINX_BUILDDIR)/htmlhelp." + +qthelp: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(SPHINX_BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(SPHINX_BUILDDIR)/qthelp/Libmemcached.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(SPHINX_BUILDDIR)/qthelp/Libmemcached.qhc" + +devhelp: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/Libmemcached" + @echo "# ln -s $(SPHINX_BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Libmemcached" + @echo "# devhelp" + +epub: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(SPHINX_BUILDDIR)/epub." + +latex: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(SPHINX_BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: latex + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + make -C $(SPHINX_BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(SPHINX_BUILDDIR)/latex." + +text: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(SPHINX_BUILDDIR)/text." + +man: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(SPHINX_BUILDDIR)/man." + +changes: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/changes + @echo + @echo "The overview file is in $(SPHINX_BUILDDIR)/changes." + +linkcheck: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(SPHINX_BUILDDIR)/linkcheck/output.txt." + +doctest: docs/conf.py + PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(SPHINX_BUILDDIR)/doctest/output.txt." + +endif + +noinst_PROGRAMS+= \ + docs/libgearman/examples/gearman_client_do_background_example \ + docs/libgearman/examples/gearman_client_do_example \ + docs/libgearman/examples/gearman_execute_example \ + docs/libgearman/examples/gearman_execute_partition + +docs_libgearman_examples_gearman_execute_example_SOURCES= docs/libgearman/examples/gearman_execute_example.c +docs_libgearman_examples_gearman_execute_example_LDADD= libgearman/libgearman.la + +docs_libgearman_examples_gearman_execute_partition_SOURCES= docs/libgearman/examples/gearman_execute_partition.c +docs_libgearman_examples_gearman_execute_partition_LDADD= libgearman/libgearman.la + +docs_libgearman_examples_gearman_client_do_example_SOURCES= docs/libgearman/examples/gearman_client_do_example.c +docs_libgearman_examples_gearman_client_do_example_LDADD= libgearman/libgearman.la + +docs_libgearman_examples_gearman_client_do_background_example_SOURCES= docs/libgearman/examples/gearman_client_do_background_example.c +docs_libgearman_examples_gearman_client_do_background_example_LDADD= libgearman/libgearman.la diff -Nru gearmand-0.14/docs/libgearman/examples/gearman_client_do_background_example.c gearmand-0.23/docs/libgearman/examples/gearman_client_do_background_example.c --- gearmand-0.14/docs/libgearman/examples/gearman_client_do_background_example.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/libgearman/examples/gearman_client_do_background_example.c 2011-06-18 20:00:16.000000000 +0200 @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_job_handle_t job_handle; + gearman_return_t rc= gearman_client_do_background(client, + "reverse_function", + "unique_value", + "my string to reverse", strlen("my string to reverse"), + job_handle); + + if (gearman_success(rc)) + { + // Make use of value + printf("%s\n", job_handle); + } + + gearman_client_free(client); + + return 0; +} diff -Nru gearmand-0.14/docs/libgearman/examples/gearman_client_do_example.c gearmand-0.23/docs/libgearman/examples/gearman_client_do_example.c --- gearmand-0.14/docs/libgearman/examples/gearman_client_do_example.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/libgearman/examples/gearman_client_do_example.c 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,30 @@ +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + size_t result_size; + gearman_return_t rc; + void *value= gearman_client_do(client, "reverse_function", "unique_value", + "my string to reverse", strlen("my string to reverse"), + &result_size, &rc); + + if (gearman_success(rc)) + { + // Make use of value + } + free(value); + + gearman_client_free(client); + + return 0; +} diff -Nru gearmand-0.14/docs/libgearman/examples/gearman_execute_example.c gearmand-0.23/docs/libgearman/examples/gearman_execute_example.c --- gearmand-0.14/docs/libgearman/examples/gearman_execute_example.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/libgearman/examples/gearman_execute_example.c 2011-06-19 07:37:38.000000000 +0200 @@ -0,0 +1,46 @@ +/* + Example code to show how to send a string to a function called "reverse" and print the results. +*/ + +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_argument_t value= gearman_argument_make(0, 0, "Reverse Me", strlen("Reverse Me")); + + gearman_task_st *task= gearman_execute(client, + "reverse", strlen("reverse"), // function + NULL, 0, // no unique value provided + NULL, + &value, 0); + + if (task == NULL) // If gearman_execute() can return NULL on error + { + fprintf(stderr, "Error: %s\n", gearman_client_error(client)); + gearman_client_free(client); + return EXIT_FAILURE; + } + + // Make sure the task was run successfully + if (gearman_success(gearman_task_return(task))) + { + // Make use of value + gearman_result_st *result= gearman_task_result(task); + printf("%.*s\n", (int)gearman_result_size(result), gearman_result_value(result)); + } + + gearman_client_free(client); + + return EXIT_SUCCESS; +} diff -Nru gearmand-0.14/docs/libgearman/examples/gearman_execute_partition.c gearmand-0.23/docs/libgearman/examples/gearman_execute_partition.c --- gearmand-0.14/docs/libgearman/examples/gearman_execute_partition.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/libgearman/examples/gearman_execute_partition.c 2011-06-19 07:37:45.000000000 +0200 @@ -0,0 +1,49 @@ +/* + Example code to show how to send a string to a function called "word_split", reduce + each chunk with the function count, and then print the results. +*/ + +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_argument_t value= gearman_argument_make(0, 0, "this dog does not hunt", strlen("this dog does not hunt")); + + gearman_task_st *task= gearman_execute_by_partition(client, + "word_split", strlen("word_split"), + "count", strlen("count"), // function + NULL, 0, // no unique value provided + NULL, + &value, 0); + + if (task == NULL) // If gearman_execute() can return NULL on error + { + fprintf(stderr, "Error: %s\n", gearman_client_error(client)); + gearman_client_free(client); + return EXIT_FAILURE; + } + + // Make sure the task was run successfully + if (gearman_success(gearman_task_return(task))) + { + // Make use of value + gearman_result_st *result= gearman_task_result(task); + printf("%.*s\n", (int)gearman_result_size(result), gearman_result_value(result)); + } + + gearman_client_free(client); + + return EXIT_SUCCESS; +} + diff -Nru gearmand-0.14/docs/man/gearadmin.1 gearmand-0.23/docs/man/gearadmin.1 --- gearmand-0.14/docs/man/gearadmin.1 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearadmin.1 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARADMIN" "1" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearadmin \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.sp +Run Administrative commands against a server. +.SH SYNOPSIS +.INDENT 0.0 +.TP +.B \-\-help +. +Provice help about the program. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-create\-function +. +Create a function from the server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h [ \-\-host ] arg (=localhost)i +.sp +Connect to the host +.UNINDENT +.INDENT 0.0 +.TP +.B \-p [ \-\-port ] arg (=4730) +.sp +Port number or service to use for connection +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-drop\-function +. +Drop a function from the server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-server\-version +. +Fetch the version number for the server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-server\-verbose +. +Fetch the verbose setting for the server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-status +. +Status for the server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-workers +. +Workers for the server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-shutdown +. +Shutdown server. +.UNINDENT +.SH DESCRIPTION +.sp +Command line tool for manipulating gearmand servers. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman.1 gearmand-0.23/docs/man/gearman.1 --- gearmand-0.14/docs/man/gearman.1 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman.1 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,154 @@ +.TH "GEARMAN" "1" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.sp +Command line client for Gearmand +.SH SYNOPSIS +.sp +\fBCommon options\fP +.INDENT 0.0 +.TP +.B \-f +.sp +Function name to use for jobs (can give many) +.UNINDENT +.INDENT 0.0 +.TP +.B \-h +.sp +Job server host +.UNINDENT +.INDENT 0.0 +.TP +.B \-H +. +Print this help menu +.UNINDENT +.INDENT 0.0 +.TP +.B \-p +.sp +Gearman server port +.UNINDENT +.INDENT 0.0 +.TP +.B \-t +.sp +Timeout in milliseconds +.UNINDENT +.INDENT 0.0 +.TP +.B \-i +.sp +Create a pidfile for the process +.UNINDENT +.INDENT 0.0 +.TP +.B \-n +. +In client mode run one job per line, in worker mode send data packet for each line +.UNINDENT +.INDENT 0.0 +.TP +.B \-N +. +Same as \-n, but strip off the newline +.UNINDENT +.sp +\fBClient options\fP +.INDENT 0.0 +.TP +.B \-b +. +Run jobs in the background +.UNINDENT +.INDENT 0.0 +.TP +.B \-I +. +Run jobs as high priority +.UNINDENT +.INDENT 0.0 +.TP +.B \-L +. +Run jobs as low priority +.UNINDENT +.INDENT 0.0 +.TP +.B \-P +. +Prefix all output lines with functions names +.UNINDENT +.INDENT 0.0 +.TP +.B \-s +. +Send job without reading from standard input +.UNINDENT +.INDENT 0.0 +.TP +.B \-u +.sp +Unique key to use for job +.UNINDENT +.sp +\fIWorker options*\fP +.INDENT 0.0 +.TP +.B \-c +.sp +Number of jobs for worker to run before exiting +.UNINDENT +.INDENT 0.0 +.TP +.B \-w +. +Run in worker mode +.UNINDENT +.SH DESCRIPTION +.sp +With gearman you can run client and worker functions from the command line. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_actions_t.3 gearmand-0.23/docs/man/gearman_actions_t.3 --- gearmand-0.14/docs/man/gearman_actions_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_actions_t.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_ACTIONS_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_actions_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_allocator_t.3 gearmand-0.23/docs/man/gearman_allocator_t.3 --- gearmand-0.14/docs/man/gearman_allocator_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_allocator_t.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,84 @@ +.TH "GEARMAN_ALLOCATOR_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_allocator_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_allocator_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_malloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_free_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_realloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_calloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_set_memory_allocators(gearman_client_st *, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st *, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context); +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Install callbacks for custom allocation. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. You can use \fBgearman_client_set_memory_allocators()\fP and \fBgearman_worker_set_memory_allocators()\fP to set your own custom allocators. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_argument_make.3 gearmand-0.23/docs/man/gearman_argument_make.3 --- gearmand-0.14/docs/man/gearman_argument_make.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_argument_make.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,60 @@ +.TH "GEARMAN_ARGUMENT_MAKE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_argument_make \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_argument_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_argument_t\fP gearman_argument_make(const char\fI\ *name\fP, const size_t\fI\ name_length\fP, const char\fI\ *value\fP, const size_t\fI\ value_size\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fI\%gearman_argument_make()\fP function initializes \fI\%gearman_argument_t\fP. +.sp +\fI\%gearman_argument_t\fP is an abstraction used passing arguments too \fBgearman_execute()\fP. The arguments are not copied, so any object that is used to initialize \fI\%gearman_argument_t\fP must continue to exist throughout the lifetime/usage of the structure. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_argument_t.3 gearmand-0.23/docs/man/gearman_argument_t.3 --- gearmand-0.14/docs/man/gearman_argument_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_argument_t.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,60 @@ +.TH "GEARMAN_ARGUMENT_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_argument_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_argument_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_argument_t\fP gearman_argument_make(const char\fI\ *name\fP, const size_t\fI\ name_length\fP, const char\fI\ *value\fP, const size_t\fI\ value_size\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fI\%gearman_argument_make()\fP function initializes \fI\%gearman_argument_t\fP. +.sp +\fI\%gearman_argument_t\fP is an abstraction used passing arguments too \fBgearman_execute()\fP. The arguments are not copied, so any object that is used to initialize \fI\%gearman_argument_t\fP must continue to exist throughout the lifetime/usage of the structure. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_bugreport.3 gearmand-0.23/docs/man/gearman_bugreport.3 --- gearmand-0.14/docs/man/gearman_bugreport.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_bugreport.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,62 @@ +.TH "GEARMAN_BUGREPORT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_bugreport \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_bugreport(void) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_bugreport()\fP returns the url to the bug tracking site for Gearmand +.SH RETURN VALUE +.sp +URL +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_options.3 gearmand-0.23/docs/man/gearman_client_add_options.3 --- gearmand-0.14/docs/man/gearman_client_add_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_options.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,105 @@ +.TH "GEARMAN_CLIENT_ADD_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_options_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_client_options_t\fP gearman_client_options(const gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_add_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_client_has_option(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ option\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_options()\fP returns the \fI\%gearman_client_options_t\fP for \fBgearman_client_st\fP. You enable options via \fI\%gearman_client_add_options()\fP and disable options via \fI\%gearman_client_remove_options()\fP. +.sp +\fI\%gearman_client_set_options()\fP has been DEPRECATED. +.sp +The currently supported options are: +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_NON_BLOCKING +.UNINDENT +.sp +Run the cient in a non\-blocking mode. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_FREE_TASKS +.UNINDENT +.sp +Automatically free task objects once they are complete. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_UNBUFFERED_RESULT +.UNINDENT +.sp +Allow the client to read data in chunks rather than have the library buffer +the entire data result and pass that back. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_server.3 gearmand-0.23/docs/man/gearman_client_add_server.3 --- gearmand-0.14/docs/man/gearman_client_add_server.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_server.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,79 @@ +.TH "GEARMAN_CLIENT_ADD_SERVER" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_server \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_add_server(gearman_client_st *client, const char *host, in_port_t port); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_add_servers(gearman_client_st *client, const char *servers); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_servers(gearman_client_st *client); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the client will take work from. +.sp +\fBgearman_client_remove_servers()\fP will remove all servers from the \fBgearman_client_st\fP. +.sp +\fBgearman_client_add_servers()\fP takes a list of \fBgearmand\fP servers that will be parsed to provide servers for the client. The format for this is SERVER[:PORT][,SERVER[:PORT]]... +.INDENT 0.0 +.TP +.B Examples of this are:: +. +10.0.0.1,10.0.0.2,10.0.0.3 +localhost234,jobserver2.domain.com:7003,10.0.0.3 +.UNINDENT +.SH RETURN VALUE +.sp +\fBgearman_client_add_server()\fP and \fBgearman_client_remove_servers()\fP return \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_servers.3 gearmand-0.23/docs/man/gearman_client_add_servers.3 --- gearmand-0.14/docs/man/gearman_client_add_servers.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_servers.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,79 @@ +.TH "GEARMAN_CLIENT_ADD_SERVERS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_servers \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_add_server(gearman_client_st *client, const char *host, in_port_t port); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_add_servers(gearman_client_st *client, const char *servers); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_servers(gearman_client_st *client); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the client will take work from. +.sp +\fBgearman_client_remove_servers()\fP will remove all servers from the \fBgearman_client_st\fP. +.sp +\fBgearman_client_add_servers()\fP takes a list of \fBgearmand\fP servers that will be parsed to provide servers for the client. The format for this is SERVER[:PORT][,SERVER[:PORT]]... +.INDENT 0.0 +.TP +.B Examples of this are:: +. +10.0.0.1,10.0.0.2,10.0.0.3 +localhost234,jobserver2.domain.com:7003,10.0.0.3 +.UNINDENT +.SH RETURN VALUE +.sp +\fBgearman_client_add_server()\fP and \fBgearman_client_remove_servers()\fP return \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task.3 gearmand-0.23/docs/man/gearman_client_add_task.3 --- gearmand-0.14/docs/man/gearman_client_add_task.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_CLIENT_ADD_TASK" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task(gearman_client_st\fI\ *client\fP, gearman_task_st\fI\ *task\fP, void\fI\ *context\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_add_task()\fP creates a task and adds it to the given \fBgearman_client_st\fP. Execution of the task does now begin until \fBgearman_client_run_tasks()\fP is called. +.sp +If the unique value is not set, then a unique will be assigned. +.sp +\fBgearman_client_add_task_high()\fP and \fBgearman_client_add_task_low()\fP are +identical to \fBgearman_client_do()\fP, only they set the priority to +either high or low. +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task_background.3 gearmand-0.23/docs/man/gearman_client_add_task_background.3 --- gearmand-0.14/docs/man/gearman_client_add_task_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task_background.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,88 @@ +.TH "GEARMAN_CLIENT_ADD_TASK_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task_background(gearman_client_st *client, +.TP +.B gearman_task_st *task, +.TP +.B void *context, +.TP +.B const char *function_name, +.TP +.B const char *unique, +.TP +.B const void *workload, +.TP +.B size_t workload_size, +.TP +.B gearman_return_t *ret_ptr) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_add_task_background()\fP creates a background task and adds it ito the given \fBgearman_client_st\fP. Execution of the task does now begin until \fBgearman_client_run_tasks()\fP is called. +.sp +If the unique value is not set, then a unique will be assigned. +.sp +\fBgearman_client_add_task_background_high()\fP and \fBgearman_client_add_task_background_low()\fP are +identical to \fBgearman_client_do()\fP, only they set the priority to +either high or low. +.IP Warning +. +You may wish to avoid using \fBgearman_client_add_task_background()\fP with a stack based allocated +\fBgearman_task_st\fP. The most common issues related to ABI safety involve stack allocated structures. If you use a stack based +\fBgearman_task_st\fP you must free it with \fBgearman_task_free()\fP. +.RE +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task_high.3 gearmand-0.23/docs/man/gearman_client_add_task_high.3 --- gearmand-0.14/docs/man/gearman_client_add_task_high.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task_high.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_CLIENT_ADD_TASK_HIGH" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task_high \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task(gearman_client_st\fI\ *client\fP, gearman_task_st\fI\ *task\fP, void\fI\ *context\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_add_task()\fP creates a task and adds it to the given \fBgearman_client_st\fP. Execution of the task does now begin until \fBgearman_client_run_tasks()\fP is called. +.sp +If the unique value is not set, then a unique will be assigned. +.sp +\fBgearman_client_add_task_high()\fP and \fBgearman_client_add_task_low()\fP are +identical to \fBgearman_client_do()\fP, only they set the priority to +either high or low. +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task_high_background.3 gearmand-0.23/docs/man/gearman_client_add_task_high_background.3 --- gearmand-0.14/docs/man/gearman_client_add_task_high_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task_high_background.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,88 @@ +.TH "GEARMAN_CLIENT_ADD_TASK_HIGH_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task_high_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task_background(gearman_client_st *client, +.TP +.B gearman_task_st *task, +.TP +.B void *context, +.TP +.B const char *function_name, +.TP +.B const char *unique, +.TP +.B const void *workload, +.TP +.B size_t workload_size, +.TP +.B gearman_return_t *ret_ptr) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_add_task_background()\fP creates a background task and adds it ito the given \fBgearman_client_st\fP. Execution of the task does now begin until \fBgearman_client_run_tasks()\fP is called. +.sp +If the unique value is not set, then a unique will be assigned. +.sp +\fBgearman_client_add_task_background_high()\fP and \fBgearman_client_add_task_background_low()\fP are +identical to \fBgearman_client_do()\fP, only they set the priority to +either high or low. +.IP Warning +. +You may wish to avoid using \fBgearman_client_add_task_background()\fP with a stack based allocated +\fBgearman_task_st\fP. The most common issues related to ABI safety involve stack allocated structures. If you use a stack based +\fBgearman_task_st\fP you must free it with \fBgearman_task_free()\fP. +.RE +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task_low.3 gearmand-0.23/docs/man/gearman_client_add_task_low.3 --- gearmand-0.14/docs/man/gearman_client_add_task_low.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task_low.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_CLIENT_ADD_TASK_LOW" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task_low \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task(gearman_client_st\fI\ *client\fP, gearman_task_st\fI\ *task\fP, void\fI\ *context\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_add_task()\fP creates a task and adds it to the given \fBgearman_client_st\fP. Execution of the task does now begin until \fBgearman_client_run_tasks()\fP is called. +.sp +If the unique value is not set, then a unique will be assigned. +.sp +\fBgearman_client_add_task_high()\fP and \fBgearman_client_add_task_low()\fP are +identical to \fBgearman_client_do()\fP, only they set the priority to +either high or low. +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task_low_background.3 gearmand-0.23/docs/man/gearman_client_add_task_low_background.3 --- gearmand-0.14/docs/man/gearman_client_add_task_low_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task_low_background.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,88 @@ +.TH "GEARMAN_CLIENT_ADD_TASK_LOW_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task_low_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task_background(gearman_client_st *client, +.TP +.B gearman_task_st *task, +.TP +.B void *context, +.TP +.B const char *function_name, +.TP +.B const char *unique, +.TP +.B const void *workload, +.TP +.B size_t workload_size, +.TP +.B gearman_return_t *ret_ptr) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_add_task_background()\fP creates a background task and adds it ito the given \fBgearman_client_st\fP. Execution of the task does now begin until \fBgearman_client_run_tasks()\fP is called. +.sp +If the unique value is not set, then a unique will be assigned. +.sp +\fBgearman_client_add_task_background_high()\fP and \fBgearman_client_add_task_background_low()\fP are +identical to \fBgearman_client_do()\fP, only they set the priority to +either high or low. +.IP Warning +. +You may wish to avoid using \fBgearman_client_add_task_background()\fP with a stack based allocated +\fBgearman_task_st\fP. The most common issues related to ABI safety involve stack allocated structures. If you use a stack based +\fBgearman_task_st\fP you must free it with \fBgearman_task_free()\fP. +.RE +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_add_task_status.3 gearmand-0.23/docs/man/gearman_client_add_task_status.3 --- gearmand-0.14/docs/man/gearman_client_add_task_status.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_add_task_status.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_CLIENT_ADD_TASK_STATUS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_add_task_status \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_client_add_task_status(gearman_client_st\fI\ *client\fP, gearman_task_st\fI\ *task\fP, void\fI\ *context\fP, const char\fI\ *job_handle\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_add_task_status()\fP creates a \fBgearman_task_st\fP that can be used to monitor a previously created task. +.IP Warning +. +You may wish to avoid using \fBgearman_client_add_task()\fP with a +stack based allocated \fBgearman_task_st\fP. The most common issues related to ABI safety involve +stack allocated structures. If you use a stack based \fBgearman_task_st\fP you must free it with \fBgearman_task_free()\fP. +.RE +.SH RETURN VALUE +.sp +The \fBgearman_task_st\fP is created and a pointer to it is returned. On error NULL is returned and ret_ptr is set with a \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_clear_fn.3 gearmand-0.23/docs/man/gearman_client_clear_fn.3 --- gearmand-0.14/docs/man/gearman_client_clear_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_clear_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_CLEAR_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_clear_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_clone.3 gearmand-0.23/docs/man/gearman_client_clone.3 --- gearmand-0.14/docs/man/gearman_client_clone.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_clone.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_CLIENT_CLONE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_clone \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st *gearman_client_create(gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_client_st *gearman_client_clone(gearman_client_st\fI\ *client\fP, const gearman_client_st\fI\ *from\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_free(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_create()\fP is used to create a c:type:\fIgearman_client_st\fP structure that will then +be used by other \fBlibgearman()\fP client functions to communicate with the server. You +should either pass a statically declared \fBgearman_client_st\fP to \fI\%gearman_client_create()\fP or +a NULL. If a NULL passed in then a structure is allocated for you. +.sp +\fI\%gearman_client_clone()\fP is similar to \fI\%gearman_client_create()\fP but it copies the +defaults and list of servers from the source \fBgearman_client_st\fP . If you pass a null as +the argument for the source to clone, it is the same as a call to gearman_client_create(). +If the destination argument is NULL a \fBgearman_client_st\fP will be allocated for you. +.sp +To clean up memory associated with a \fBgearman_client_st\fP structure you should pass +it to gearman_client_free() when you are finished using it. \fI\%gearman_client_free()\fP is +the only way to make sure all memory is deallocated when you finish using +the structure. +.IP Warning +. +You may wish to avoid using \fI\%gearman_client_create()\fP or \fI\%gearman_client_clone()\fP with a +stack based allocation, ie the first parameter. The most common issues related to ABI safety involve +stack allocated structures. +.RE +.SH RETURN VALUE +.sp +\fBgearman_client_create()\fP returns a pointer to the gearman_client_st +that was created (or initialized). On an allocation failure, it returns +NULL. +.sp +\fBgearman_client_clone()\fP returns a pointer to the gearman_client_st that was created +(or initialized). On an allocation failure, it returns NULL. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_st(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_context.3 gearmand-0.23/docs/man/gearman_client_context.3 --- gearmand-0.14/docs/man/gearman_client_context.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_context.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_CONTEXT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_context \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_create.3 gearmand-0.23/docs/man/gearman_client_create.3 --- gearmand-0.14/docs/man/gearman_client_create.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_create.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_CLIENT_CREATE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_create \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st *gearman_client_create(gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_client_st *gearman_client_clone(gearman_client_st\fI\ *client\fP, const gearman_client_st\fI\ *from\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_free(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_create()\fP is used to create a c:type:\fIgearman_client_st\fP structure that will then +be used by other \fBlibgearman()\fP client functions to communicate with the server. You +should either pass a statically declared \fBgearman_client_st\fP to \fI\%gearman_client_create()\fP or +a NULL. If a NULL passed in then a structure is allocated for you. +.sp +\fI\%gearman_client_clone()\fP is similar to \fI\%gearman_client_create()\fP but it copies the +defaults and list of servers from the source \fBgearman_client_st\fP . If you pass a null as +the argument for the source to clone, it is the same as a call to gearman_client_create(). +If the destination argument is NULL a \fBgearman_client_st\fP will be allocated for you. +.sp +To clean up memory associated with a \fBgearman_client_st\fP structure you should pass +it to gearman_client_free() when you are finished using it. \fI\%gearman_client_free()\fP is +the only way to make sure all memory is deallocated when you finish using +the structure. +.IP Warning +. +You may wish to avoid using \fI\%gearman_client_create()\fP or \fI\%gearman_client_clone()\fP with a +stack based allocation, ie the first parameter. The most common issues related to ABI safety involve +stack allocated structures. +.RE +.SH RETURN VALUE +.sp +\fBgearman_client_create()\fP returns a pointer to the gearman_client_st +that was created (or initialized). On an allocation failure, it returns +NULL. +.sp +\fBgearman_client_clone()\fP returns a pointer to the gearman_client_st that was created +(or initialized). On an allocation failure, it returns NULL. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_st(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do.3 gearmand-0.23/docs/man/gearman_client_do.3 --- gearmand-0.14/docs/man/gearman_client_do.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,115 @@ +.TH "GEARMAN_CLIENT_DO" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void *gearman_client_do(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t *ret_ptr)\fI\ *client\fP) +.UNINDENT +.sp +Changed in version 0.21: \fBGEARMAN_PAUSE\fP will no longer be returned. A do operation will now run till completion or error. +.INDENT 0.0 +.TP +.B void *gearman_client_do_high(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_do_low(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.SH DESCRIPTION +.sp +\fI\%gearman_client_do()\fP executes a single request to the gearmand +server and waits for a reply. +.sp +\fI\%gearman_client_do_high()\fP and \fI\%gearman_client_do_low()\fP are +identical to \fI\%gearman_client_do()\fP, only they set the priority to +either high or low. +.sp +All of the functions will block until either a response or an error is +returned. +.SH RETURN VALUE +.sp +\fI\%gearman_client_do()\fP returns a pointer to a value that the caller must release. If ret_ptr is provided any errors that have occurred will be stored in it. Since a NULL/zero value is a valid value, you will always need to check ret_ptr if you are concerned with errors. +.SH EXAMPLE +.sp +.nf +.ft C +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + size_t result_size; + gearman_return_t rc; + void *value= gearman_client_do(client, "reverse_function", "unique_value", + "my string to reverse", strlen("my string to reverse"), + &result_size, &rc); + + if (gearman_success(rc)) + { + // Make use of value + } + free(value); + + gearman_client_free(client); + + return 0; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_background.3 gearmand-0.23/docs/man/gearman_client_do_background.3 --- gearmand-0.14/docs/man/gearman_client_do_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_background.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,119 @@ +.TH "GEARMAN_CLIENT_DO_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, char *job_handle); +.UNINDENT +.sp +Changed in version 0.21: \fBGEARMAN_PAUSE\fP will no longer be returned. A do operation will now run until it has been submitted. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_high_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_job_handle_t job_handle); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_low_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_job_handle_t job_handle); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_do_background()\fP executes a single request to the +gearmand server and returns the status via \fBgearman_return_t\fP. +.sp +\fBgearman_client_do_background_high()\fP and +\fBgearman_client_do_background_low()\fP are identical to +\fBgearman_client_do_background()\fP, only they set the \fBgearman_priority_t\fP to either +high or low. +.sp +If job_handle is not NULL, it will be populated with the name of the job_handle +for the task created. The job handle needs to be the size of +\fBGEARMAN_JOB_HANDLE_SIZE\fP. Please see \fBgearman_job_handle_t\fP for more information. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH EXAMPLE +.sp +.nf +.ft C +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_job_handle_t job_handle; + gearman_return_t rc= gearman_client_do_background(client, + "reverse_function", + "unique_value", + "my string to reverse", strlen("my string to reverse"), + job_handle); + + if (gearman_success(rc)) + { + // Make use of value + printf("%s\en", job_handle); + } + + gearman_client_free(client); + + return 0; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_high.3 gearmand-0.23/docs/man/gearman_client_do_high.3 --- gearmand-0.14/docs/man/gearman_client_do_high.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_high.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,115 @@ +.TH "GEARMAN_CLIENT_DO_HIGH" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_high \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void *gearman_client_do(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t *ret_ptr)\fI\ *client\fP) +.UNINDENT +.sp +Changed in version 0.21: \fBGEARMAN_PAUSE\fP will no longer be returned. A do operation will now run till completion or error. +.INDENT 0.0 +.TP +.B void *gearman_client_do_high(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_do_low(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.SH DESCRIPTION +.sp +\fI\%gearman_client_do()\fP executes a single request to the gearmand +server and waits for a reply. +.sp +\fI\%gearman_client_do_high()\fP and \fI\%gearman_client_do_low()\fP are +identical to \fI\%gearman_client_do()\fP, only they set the priority to +either high or low. +.sp +All of the functions will block until either a response or an error is +returned. +.SH RETURN VALUE +.sp +\fI\%gearman_client_do()\fP returns a pointer to a value that the caller must release. If ret_ptr is provided any errors that have occurred will be stored in it. Since a NULL/zero value is a valid value, you will always need to check ret_ptr if you are concerned with errors. +.SH EXAMPLE +.sp +.nf +.ft C +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + size_t result_size; + gearman_return_t rc; + void *value= gearman_client_do(client, "reverse_function", "unique_value", + "my string to reverse", strlen("my string to reverse"), + &result_size, &rc); + + if (gearman_success(rc)) + { + // Make use of value + } + free(value); + + gearman_client_free(client); + + return 0; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_high_background.3 gearmand-0.23/docs/man/gearman_client_do_high_background.3 --- gearmand-0.14/docs/man/gearman_client_do_high_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_high_background.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,119 @@ +.TH "GEARMAN_CLIENT_DO_HIGH_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_high_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, char *job_handle); +.UNINDENT +.sp +Changed in version 0.21: \fBGEARMAN_PAUSE\fP will no longer be returned. A do operation will now run until it has been submitted. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_high_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_job_handle_t job_handle); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_low_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_job_handle_t job_handle); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_do_background()\fP executes a single request to the +gearmand server and returns the status via \fBgearman_return_t\fP. +.sp +\fBgearman_client_do_background_high()\fP and +\fBgearman_client_do_background_low()\fP are identical to +\fBgearman_client_do_background()\fP, only they set the \fBgearman_priority_t\fP to either +high or low. +.sp +If job_handle is not NULL, it will be populated with the name of the job_handle +for the task created. The job handle needs to be the size of +\fBGEARMAN_JOB_HANDLE_SIZE\fP. Please see \fBgearman_job_handle_t\fP for more information. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH EXAMPLE +.sp +.nf +.ft C +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_job_handle_t job_handle; + gearman_return_t rc= gearman_client_do_background(client, + "reverse_function", + "unique_value", + "my string to reverse", strlen("my string to reverse"), + job_handle); + + if (gearman_success(rc)) + { + // Make use of value + printf("%s\en", job_handle); + } + + gearman_client_free(client); + + return 0; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_job_handle.3 gearmand-0.23/docs/man/gearman_client_do_job_handle.3 --- gearmand-0.14/docs/man/gearman_client_do_job_handle.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_job_handle.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_DO_JOB_HANDLE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_job_handle \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_low.3 gearmand-0.23/docs/man/gearman_client_do_low.3 --- gearmand-0.14/docs/man/gearman_client_do_low.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_low.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,115 @@ +.TH "GEARMAN_CLIENT_DO_LOW" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_low \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void *gearman_client_do(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t *ret_ptr)\fI\ *client\fP) +.UNINDENT +.sp +Changed in version 0.21: \fBGEARMAN_PAUSE\fP will no longer be returned. A do operation will now run till completion or error. +.INDENT 0.0 +.TP +.B void *gearman_client_do_high(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_do_low(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, const char\fI\ *unique\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, size_t\fI\ *result_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.SH DESCRIPTION +.sp +\fI\%gearman_client_do()\fP executes a single request to the gearmand +server and waits for a reply. +.sp +\fI\%gearman_client_do_high()\fP and \fI\%gearman_client_do_low()\fP are +identical to \fI\%gearman_client_do()\fP, only they set the priority to +either high or low. +.sp +All of the functions will block until either a response or an error is +returned. +.SH RETURN VALUE +.sp +\fI\%gearman_client_do()\fP returns a pointer to a value that the caller must release. If ret_ptr is provided any errors that have occurred will be stored in it. Since a NULL/zero value is a valid value, you will always need to check ret_ptr if you are concerned with errors. +.SH EXAMPLE +.sp +.nf +.ft C +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + size_t result_size; + gearman_return_t rc; + void *value= gearman_client_do(client, "reverse_function", "unique_value", + "my string to reverse", strlen("my string to reverse"), + &result_size, &rc); + + if (gearman_success(rc)) + { + // Make use of value + } + free(value); + + gearman_client_free(client); + + return 0; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_low_background.3 gearmand-0.23/docs/man/gearman_client_do_low_background.3 --- gearmand-0.14/docs/man/gearman_client_do_low_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_low_background.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,119 @@ +.TH "GEARMAN_CLIENT_DO_LOW_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_low_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, char *job_handle); +.UNINDENT +.sp +Changed in version 0.21: \fBGEARMAN_PAUSE\fP will no longer be returned. A do operation will now run until it has been submitted. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_high_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_job_handle_t job_handle); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_do_low_background(gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_job_handle_t job_handle); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_do_background()\fP executes a single request to the +gearmand server and returns the status via \fBgearman_return_t\fP. +.sp +\fBgearman_client_do_background_high()\fP and +\fBgearman_client_do_background_low()\fP are identical to +\fBgearman_client_do_background()\fP, only they set the \fBgearman_priority_t\fP to either +high or low. +.sp +If job_handle is not NULL, it will be populated with the name of the job_handle +for the task created. The job handle needs to be the size of +\fBGEARMAN_JOB_HANDLE_SIZE\fP. Please see \fBgearman_job_handle_t\fP for more information. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH EXAMPLE +.sp +.nf +.ft C +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_job_handle_t job_handle; + gearman_return_t rc= gearman_client_do_background(client, + "reverse_function", + "unique_value", + "my string to reverse", strlen("my string to reverse"), + job_handle); + + if (gearman_success(rc)) + { + // Make use of value + printf("%s\en", job_handle); + } + + gearman_client_free(client); + + return 0; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_do_status.3 gearmand-0.23/docs/man/gearman_client_do_status.3 --- gearmand-0.14/docs/man/gearman_client_do_status.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_do_status.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_DO_STATUS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_do_status \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_echo.3 gearmand-0.23/docs/man/gearman_client_echo.3 --- gearmand-0.14/docs/man/gearman_client_echo.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_echo.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,64 @@ +.TH "GEARMAN_CLIENT_ECHO" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_echo \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_echo(gearman_client_st *client, const void *workload, size_t workload_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_echo(gearman_worker_st *worker, const void *workload, size_t workload_size); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_echo()\fP and \fBgearman_worker_echo()\fP send a message to a \fBgearmand\fP server. The server will then respond with the message that it sent. These commands are just for testing the connection to the servers that were configure for the \fBgearman_client_st\fP and the \fBgearman_worker_st\fP that were used. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_errno.3 gearmand-0.23/docs/man/gearman_client_errno.3 --- gearmand-0.14/docs/man/gearman_client_errno.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_errno.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,66 @@ +.TH "GEARMAN_CLIENT_ERRNO" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_errno \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_client_error(const gearman_client_st *client); +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_errno(gearman_client_st *client); +.UNINDENT +.sp +Ling with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_error()\fP and \fBgearman_client_errno()\fP report on the last errors that the client reported/stored in \fBgearman_client_st()\fP. If you are interested in recording all errors please see \fBgearman_client_set_log_fn()\fP. +.SH RETURN VALUE +.sp +\fBgearman_client_errno()\fP returns the last \fIerrno\fP that the client recorded. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_error.3 gearmand-0.23/docs/man/gearman_client_error.3 --- gearmand-0.14/docs/man/gearman_client_error.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_error.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,66 @@ +.TH "GEARMAN_CLIENT_ERROR" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_error \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_client_error(const gearman_client_st *client); +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_errno(gearman_client_st *client); +.UNINDENT +.sp +Ling with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_error()\fP and \fBgearman_client_errno()\fP report on the last errors that the client reported/stored in \fBgearman_client_st()\fP. If you are interested in recording all errors please see \fBgearman_client_set_log_fn()\fP. +.SH RETURN VALUE +.sp +\fBgearman_client_errno()\fP returns the last \fIerrno\fP that the client recorded. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_free.3 gearmand-0.23/docs/man/gearman_client_free.3 --- gearmand-0.14/docs/man/gearman_client_free.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_free.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_CLIENT_FREE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_free \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st *gearman_client_create(gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_client_st *gearman_client_clone(gearman_client_st\fI\ *client\fP, const gearman_client_st\fI\ *from\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_free(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_create()\fP is used to create a c:type:\fIgearman_client_st\fP structure that will then +be used by other \fBlibgearman()\fP client functions to communicate with the server. You +should either pass a statically declared \fBgearman_client_st\fP to \fI\%gearman_client_create()\fP or +a NULL. If a NULL passed in then a structure is allocated for you. +.sp +\fI\%gearman_client_clone()\fP is similar to \fI\%gearman_client_create()\fP but it copies the +defaults and list of servers from the source \fBgearman_client_st\fP . If you pass a null as +the argument for the source to clone, it is the same as a call to gearman_client_create(). +If the destination argument is NULL a \fBgearman_client_st\fP will be allocated for you. +.sp +To clean up memory associated with a \fBgearman_client_st\fP structure you should pass +it to gearman_client_free() when you are finished using it. \fI\%gearman_client_free()\fP is +the only way to make sure all memory is deallocated when you finish using +the structure. +.IP Warning +. +You may wish to avoid using \fI\%gearman_client_create()\fP or \fI\%gearman_client_clone()\fP with a +stack based allocation, ie the first parameter. The most common issues related to ABI safety involve +stack allocated structures. +.RE +.SH RETURN VALUE +.sp +\fBgearman_client_create()\fP returns a pointer to the gearman_client_st +that was created (or initialized). On an allocation failure, it returns +NULL. +.sp +\fBgearman_client_clone()\fP returns a pointer to the gearman_client_st that was created +(or initialized). On an allocation failure, it returns NULL. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_st(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_has_option.3 gearmand-0.23/docs/man/gearman_client_has_option.3 --- gearmand-0.14/docs/man/gearman_client_has_option.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_has_option.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,105 @@ +.TH "GEARMAN_CLIENT_HAS_OPTION" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_has_option \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_options_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_client_options_t\fP gearman_client_options(const gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_add_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_client_has_option(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ option\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_options()\fP returns the \fI\%gearman_client_options_t\fP for \fBgearman_client_st\fP. You enable options via \fI\%gearman_client_add_options()\fP and disable options via \fI\%gearman_client_remove_options()\fP. +.sp +\fI\%gearman_client_set_options()\fP has been DEPRECATED. +.sp +The currently supported options are: +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_NON_BLOCKING +.UNINDENT +.sp +Run the cient in a non\-blocking mode. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_FREE_TASKS +.UNINDENT +.sp +Automatically free task objects once they are complete. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_UNBUFFERED_RESULT +.UNINDENT +.sp +Allow the client to read data in chunks rather than have the library buffer +the entire data result and pass that back. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_job_status.3 gearmand-0.23/docs/man/gearman_client_job_status.3 --- gearmand-0.14/docs/man/gearman_client_job_status.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_job_status.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,70 @@ +.TH "GEARMAN_CLIENT_JOB_STATUS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_job_status \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_job_status(gearman_client_st *client, gearman_job_handle_t job_handle, bool *is_known, bool *is_running, uint32_t *numerator, uint32_t *denominator); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_job_status()\fP is used to find the status of a job via its \fBgearman_job_handle_t\fP. The arguments is_known, is_running, numerator, and denominator are all optional. Unless a Gearman worker has sent numerator/denominator via \fBgearman_job_send_status()\fP, those values will be zero. +.sp +If the arguments is_known and is_running are ommitted then the function returns state data via \fBgearman_return_t\fP. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP will be returned. \fBGEARMAN_SUCCESS\fP will be returned upon success of the status being updated. +If the arguments is_known and is_running are omitted then \fBgearman_client_job_status()\fP will return \fBGEARMAN_JOB_EXISTS\fP if the \fBgearman_job_handle_t\fP is known on the server, and +\fBGEARMAN_IN_PROGRESS\fP if it is running. Knowing whether the job is running or not has higher precedence. \fBgearman_continue()\fP can be used for loops where you want to exit from the loop once the job has been completed. +.IP Warning +. +For loops you should always check \fBgearman_return_t\fP with \fBgearman_continue()\fP even if you specifiy the argument is_known or is_running. A non\-blocking IO call can return something other then \fBGEARMAN_SUCCESS\fP, in some cases you will want to treat those values not as errors. +.RE +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP \fIgearman_job_handle_t(3)\fP \fIgearman_continue(3\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_options.3 gearmand-0.23/docs/man/gearman_client_options.3 --- gearmand-0.14/docs/man/gearman_client_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_options.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,105 @@ +.TH "GEARMAN_CLIENT_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_options_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_client_options_t\fP gearman_client_options(const gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_add_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_client_has_option(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ option\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_options()\fP returns the \fI\%gearman_client_options_t\fP for \fBgearman_client_st\fP. You enable options via \fI\%gearman_client_add_options()\fP and disable options via \fI\%gearman_client_remove_options()\fP. +.sp +\fI\%gearman_client_set_options()\fP has been DEPRECATED. +.sp +The currently supported options are: +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_NON_BLOCKING +.UNINDENT +.sp +Run the cient in a non\-blocking mode. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_FREE_TASKS +.UNINDENT +.sp +Automatically free task objects once they are complete. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_UNBUFFERED_RESULT +.UNINDENT +.sp +Allow the client to read data in chunks rather than have the library buffer +the entire data result and pass that back. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_options_t.3 gearmand-0.23/docs/man/gearman_client_options_t.3 --- gearmand-0.14/docs/man/gearman_client_options_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_options_t.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,105 @@ +.TH "GEARMAN_CLIENT_OPTIONS_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_options_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_options_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_client_options_t\fP gearman_client_options(const gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_add_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_client_has_option(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ option\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_options()\fP returns the \fI\%gearman_client_options_t\fP for \fBgearman_client_st\fP. You enable options via \fI\%gearman_client_add_options()\fP and disable options via \fI\%gearman_client_remove_options()\fP. +.sp +\fI\%gearman_client_set_options()\fP has been DEPRECATED. +.sp +The currently supported options are: +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_NON_BLOCKING +.UNINDENT +.sp +Run the cient in a non\-blocking mode. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_FREE_TASKS +.UNINDENT +.sp +Automatically free task objects once they are complete. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_UNBUFFERED_RESULT +.UNINDENT +.sp +Allow the client to read data in chunks rather than have the library buffer +the entire data result and pass that back. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_remove_options.3 gearmand-0.23/docs/man/gearman_client_remove_options.3 --- gearmand-0.14/docs/man/gearman_client_remove_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_remove_options.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,105 @@ +.TH "GEARMAN_CLIENT_REMOVE_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_remove_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_options_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_client_options_t\fP gearman_client_options(const gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_add_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_client_has_option(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ option\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_options()\fP returns the \fI\%gearman_client_options_t\fP for \fBgearman_client_st\fP. You enable options via \fI\%gearman_client_add_options()\fP and disable options via \fI\%gearman_client_remove_options()\fP. +.sp +\fI\%gearman_client_set_options()\fP has been DEPRECATED. +.sp +The currently supported options are: +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_NON_BLOCKING +.UNINDENT +.sp +Run the cient in a non\-blocking mode. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_FREE_TASKS +.UNINDENT +.sp +Automatically free task objects once they are complete. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_UNBUFFERED_RESULT +.UNINDENT +.sp +Allow the client to read data in chunks rather than have the library buffer +the entire data result and pass that back. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_remove_servers.3 gearmand-0.23/docs/man/gearman_client_remove_servers.3 --- gearmand-0.14/docs/man/gearman_client_remove_servers.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_remove_servers.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,79 @@ +.TH "GEARMAN_CLIENT_REMOVE_SERVERS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_remove_servers \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_add_server(gearman_client_st *client, const char *host, in_port_t port); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_add_servers(gearman_client_st *client, const char *servers); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_servers(gearman_client_st *client); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the client will take work from. +.sp +\fBgearman_client_remove_servers()\fP will remove all servers from the \fBgearman_client_st\fP. +.sp +\fBgearman_client_add_servers()\fP takes a list of \fBgearmand\fP servers that will be parsed to provide servers for the client. The format for this is SERVER[:PORT][,SERVER[:PORT]]... +.INDENT 0.0 +.TP +.B Examples of this are:: +. +10.0.0.1,10.0.0.2,10.0.0.3 +localhost234,jobserver2.domain.com:7003,10.0.0.3 +.UNINDENT +.SH RETURN VALUE +.sp +\fBgearman_client_add_server()\fP and \fBgearman_client_remove_servers()\fP return \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_run_tasks.3 gearmand-0.23/docs/man/gearman_client_run_tasks.3 --- gearmand-0.14/docs/man/gearman_client_run_tasks.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_run_tasks.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,74 @@ +.TH "GEARMAN_CLIENT_RUN_TASKS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_run_tasks \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_run_tasks(gearman_client_st *client); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_client_run_tasks()\fP executes one or more tasks that have +been added via \fBgearman_client_add_task()\fP, +\fBgearman_client_add_task_status()\fP or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_run_tasks()\fP can also be used with +\fBgearman_execute()\fP if either non\-blocking or background tasks were +created with it. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.sp +If \fBGEARMAN_PAUSE\fP is returned one of the tasks has "paused" in +order to give the caller an opportunity to take some actions (like read +data, handle an exception, etc...). See \fBgearman_task_st\fP for more +information about the state of a task. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_complete_fn.3 gearmand-0.23/docs/man/gearman_client_set_complete_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_complete_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_complete_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_COMPLETE_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_complete_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_context.3 gearmand-0.23/docs/man/gearman_client_set_context.3 --- gearmand-0.14/docs/man/gearman_client_set_context.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_context.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_CONTEXT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_context \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_created_fn.3 gearmand-0.23/docs/man/gearman_client_set_created_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_created_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_created_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_CREATED_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_created_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_data_fn.3 gearmand-0.23/docs/man/gearman_client_set_data_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_data_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_data_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_DATA_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_data_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_exception_fn.3 gearmand-0.23/docs/man/gearman_client_set_exception_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_exception_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_exception_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_EXCEPTION_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_exception_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_fail_fn.3 gearmand-0.23/docs/man/gearman_client_set_fail_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_fail_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_fail_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_FAIL_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_fail_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_log_fn.3 gearmand-0.23/docs/man/gearman_client_set_log_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_log_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_log_fn.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,64 @@ +.TH "GEARMAN_CLIENT_SET_LOG_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_log_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void gearman_worker_set_log_fn(gearman_worker_st *worker, gearman_log_fn *function, void *context, gearman_verbose_t verbose); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_set_log_fn()\fP is similar to \fBgearman_worker_set_log_fn()\fP but it used with clients, aka, \fBgearman_client_st\fP. +\fBgearman_client_set_log_fn()\fP allows you to register a callback that will be passed all error messages that are givin to the client. +.sp +See \fBgearman_log_fn\fP for more information on the callback. +.sp +See \fBgearman_verbose_t\fP for more information on logging levels. +.SH RETURN VALUE +.sp +None +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_log_fn(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_memory_allocators.3 gearmand-0.23/docs/man/gearman_client_set_memory_allocators.3 --- gearmand-0.14/docs/man/gearman_client_set_memory_allocators.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_memory_allocators.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,84 @@ +.TH "GEARMAN_CLIENT_SET_MEMORY_ALLOCATORS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_memory_allocators \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_allocator_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_malloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_free_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_realloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_calloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_set_memory_allocators(gearman_client_st *, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st *, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context); +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Install callbacks for custom allocation. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. You can use \fBgearman_client_set_memory_allocators()\fP and \fBgearman_worker_set_memory_allocators()\fP to set your own custom allocators. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_namespace.3 gearmand-0.23/docs/man/gearman_client_set_namespace.3 --- gearmand-0.14/docs/man/gearman_client_set_namespace.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_namespace.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_CLIENT_SET_NAMESPACE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_namespace \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void gearman_client_set_namespace(gearman_client_st\fI\ *self\fP, const char\fI\ *namespace_key\fP, size_t\fI\ namespace_key_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_namespace(gearman_worker_st\fI\ *self\fP, const char\fI\ *namespace_key\fP, size_t\fI\ namespace_key_size\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +gearman_client_set_namespace() and gearman_worker_set_namespace() set a "namespace" for a given set of functions. Only clients and workers sharing a \fBnamespace_key\fP can +see one anothers workloads and functions. +.sp +By setting \fBnamespace_key\fP to NULL you can disable the namespace. +.SH RETURN +.sp +None +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_options.3 gearmand-0.23/docs/man/gearman_client_set_options.3 --- gearmand-0.14/docs/man/gearman_client_set_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_options.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,105 @@ +.TH "GEARMAN_CLIENT_SET_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_options_t +.UNINDENT +.INDENT 0.0 +.TP +.B \fI\%gearman_client_options_t\fP gearman_client_options(const gearman_client_st\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_add_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_remove_options(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_client_has_option(gearman_client_st\fI\ *client\fP, \fI\%gearman_client_options_t\fP\fI\ option\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_options()\fP returns the \fI\%gearman_client_options_t\fP for \fBgearman_client_st\fP. You enable options via \fI\%gearman_client_add_options()\fP and disable options via \fI\%gearman_client_remove_options()\fP. +.sp +\fI\%gearman_client_set_options()\fP has been DEPRECATED. +.sp +The currently supported options are: +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_NON_BLOCKING +.UNINDENT +.sp +Run the cient in a non\-blocking mode. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_FREE_TASKS +.UNINDENT +.sp +Automatically free task objects once they are complete. +.INDENT 0.0 +.TP +.B GEARMAN_CLIENT_UNBUFFERED_RESULT +.UNINDENT +.sp +Allow the client to read data in chunks rather than have the library buffer +the entire data result and pass that back. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_status_fn.3 gearmand-0.23/docs/man/gearman_client_set_status_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_status_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_status_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_STATUS_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_status_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_task_context_free_fn.3 gearmand-0.23/docs/man/gearman_client_set_task_context_free_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_task_context_free_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_task_context_free_fn.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_SET_TASK_CONTEXT_FREE_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_task_context_free_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_timeout.3 gearmand-0.23/docs/man/gearman_client_set_timeout.3 --- gearmand-0.14/docs/man/gearman_client_set_timeout.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_timeout.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_SET_TIMEOUT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_timeout \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_warning_fn.3 gearmand-0.23/docs/man/gearman_client_set_warning_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_warning_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_warning_fn.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,111 @@ +.TH "GEARMAN_CLIENT_SET_WARNING_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_warning_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_actions_t +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, gearman_workload_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, gearman_created_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, gearman_data_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, gearman_warning_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, gearman_universal_status_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, gearman_complete_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, gearman_exception_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, gearman_fail_fn\fI\ *function\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Callbacks for client execution task states. +.sp +\fBgearman_client_do_job_handle()\fP sets the callback function that will +be called if server is to make a request to the client to provide more data. +.sp +\fI\%gearman_client_clear_fn()\fP can be called to remove all existing +\fI\%gearman_actions_t\fP that have been set. +.sp +\fI\%gearman_client_set_created_fn()\fP, +\fI\%gearman_client_set_data_fn()\fP, +\fI\%gearman_client_set_warning_fn()\fP, +\fI\%gearman_client_set_status_fn()\fP, +\fI\%gearman_client_set_complete_fn()\fP, +\fI\%gearman_client_set_exception_fn()\fP, and +\fI\%gearman_client_set_fail_fn()\fP, set callback functions for the +different states of execution for a client request. Each request, ie +a creation of \fBgearman_task_st\fP, keeps a copy of callbacks when it +is created. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_workload_fn.3 gearmand-0.23/docs/man/gearman_client_set_workload_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_workload_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_workload_fn.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_SET_WORKLOAD_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_workload_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_workload_free_fn.3 gearmand-0.23/docs/man/gearman_client_set_workload_free_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_workload_free_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_workload_free_fn.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_SET_WORKLOAD_FREE_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_workload_free_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_set_workload_malloc_fn.3 gearmand-0.23/docs/man/gearman_client_set_workload_malloc_fn.3 --- gearmand-0.14/docs/man/gearman_client_set_workload_malloc_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_set_workload_malloc_fn.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_SET_WORKLOAD_MALLOC_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_set_workload_malloc_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_st.3 gearmand-0.23/docs/man/gearman_client_st.3 --- gearmand-0.14/docs/man/gearman_client_st.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_st.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_ST" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_st \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_task_free_all.3 gearmand-0.23/docs/man/gearman_client_task_free_all.3 --- gearmand-0.14/docs/man/gearman_client_task_free_all.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_task_free_all.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_TASK_FREE_ALL" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_task_free_all \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_timeout.3 gearmand-0.23/docs/man/gearman_client_timeout.3 --- gearmand-0.14/docs/man/gearman_client_timeout.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_timeout.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,112 @@ +.TH "GEARMAN_CLIENT_TIMEOUT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_timeout \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_client_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_client_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_timeout(\fI\%gearman_client_st\fP\fI\ *client\fP, int\fI\ timeout\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_client_context(const \fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_context(\fI\%gearman_client_st\fP\fI\ *client\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_malloc_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_set_workload_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Deprecated since version 0.23: Use \fBgearman_allocator_t\fP +.INDENT 0.0 +.TP +.B void gearman_client_task_free_all(\fI\%gearman_client_st\fP\fI\ *client\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_client_set_task_context_free_fn(\fI\%gearman_client_st\fP\fI\ *client\fP, gearman_task_context_free_fn\fI\ *function\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_client_st\fP is used for \fIclient\fP communication with the server. +.sp +\fI\%gearman_client_context()\fP and \fI\%gearman_client_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fI\%gearman_client_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fI\%gearman_client_timeout()\fP and \fI\%gearman_client_set_timeout()\fP get and set the current timeout value, in milliseconds, for the client. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fI\%gearman_client_set_workload_malloc_fn()\fP and \fI\%gearman_client_set_workload_free_fn()\fP can be used to replace these with custom functions. (These have been deprecated, please see \fBgearman_allocator_t\fP for the updated interface. +.sp +\fI\%gearman_client_task_free_all()\fP is used to free all current \fBgearman_task_st\fP that have been created with the \fI\%gearman_client_st\fP. +.IP Warning +. +By calling \fI\%gearman_client_task_free_all()\fP you can end up with a SEGFAULT if you try to use any \fBgearman_task_st\fP that you have kept pointers too. +.RE +.SH RETURN VALUE +.sp +\fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds. A value of \-1 means an infinite timeout value. See \fIpoll(3)\fP for more details. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_client_wait.3 gearmand-0.23/docs/man/gearman_client_wait.3 --- gearmand-0.14/docs/man/gearman_client_wait.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_client_wait.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,57 @@ +.TH "GEARMAN_CLIENT_WAIT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_client_wait \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +Calling \fBgearman_client_wait()\fP causes the calling code to sleep until either the timeout in \fBgearman_client_st\fP is reached or \fBgearmand\fP responds to the client. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_continue.3 gearmand-0.23/docs/man/gearman_continue.3 --- gearmand-0.14/docs/man/gearman_continue.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_continue.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,360 @@ +.TH "GEARMAN_CONTINUE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_continue \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_strerror(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_success(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_failed(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_continue(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_return_t\fP is used as a return/error type for all calls using \fBgearman_client_st\fP and \fBgearman_worker_st\fP. +\fI\%GEARMAN_SUCCESS\fP is returned upon success, otherwise an error is returned. \fI\%gearman_failed()\fP can be used to see if the return value is a failing value. +You can print a text version of the error message with \fI\%gearman_strerror()\fP. +.sp +\fI\%gearman_success()\fP return true if \fI\%GEARMAN_SUCCESS\fP or if +\fI\%GEARMAN_NO_PENDING_TASKS\fP tests true. +.sp +\fI\%gearman_failed()\fP return true if any value other then \fI\%GEARMAN_SUCCESS\fP was provided. +.sp +\fI\%gearman_continue()\fP returns true if any error related to non\-blocking IO +occurred. This should be used for testing loops. +.SS Possible values of \fI\%gearman_return_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +Success +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_PENDING_TASKS +. +\fBgearman_client_run_tasks()\fP was called and it has completed all tasks assigned to the client. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IO_WAIT +. +Blocking IO was found. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERRNO +. +System error occurred. Use either \fBgearman_client_errno()\fP or \fBgearman_worker_errno()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_ACTIVE_FDS +. +No active connections were available. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_GETADDRINFO +. +Name resolution failed for a host. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_SERVERS +. +No servers have been provided for the client/worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_LOST_CONNECTION +. +Connection was lost to the given server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_MEMORY_ALLOCATION_FAILURE +. +Memory allocation failed. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SERVER_ERROR +. +An error occurred on the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NOT_CONNECTED +. +Client/Worker is not currently connected to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_COULD_NOT_CONNECT +. +Server name was valid, but a connection could not be made. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ECHO_DATA_CORRUPTION +. +Either \fBgearman_client_echo()\fP or \fBgearman_work_echo()\fP echo was unsuccessful because the data was returned from \fBgearmand\fP corrupted. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNKNOWN_STATE +. +The gearman_return_t was never set. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FLUSH_DATA +. +Internal state, should never be seen by either client or worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SEND_BUFFER_TOO_SMALL +. +Send buffer was too small. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TIMEOUT +. +A timeout occurred when making a request to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ARGUMENT_TOO_LARGE +. +Argument was too large for the current buffer. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_ARGUMENT +. +One of the arguments to the given API call was invalid. EINVAL will be set if \fBgearman_client_error()\fP or \fBgearman_worker_error()\fP were not settable. This can also be returned if \fBGEARMAN_CLIENT_UNBUFFERED_RESULT\fP was set, but the client is not handling the data correctly. +.UNINDENT +.SS CLIENT ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NEED_WORKLOAD_FN +. +A client was asked for work, but no \fBgearman_workload_fn\fP callback was specified. See \fBgearman_client_set_workload_fn()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IN_PROGRESS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently being run by a worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_JOB_EXISTS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently known by a server, but is not being run by a worker. +.UNINDENT +.SS WORKER ONLY +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_FUNCTION_NAME +. +A worker was sent a request for a job that it did not have a valid function for. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_WORKER_FUNCTION +. +No callback was provided by the worker for a given function. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTION +. +A request for removing a given function from a worker was invalid since that function did not exist. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTIONS +. +The worker has not registered any functions. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_JOBS +. +No jobs were found for the worker. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Client which have registed a custom \fBgearman_actions_t\fP may use these +value as return values to the calling client. +.INDENT 0.0 +.TP +.B GEARMAN_WORK_DATA +. +Worker has sent a chunked piece of data to the client via \fBgearman_job_send_data()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_WARNING +. +Worker has issued a warning to the client via \fBgearman_job_send_warning()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_STATUS +. +Status has been updated by the worker via \fBgearman_job_send_status()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_EXCEPTION +. +Worker has sent an exception the client via \fBgearman_job_send_exception()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_PAUSE +. +Used only in custom application for client return based on \fI\%GEARMAN_WORK_DATA\fP, \fI\%GEARMAN_WORK_WARNING\fP, \fI\%GEARMAN_WORK_EXCEPTION\fP, \fI\%GEARMAN_WORK_FAIL\fP, or \fI\%GEARMAN_WORK_STATUS\fP. \fI\%gearman_continue()\fP can be used to check for this value. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Any function defined by \fBgearman_worker_define_function()\fP may, and can only, return the following \fI\%gearman_return_t\fP values. +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +The function successfully completed the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FATAL +. +The function failed to complete the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SHUTDOWN +. +\fI\%GEARMAN_SHUTDOWN\fP is a special case. If it is returned the client will be sent \fI\%GEARMAN_SUCCESS\fP, but \fBgearman_worker_work()\fP will exit with \fI\%GEARMAN_SHUTDOWN\fP. +.UNINDENT +.SS TASK ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NOT_FLUSHING +. +\fBgearman_task_send_workload()\fP failed, it was not in the correct state. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_DATA_TOO_LARGE +. +\fBgearman_task_send_workload()\fP failed, the data was too large to be sent. +.UNINDENT +.SS PROTOCOL +.sp +If any of these errors occurred the connection will be dropped/reset. +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_MAGIC +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_COMMAND +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNEXPECTED_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TOO_MANY_ARGS +.UNINDENT +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearmand.8 gearmand-0.23/docs/man/gearmand.8 --- gearmand-0.14/docs/man/gearmand.8 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearmand.8 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,378 @@ +.TH "GEARMAND" "8" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearmand \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +\fBGeneral options\fP +.INDENT 0.0 +.TP +.B \-b [ \-\-backlog ] arg (=32) +.sp +Number of backlog connections for listen. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-check\-args +. +Check command line and configuration file argments and then exit. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d [ \-\-daemon ] +.sp +Daemon, detach and run in the background. +.UNINDENT +.INDENT 0.0 +.TP +.B \-f [ \-\-file\-descriptors ] arg +.sp +Number of file descriptors to allow for the process (total connections will be slightly less). Default is max allowed for user. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h [ \-\-help ] +.sp +Print this help menu. +.UNINDENT +.INDENT 0.0 +.TP +.B \-j [ \-\-job\-retries ] arg (=0) +.sp +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. +.UNINDENT +.INDENT 0.0 +.TP +.B \-l [ \-\-log\-file ] arg +.sp +Log file to write errors and information to. Turning this option on also forces the first verbose level to be enabled. +.UNINDENT +.INDENT 0.0 +.TP +.B \-L [ \-\-listen ] arg +.sp +Address the server should listen on. Default is INADDR_ANY. +.UNINDENT +.INDENT 0.0 +.TP +.B \-p [ \-\-port ] arg (=4730) +.sp +Port the server should listen on. +.UNINDENT +.INDENT 0.0 +.TP +.B \-P [ \-\-pid\-file ] arg +.sp +File to write process ID out to. +.UNINDENT +.INDENT 0.0 +.TP +.B \-r [ \-\-protocol ] arg +.sp +Load protocol module. +.UNINDENT +.INDENT 0.0 +.TP +.B \-R [ \-\-round\-robin ] +.sp +Assign work in round\-robin order per worker connection. The default is to assign work in the order of functions added by the worker. +.UNINDENT +.INDENT 0.0 +.TP +.B \-q [ \-\-queue\-type ] arg +.sp +Persistent queue type to use. +.UNINDENT +.INDENT 0.0 +.TP +.B \-t [ \-\-threads ] arg (=4) +.sp +Number of I/O threads to use. Default=4. +.UNINDENT +.INDENT 0.0 +.TP +.B \-u [ \-\-user ] arg +.sp +Switch to given user after startup. +.UNINDENT +.INDENT 0.0 +.TP +.B \-v [ \-\-verbose ] arg (=v) +.sp +Increase verbosity level by one. +.UNINDENT +.INDENT 0.0 +.TP +.B \-V [ \-\-version ] +.sp +Display the version of gearmand and exit. +.UNINDENT +.INDENT 0.0 +.TP +.B \-w [ \-\-worker\-wakeup ] arg (=0) +.sp +Number of workers to wakeup for each job received. The default is to wakeup all available workers. +.UNINDENT +.sp +\fBHTTP:\fP +.INDENT 0.0 +.TP +.B \-\-http\-port arg (=8080) +.sp +Port to listen on. +.UNINDENT +.sp +\fBsqlite\fP +.INDENT 0.0 +.TP +.B \-\-libsqlite3\-db arg +.sp +Database file to use. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-libsqlite3\-table arg (=gearman_queue) +.sp +Table to use. +.UNINDENT +.sp +\fBMemcached(libmemcached)\fP +.INDENT 0.0 +.TP +.B \-\-libmemcached\-servers arg +.sp +List of Memcached servers to use. +.UNINDENT +.sp +\fBDrizzle/MySQL(libdrizzle)\fP +.INDENT 0.0 +.TP +.B \-host arg +.sp +Host of server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-port arg +.sp +Port of server. (by default Drizzle) +.UNINDENT +.INDENT 0.0 +.TP +.B \-uds arg +.sp +Unix domain socket for server. +.UNINDENT +.INDENT 0.0 +.TP +.B \-user arg +.sp +User name for authentication. +.UNINDENT +.INDENT 0.0 +.TP +.B \-password arg +.sp +Password for authentication. +.UNINDENT +.INDENT 0.0 +.TP +.B \-db arg +.sp +Schema/Database to use. +.UNINDENT +.INDENT 0.0 +.TP +.B \-table arg +.sp +Table to use. +.UNINDENT +.INDENT 0.0 +.TP +.B \-mysql arg +.sp +Use MySQL protocol. +.UNINDENT +.sp +\fBPostgres\fP +.INDENT 0.0 +.TP +.B \-\-libpq\-conninfo arg +.sp +PostgreSQL connection information string. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-libpq\-table arg (=queue) +.sp +Table to use. +.UNINDENT +.sp +\fBtokyocabinet\fP +.INDENT 0.0 +.TP +.B \-\-libtokyocabinet\-file arg +.sp +File name of the database. [see: man tcadb, tcadbopen() for name guidelines] +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-libtokyocabinet\-optimize +. +Optimize database on open. [default=true] +.UNINDENT +.SH DESCRIPTION +.sp +Gearman provides a generic application framework to farm out work to other machines or processes that are better suited to do the work. It allows you to do work in parallel, to load balance processing, and to call functions between languages. It can be used in a variety of applications, from high\-availability web sites to the transport of database replication events. In other words, it is the nervous system for how distributed processing communicates. A few strong points about Gearman: +.INDENT 0.0 +.IP \(bu 2 +. +Open Source \- It\(aqs free! (in both meanings of the word) Gearman has an active open source community that is easy to get involved with if you need help or want to contribute. +.IP \(bu 2 +. +Multi\-language \- There are interfaces for a number of languages, and this list is growing. You also have the option to write heterogeneous applications with clients submitting work in one language and workers performing that work in another. +.IP \(bu 2 +. +Flexible \- You are not tied to any specific design pattern. You can quickly put together distributed applications using any model you choose, one of those options being Map/Reduce. +.IP \(bu 2 +. +Fast \- Gearman has a simple protocol and interface with a new optimized server in C to minimize your application overhead. +.IP \(bu 2 +. +Embeddable \- Since Gearman is fast and lightweight, it is great for applications of all sizes. It is also easy to introduce into existing applications with minimal overhead. +.IP \(bu 2 +. +No single point of failure \- Gearman can not only help scale systems, but can do it in a fault tolerant way. +.UNINDENT +.SS Thread Model +.sp +The \-t option to gearmand allows you to specify multiple I/O threads, this is enabled by default. There are currently three types of threads in the job server: +.sp +Listening and management thread \- only one +I/O thread \- can have many +Processing thread \- only one +.sp +When no \-t option is given or \-t 0 is given, all of three thread types happen within a single thread. When \-t 1 is given, there is a thread for listening/management and a thread for I/O and processing. When \-t 2 is given, there is a thread for each type of thread above. For all \-t option values above 2, more I/O threads are created. +.sp +The listening and management thread is mainly responsible for accepting new connections and assigning those connections to an I/O thread (if there are many). It also coordinates startup and shutdown within the server. This thread will have an instance of libevent for managing socket events and signals on an internal pipe. This pipe is used to wakeup the thread or to coordinate shutdown. +.sp +The I/O thread is responsible for doing the read and write system calls on the sockets and initial packet parsing. Once the packet has been parsed it it put into an asynchronous queue for the processing thread (each thread has it\(aqs own queue so there is very little contention). Each I/O thread has it\(aqs own instance of libevent for managing socket events and signals on an internal pipe like the listening thread. +.sp +The processing thread should have no system calls within it (except for the occasional brk() for more memory), and manages the various lists and hash tables used for tracking unique keys, job handles, functions, and job queues. All packets that need to be sent back to connections are put into an asynchronous queue for the I/O thread. The I/O thread will pick these up and send them back over the connected socket. All packets flow through the processing thread since it contains the information needed to process the packets. This is due to the complex nature of the various lists and hash tables. If multiple threads were modifying them the locking overhead would most likely cause worse performance than having it in a single thread (and would also complicate the code). In the future more work may be pushed to the I/O threads, and the processing thread can retain minimal functionality to manage those tables and lists. So far this has not been a significant bottleneck, a 16 core Intel machine is able to process upwards of 50k jobs per second. +.SS Persistent Queues +.sp +Inside the Gearman job server, all job queues are stored in memory. This means if a server restarts or crashes with pending jobs, they will be lost and are never run by a worker. Persistent queues were added to allow background jobs to be stored in an external durable queue so they may live between server restarts and crashes. The persistent queue is only enabled for background jobs because foreground jobs have an attached client. If a job server goes away, the client can detect this and restart the foreground job somewhere else (or report an error back to the original caller). Background jobs on the other hand have no attached client and are simply expected to be run when submitted. +.sp +The persistent queue works by calling a module callback function right before putting a new job in the internal queue for pending jobs to be run. This allows the module to store the job about to be run in some persistent way so that it can later be replayed during a restart. Once it is stored through the module, the job is put onto the active runnable queue, waking up available workers if needed. Once the job has been successfully completed by a worker, another module callback function is called to notify the module the job is done and can be removed. If a job server crashes or is restarted between these two calls for a job, the jobs are reloaded during the next job server start. When the job server starts up, it will call a replay callback function in the module to provide a list of all jobs that were not complete. This is used to populate the internal memory queue of jobs to be run. Once this replay is complete, the job server finishes its initialization and the jobs are now runnable once workers connect (the queue should be in the same state as when it crashed). These jobs are removed from the persistent queue when completed as normal. NOTE: Deleting jobs from the persistent queue storage will not remove them from the in\-memory queue while the server is running. +.sp +The queues are implemented using a modular interface so it is easy to add new data stores for the persistent queue. +.sp +A persistent queue module is enabled by passing the \-q or –queue\-type option to gearmand. Run gearmand –help to see which queue modules are supported on your system. If you are missing options for one you would like to use, you will need to install any dependencies and then recompile the gearmand package. +.SS Extended Protocols +.sp +The protocol plugin interface allows you to take over the packet send and recieve functions, allowing you to pack the buffers as required by the protocol. The core read and write functions can (and should) be used by the protocol plugin. +.SS HTTP +.sp +This protocol plugin allows you to map HTTP requests to Gearman jobs. It only provides client job submission currently, but it may be extended to support other request types in the future. The plugin can handle both GET and POST data, the latter being used to send a workload to the job server. The URL being requested is translated into the function being called. +.sp +For example, the request: +.sp +.nf +.ft C +POST /reverse HTTP/1.1 +Content\-Length: 12 + +Hello world! +.ft P +.fi +.sp +Is translated into a job submission request for the function “reverse” and workload “Hello world!”. This will respond with: +.sp +.nf +.ft C +HTTP/1.0 200 OK +X\-Gearman\-Job\-Handle: H:lap:4 +Content\-Length: 12 +Server: Gearman/0.8 + +!dlrow olleH +.ft P +.fi +.sp +The following headers can be passed to change the behavior of the job: +.sp +.nf +.ft C +* X\-Gearman\-Unique: +* X\-Gearman\-Background: true +* X\-Gearman\-Priority: +.ft P +.fi +.sp +For example, to run a low priority background job, the following request can be sent: +.sp +.nf +.ft C +POST /reverse HTTP/1.1 +Content\-Length: 12 +X\-Gearman\-Background: true +X\-Gearman\-Priority: low + +Hello world! +.ft P +.fi +.sp +The response for this request will not have any data associated with it since it was a background job: +.sp +.nf +.ft C +HTTP/1.0 200 OK +X\-Gearman\-Job\-Handle: H:lap:6 +Content\-Length: 0 +Server: Gearman/0.8 +.ft P +.fi +.sp +The HTTP protocol should be considered experimental. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearman(1)\fP \fIgearadmin(1)\fP \fIlibgearmand(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_execute.3 gearmand-0.23/docs/man/gearman_execute.3 --- gearmand-0.14/docs/man/gearman_execute.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_execute.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,135 @@ +.TH "GEARMAN_EXECUTE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_execute \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_execute(gearman_client_st\fI\ *client\fP, const char\fI\ *function_name\fP, size_t\fI\ function_name_length\fP, const char\fI\ *unique\fP, size_t\fI\ unique_length\fP, gearman_work_t\fI\ *workload\fP, gearman_argument_t\fI\ *arguments\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_task_st *gearman_execute_by_partition(gearman_client_st\fI\ *client\fP, const char\fI\ *partition_function\fP, const size_t\fI\ partition_function_length\fP, const char\fI\ *function_name\fP, const size_t\fI\ function_name_length\fP, const char\fI\ *unique_str\fP, const size_t\fI\ unique_length\fP, gearman_work_t\fI\ *workload\fP, gearman_argument_t\fI\ *arguments\fP, void\fI\ *context\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_execute()\fP is used to create a new \fBgearman_task_st\fP that is executed against the function that is found via the function_name argument. +.sp +\fBgearman_work_t\fP can be used to describe the work that will be +executed, it is built with \fBgearman_argument_make()\fP. The argument +unique_str is optional, but if supplied it is used for coalescence by +\fBgearmand\fP. +.sp +\fBgearman_argument_t\fP is the work that the \fIclient\fP will send +the to the server +.sp +If \fI\%gearman_execute()\fP is given a \fBgearman_work_t\fP that has been built with a reducer, it takes the \fBgearman_argument_t\fP and executs it against a \fIfunction\fP as it normally would, but it tells the function to then process the results through a \fIreducer\fP function that the \fBgearman_work_t\fP was created with. +.sp +What is happening is that the function is mappping/splitting work up into units, and then sending each of them to the reducer function. Once all work is completed, the \fImapper\fP function will aggregate the work via an aggregator function, \fBgearman_aggregator_fn\fP, and return a result. +.sp +If any of the units of work error, the job will be aborted. The resulting value will be stored in the \fBgearman_task_st\fP. +.sp +The result can be obtained from the task by calling +\fBgearman_task_result()\fP to gain the \fBgearman_result_st\fP. +.SH RETURN VALUE +.sp +\fI\%gearman_execute()\fP returns a c:type:\fIgearman_task_st\fP. +.SH EXAMPLE +.sp +.nf +.ft C +/* + Example code to show how to send a string to a function called "reverse" and print the results. +*/ + +#include +#include +#include +#include + +int main(void) +{ + gearman_client_st *client= gearman_client_create(NULL); + + gearman_return_t ret= gearman_client_add_server(client, "localhost", 0); + if (gearman_failed(ret)) + { + return EXIT_FAILURE; + } + + gearman_argument_t value= gearman_argument_make(0, 0, "Reverse Me", strlen("Reverse Me")); + + gearman_task_st *task= gearman_execute(client, + "reverse", strlen("reverse"), // function + NULL, 0, // no unique value provided + NULL, + &value, 0); + + if (task == NULL) // If gearman_execute() can return NULL on error + { + fprintf(stderr, "Error: %s\en", gearman_client_error(client)); + gearman_client_free(client); + return EXIT_FAILURE; + } + + // Make sure the task was run successfully + if (gearman_success(gearman_task_return(task))) + { + // Make use of value + gearman_result_st *result= gearman_task_result(task); + printf("%.*s\en", (int)gearman_result_size(result), gearman_result_value(result)); + } + + gearman_client_free(client); + + return EXIT_SUCCESS; +} + +.ft P +.fi +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_failed.3 gearmand-0.23/docs/man/gearman_failed.3 --- gearmand-0.14/docs/man/gearman_failed.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_failed.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,360 @@ +.TH "GEARMAN_FAILED" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_failed \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_strerror(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_success(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_failed(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_continue(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_return_t\fP is used as a return/error type for all calls using \fBgearman_client_st\fP and \fBgearman_worker_st\fP. +\fI\%GEARMAN_SUCCESS\fP is returned upon success, otherwise an error is returned. \fI\%gearman_failed()\fP can be used to see if the return value is a failing value. +You can print a text version of the error message with \fI\%gearman_strerror()\fP. +.sp +\fI\%gearman_success()\fP return true if \fI\%GEARMAN_SUCCESS\fP or if +\fI\%GEARMAN_NO_PENDING_TASKS\fP tests true. +.sp +\fI\%gearman_failed()\fP return true if any value other then \fI\%GEARMAN_SUCCESS\fP was provided. +.sp +\fI\%gearman_continue()\fP returns true if any error related to non\-blocking IO +occurred. This should be used for testing loops. +.SS Possible values of \fI\%gearman_return_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +Success +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_PENDING_TASKS +. +\fBgearman_client_run_tasks()\fP was called and it has completed all tasks assigned to the client. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IO_WAIT +. +Blocking IO was found. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERRNO +. +System error occurred. Use either \fBgearman_client_errno()\fP or \fBgearman_worker_errno()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_ACTIVE_FDS +. +No active connections were available. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_GETADDRINFO +. +Name resolution failed for a host. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_SERVERS +. +No servers have been provided for the client/worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_LOST_CONNECTION +. +Connection was lost to the given server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_MEMORY_ALLOCATION_FAILURE +. +Memory allocation failed. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SERVER_ERROR +. +An error occurred on the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NOT_CONNECTED +. +Client/Worker is not currently connected to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_COULD_NOT_CONNECT +. +Server name was valid, but a connection could not be made. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ECHO_DATA_CORRUPTION +. +Either \fBgearman_client_echo()\fP or \fBgearman_work_echo()\fP echo was unsuccessful because the data was returned from \fBgearmand\fP corrupted. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNKNOWN_STATE +. +The gearman_return_t was never set. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FLUSH_DATA +. +Internal state, should never be seen by either client or worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SEND_BUFFER_TOO_SMALL +. +Send buffer was too small. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TIMEOUT +. +A timeout occurred when making a request to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ARGUMENT_TOO_LARGE +. +Argument was too large for the current buffer. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_ARGUMENT +. +One of the arguments to the given API call was invalid. EINVAL will be set if \fBgearman_client_error()\fP or \fBgearman_worker_error()\fP were not settable. This can also be returned if \fBGEARMAN_CLIENT_UNBUFFERED_RESULT\fP was set, but the client is not handling the data correctly. +.UNINDENT +.SS CLIENT ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NEED_WORKLOAD_FN +. +A client was asked for work, but no \fBgearman_workload_fn\fP callback was specified. See \fBgearman_client_set_workload_fn()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IN_PROGRESS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently being run by a worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_JOB_EXISTS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently known by a server, but is not being run by a worker. +.UNINDENT +.SS WORKER ONLY +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_FUNCTION_NAME +. +A worker was sent a request for a job that it did not have a valid function for. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_WORKER_FUNCTION +. +No callback was provided by the worker for a given function. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTION +. +A request for removing a given function from a worker was invalid since that function did not exist. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTIONS +. +The worker has not registered any functions. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_JOBS +. +No jobs were found for the worker. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Client which have registed a custom \fBgearman_actions_t\fP may use these +value as return values to the calling client. +.INDENT 0.0 +.TP +.B GEARMAN_WORK_DATA +. +Worker has sent a chunked piece of data to the client via \fBgearman_job_send_data()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_WARNING +. +Worker has issued a warning to the client via \fBgearman_job_send_warning()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_STATUS +. +Status has been updated by the worker via \fBgearman_job_send_status()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_EXCEPTION +. +Worker has sent an exception the client via \fBgearman_job_send_exception()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_PAUSE +. +Used only in custom application for client return based on \fI\%GEARMAN_WORK_DATA\fP, \fI\%GEARMAN_WORK_WARNING\fP, \fI\%GEARMAN_WORK_EXCEPTION\fP, \fI\%GEARMAN_WORK_FAIL\fP, or \fI\%GEARMAN_WORK_STATUS\fP. \fI\%gearman_continue()\fP can be used to check for this value. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Any function defined by \fBgearman_worker_define_function()\fP may, and can only, return the following \fI\%gearman_return_t\fP values. +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +The function successfully completed the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FATAL +. +The function failed to complete the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SHUTDOWN +. +\fI\%GEARMAN_SHUTDOWN\fP is a special case. If it is returned the client will be sent \fI\%GEARMAN_SUCCESS\fP, but \fBgearman_worker_work()\fP will exit with \fI\%GEARMAN_SHUTDOWN\fP. +.UNINDENT +.SS TASK ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NOT_FLUSHING +. +\fBgearman_task_send_workload()\fP failed, it was not in the correct state. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_DATA_TOO_LARGE +. +\fBgearman_task_send_workload()\fP failed, the data was too large to be sent. +.UNINDENT +.SS PROTOCOL +.sp +If any of these errors occurred the connection will be dropped/reset. +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_MAGIC +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_COMMAND +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNEXPECTED_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TOO_MANY_ARGS +.UNINDENT +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_free.3 gearmand-0.23/docs/man/gearman_job_free.3 --- gearmand-0.14/docs/man/gearman_job_free.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_free.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_FREE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_free \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_free_all.3 gearmand-0.23/docs/man/gearman_job_free_all.3 --- gearmand-0.14/docs/man/gearman_job_free_all.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_free_all.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_FREE_ALL" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_free_all \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_function_name.3 gearmand-0.23/docs/man/gearman_job_function_name.3 --- gearmand-0.14/docs/man/gearman_job_function_name.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_function_name.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_FUNCTION_NAME" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_function_name \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_handle.3 gearmand-0.23/docs/man/gearman_job_handle.3 --- gearmand-0.14/docs/man/gearman_job_handle.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_handle.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_HANDLE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_handle \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_handle_t.3 gearmand-0.23/docs/man/gearman_job_handle_t.3 --- gearmand-0.14/docs/man/gearman_job_handle_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_handle_t.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,64 @@ +.TH "GEARMAN_JOB_HANDLE_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_handle_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_handle_t +.UNINDENT +.SH DESCRIPTION +.sp +A \fI\%gearman_job_handle_t\fP represents a "job handle". A job handle is +a text string that represents the name of a task (in truth +gearman_job_handle_t is a typedef\(aqed +char[\fBGEARMAN_JOB_HANDLE_SIZE\fP]). +.sp +\fBgearman_client_job_status()\fP use handles to find the status of tasks. When passed to \fBgearman_client_do_background()\fP it will be populated with the job handle. +.SH RETURN VALUE +.sp +None. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fBgearman_job_st\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_send_complete.3 gearmand-0.23/docs/man/gearman_job_send_complete.3 --- gearmand-0.14/docs/man/gearman_job_send_complete.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_send_complete.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_SEND_COMPLETE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_send_complete \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_send_data.3 gearmand-0.23/docs/man/gearman_job_send_data.3 --- gearmand-0.14/docs/man/gearman_job_send_data.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_send_data.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_SEND_DATA" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_send_data \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_send_exception.3 gearmand-0.23/docs/man/gearman_job_send_exception.3 --- gearmand-0.14/docs/man/gearman_job_send_exception.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_send_exception.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_SEND_EXCEPTION" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_send_exception \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_send_fail.3 gearmand-0.23/docs/man/gearman_job_send_fail.3 --- gearmand-0.14/docs/man/gearman_job_send_fail.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_send_fail.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_SEND_FAIL" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_send_fail \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_send_status.3 gearmand-0.23/docs/man/gearman_job_send_status.3 --- gearmand-0.14/docs/man/gearman_job_send_status.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_send_status.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_SEND_STATUS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_send_status \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_send_warning.3 gearmand-0.23/docs/man/gearman_job_send_warning.3 --- gearmand-0.14/docs/man/gearman_job_send_warning.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_send_warning.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_SEND_WARNING" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_send_warning \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_st.3 gearmand-0.23/docs/man/gearman_job_st.3 --- gearmand-0.14/docs/man/gearman_job_st.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_st.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_ST" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_st \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_take_workload.3 gearmand-0.23/docs/man/gearman_job_take_workload.3 --- gearmand-0.14/docs/man/gearman_job_take_workload.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_take_workload.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_TAKE_WORKLOAD" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_take_workload \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_unique.3 gearmand-0.23/docs/man/gearman_job_unique.3 --- gearmand-0.14/docs/man/gearman_job_unique.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_unique.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_UNIQUE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_unique \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_workload.3 gearmand-0.23/docs/man/gearman_job_workload.3 --- gearmand-0.14/docs/man/gearman_job_workload.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_workload.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_WORKLOAD" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_workload \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_job_workload_size.3 gearmand-0.23/docs/man/gearman_job_workload_size.3 --- gearmand-0.14/docs/man/gearman_job_workload_size.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_job_workload_size.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,133 @@ +.TH "GEARMAN_JOB_WORKLOAD_SIZE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_job_workload_size \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_job_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_job_send_fail(gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_handle(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_function_name(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_job_unique(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_job_workload(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_job_workload_size(const gearman_job_st *job); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgeaman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. +.sp +\fBgearman_job_free()\fP is used to free a job. This only needs to be +done if a task was created with a preallocated structure. +.sp +\fBgearman_job_handle()\fP returns the job handle(see +\fBgearman_job_t\fP for more information). +.sp +\fBgearman_job_function_name()\fP return the name of the function that +the job was set to execute against. +.sp +\fBgearman_job_unique()\fP return the unique value that was used for +\fI\%gearman_job_st\fP. +.sp +returns the \fI\%gearman_job_st\fP workload. The size of it can be +determined with \fBgearman_job_workload_size()\fP. +\fBgearman_job_take_workload()\fP is the same as +\fBgearman_job_workload()\fP with the exception that the result must be +\fIfree(3)\fP by the caller. +.SH RETURN VALUE +.sp +A value of \fBgearman_return_t\fP is returned. On success that value +will be :c:type::\fIGEARMAN_SUCCESS\fP. Use \fBgearman_strerror()\fP to +translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_log_fn.3 gearmand-0.23/docs/man/gearman_log_fn.3 --- gearmand-0.14/docs/man/gearman_log_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_log_fn.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,65 @@ +.TH "GEARMAN_LOG_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_log_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_log_fn +.UNINDENT +.SH DESCRIPTION +.sp +:c:type:gearman_log_fn is defined as: +.sp +.nf +.ft C +void (gearman_log_fn)(const char *line, gearman_verbose_t verbose, void *context) +.ft P +.fi +.SH RETURN VALUE +.sp +None +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_set_log_fn(3)\fP \fIgearman_worker_set_log_fn(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_parse_servers.3 gearmand-0.23/docs/man/gearman_parse_servers.3 --- gearmand-0.14/docs/man/gearman_parse_servers.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_parse_servers.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_PARSE_SERVERS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_parse_servers \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_parse_servers(const char *servers, +.TP +.B gearman_parse_server_fn *function, +.TP +.B void *context) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_parse_servers()\fP parses a list of servers and call the +\fBgearman_parse_server_fn()\fP for each server. +.SH RETURN VALUE +.sp +A value of type \fBgearman_return_t\fP is returned. +On success that value will be \fBGEARMAN_SUCCESS\fP. +Use gearman_strerror() to translate this value to a printable string. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_boolean.3 gearmand-0.23/docs/man/gearman_result_boolean.3 --- gearmand-0.14/docs/man/gearman_result_boolean.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_boolean.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_BOOLEAN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_boolean \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_integer.3 gearmand-0.23/docs/man/gearman_result_integer.3 --- gearmand-0.14/docs/man/gearman_result_integer.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_integer.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_INTEGER" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_integer \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_is_null.3 gearmand-0.23/docs/man/gearman_result_is_null.3 --- gearmand-0.14/docs/man/gearman_result_is_null.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_is_null.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_IS_NULL" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_is_null \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_size.3 gearmand-0.23/docs/man/gearman_result_size.3 --- gearmand-0.14/docs/man/gearman_result_size.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_size.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_SIZE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_size \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_store_integer.3 gearmand-0.23/docs/man/gearman_result_store_integer.3 --- gearmand-0.14/docs/man/gearman_result_store_integer.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_store_integer.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_STORE_INTEGER" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_store_integer \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_store_string.3 gearmand-0.23/docs/man/gearman_result_store_string.3 --- gearmand-0.14/docs/man/gearman_result_store_string.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_store_string.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_STORE_STRING" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_store_string \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_store_value.3 gearmand-0.23/docs/man/gearman_result_store_value.3 --- gearmand-0.14/docs/man/gearman_result_store_value.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_store_value.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_STORE_VALUE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_store_value \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_result_string.3 gearmand-0.23/docs/man/gearman_result_string.3 --- gearmand-0.14/docs/man/gearman_result_string.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_result_string.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,94 @@ +.TH "GEARMAN_RESULT_STRING" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_result_string \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_result_t +.UNINDENT +.INDENT 0.0 +.TP +.B int64_t gearman_result_integer(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_boolean(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_string_t gearman_result_string(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_string(gearman_result_st\fI\ *self\fP, gearman_string_t\fI\ arg\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_result_store_integer(gearman_result_st\fI\ *self\fP, int64_t\fI\ value\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_result_store_value(gearman_result_st\fI\ *self\fP, const void\fI\ *value\fP, size_t\fI\ size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_result_size(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_result_value(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_result_is_null(const gearman_result_st\fI\ *self\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fBgearman_result_t()\fP type represents a result set. \fBgearman_aggregator_fn\fP is passed on these types which it uses to create a final result that is returned to the client. +.sp +\fBgearman_task_result()\fP returns \fBgearman_result_t()\fP from a \fBgearman_task_st\fP. +.sp +A \fBgearman_result_t()\fP can return the resulting value as either a char pointer, boolean, \fBgearman_string_t\fP, or int64_t. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_return_t.3 gearmand-0.23/docs/man/gearman_return_t.3 --- gearmand-0.14/docs/man/gearman_return_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_return_t.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,360 @@ +.TH "GEARMAN_RETURN_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_return_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_strerror(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_success(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_failed(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_continue(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_return_t\fP is used as a return/error type for all calls using \fBgearman_client_st\fP and \fBgearman_worker_st\fP. +\fI\%GEARMAN_SUCCESS\fP is returned upon success, otherwise an error is returned. \fI\%gearman_failed()\fP can be used to see if the return value is a failing value. +You can print a text version of the error message with \fI\%gearman_strerror()\fP. +.sp +\fI\%gearman_success()\fP return true if \fI\%GEARMAN_SUCCESS\fP or if +\fI\%GEARMAN_NO_PENDING_TASKS\fP tests true. +.sp +\fI\%gearman_failed()\fP return true if any value other then \fI\%GEARMAN_SUCCESS\fP was provided. +.sp +\fI\%gearman_continue()\fP returns true if any error related to non\-blocking IO +occurred. This should be used for testing loops. +.SS Possible values of \fI\%gearman_return_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +Success +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_PENDING_TASKS +. +\fBgearman_client_run_tasks()\fP was called and it has completed all tasks assigned to the client. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IO_WAIT +. +Blocking IO was found. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERRNO +. +System error occurred. Use either \fBgearman_client_errno()\fP or \fBgearman_worker_errno()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_ACTIVE_FDS +. +No active connections were available. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_GETADDRINFO +. +Name resolution failed for a host. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_SERVERS +. +No servers have been provided for the client/worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_LOST_CONNECTION +. +Connection was lost to the given server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_MEMORY_ALLOCATION_FAILURE +. +Memory allocation failed. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SERVER_ERROR +. +An error occurred on the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NOT_CONNECTED +. +Client/Worker is not currently connected to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_COULD_NOT_CONNECT +. +Server name was valid, but a connection could not be made. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ECHO_DATA_CORRUPTION +. +Either \fBgearman_client_echo()\fP or \fBgearman_work_echo()\fP echo was unsuccessful because the data was returned from \fBgearmand\fP corrupted. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNKNOWN_STATE +. +The gearman_return_t was never set. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FLUSH_DATA +. +Internal state, should never be seen by either client or worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SEND_BUFFER_TOO_SMALL +. +Send buffer was too small. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TIMEOUT +. +A timeout occurred when making a request to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ARGUMENT_TOO_LARGE +. +Argument was too large for the current buffer. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_ARGUMENT +. +One of the arguments to the given API call was invalid. EINVAL will be set if \fBgearman_client_error()\fP or \fBgearman_worker_error()\fP were not settable. This can also be returned if \fBGEARMAN_CLIENT_UNBUFFERED_RESULT\fP was set, but the client is not handling the data correctly. +.UNINDENT +.SS CLIENT ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NEED_WORKLOAD_FN +. +A client was asked for work, but no \fBgearman_workload_fn\fP callback was specified. See \fBgearman_client_set_workload_fn()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IN_PROGRESS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently being run by a worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_JOB_EXISTS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently known by a server, but is not being run by a worker. +.UNINDENT +.SS WORKER ONLY +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_FUNCTION_NAME +. +A worker was sent a request for a job that it did not have a valid function for. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_WORKER_FUNCTION +. +No callback was provided by the worker for a given function. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTION +. +A request for removing a given function from a worker was invalid since that function did not exist. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTIONS +. +The worker has not registered any functions. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_JOBS +. +No jobs were found for the worker. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Client which have registed a custom \fBgearman_actions_t\fP may use these +value as return values to the calling client. +.INDENT 0.0 +.TP +.B GEARMAN_WORK_DATA +. +Worker has sent a chunked piece of data to the client via \fBgearman_job_send_data()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_WARNING +. +Worker has issued a warning to the client via \fBgearman_job_send_warning()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_STATUS +. +Status has been updated by the worker via \fBgearman_job_send_status()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_EXCEPTION +. +Worker has sent an exception the client via \fBgearman_job_send_exception()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_PAUSE +. +Used only in custom application for client return based on \fI\%GEARMAN_WORK_DATA\fP, \fI\%GEARMAN_WORK_WARNING\fP, \fI\%GEARMAN_WORK_EXCEPTION\fP, \fI\%GEARMAN_WORK_FAIL\fP, or \fI\%GEARMAN_WORK_STATUS\fP. \fI\%gearman_continue()\fP can be used to check for this value. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Any function defined by \fBgearman_worker_define_function()\fP may, and can only, return the following \fI\%gearman_return_t\fP values. +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +The function successfully completed the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FATAL +. +The function failed to complete the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SHUTDOWN +. +\fI\%GEARMAN_SHUTDOWN\fP is a special case. If it is returned the client will be sent \fI\%GEARMAN_SUCCESS\fP, but \fBgearman_worker_work()\fP will exit with \fI\%GEARMAN_SHUTDOWN\fP. +.UNINDENT +.SS TASK ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NOT_FLUSHING +. +\fBgearman_task_send_workload()\fP failed, it was not in the correct state. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_DATA_TOO_LARGE +. +\fBgearman_task_send_workload()\fP failed, the data was too large to be sent. +.UNINDENT +.SS PROTOCOL +.sp +If any of these errors occurred the connection will be dropped/reset. +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_MAGIC +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_COMMAND +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNEXPECTED_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TOO_MANY_ARGS +.UNINDENT +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_strerror.3 gearmand-0.23/docs/man/gearman_strerror.3 --- gearmand-0.14/docs/man/gearman_strerror.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_strerror.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,360 @@ +.TH "GEARMAN_STRERROR" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_strerror \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_strerror(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_success(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_failed(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_continue(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_return_t\fP is used as a return/error type for all calls using \fBgearman_client_st\fP and \fBgearman_worker_st\fP. +\fI\%GEARMAN_SUCCESS\fP is returned upon success, otherwise an error is returned. \fI\%gearman_failed()\fP can be used to see if the return value is a failing value. +You can print a text version of the error message with \fI\%gearman_strerror()\fP. +.sp +\fI\%gearman_success()\fP return true if \fI\%GEARMAN_SUCCESS\fP or if +\fI\%GEARMAN_NO_PENDING_TASKS\fP tests true. +.sp +\fI\%gearman_failed()\fP return true if any value other then \fI\%GEARMAN_SUCCESS\fP was provided. +.sp +\fI\%gearman_continue()\fP returns true if any error related to non\-blocking IO +occurred. This should be used for testing loops. +.SS Possible values of \fI\%gearman_return_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +Success +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_PENDING_TASKS +. +\fBgearman_client_run_tasks()\fP was called and it has completed all tasks assigned to the client. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IO_WAIT +. +Blocking IO was found. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERRNO +. +System error occurred. Use either \fBgearman_client_errno()\fP or \fBgearman_worker_errno()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_ACTIVE_FDS +. +No active connections were available. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_GETADDRINFO +. +Name resolution failed for a host. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_SERVERS +. +No servers have been provided for the client/worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_LOST_CONNECTION +. +Connection was lost to the given server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_MEMORY_ALLOCATION_FAILURE +. +Memory allocation failed. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SERVER_ERROR +. +An error occurred on the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NOT_CONNECTED +. +Client/Worker is not currently connected to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_COULD_NOT_CONNECT +. +Server name was valid, but a connection could not be made. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ECHO_DATA_CORRUPTION +. +Either \fBgearman_client_echo()\fP or \fBgearman_work_echo()\fP echo was unsuccessful because the data was returned from \fBgearmand\fP corrupted. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNKNOWN_STATE +. +The gearman_return_t was never set. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FLUSH_DATA +. +Internal state, should never be seen by either client or worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SEND_BUFFER_TOO_SMALL +. +Send buffer was too small. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TIMEOUT +. +A timeout occurred when making a request to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ARGUMENT_TOO_LARGE +. +Argument was too large for the current buffer. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_ARGUMENT +. +One of the arguments to the given API call was invalid. EINVAL will be set if \fBgearman_client_error()\fP or \fBgearman_worker_error()\fP were not settable. This can also be returned if \fBGEARMAN_CLIENT_UNBUFFERED_RESULT\fP was set, but the client is not handling the data correctly. +.UNINDENT +.SS CLIENT ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NEED_WORKLOAD_FN +. +A client was asked for work, but no \fBgearman_workload_fn\fP callback was specified. See \fBgearman_client_set_workload_fn()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IN_PROGRESS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently being run by a worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_JOB_EXISTS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently known by a server, but is not being run by a worker. +.UNINDENT +.SS WORKER ONLY +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_FUNCTION_NAME +. +A worker was sent a request for a job that it did not have a valid function for. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_WORKER_FUNCTION +. +No callback was provided by the worker for a given function. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTION +. +A request for removing a given function from a worker was invalid since that function did not exist. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTIONS +. +The worker has not registered any functions. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_JOBS +. +No jobs were found for the worker. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Client which have registed a custom \fBgearman_actions_t\fP may use these +value as return values to the calling client. +.INDENT 0.0 +.TP +.B GEARMAN_WORK_DATA +. +Worker has sent a chunked piece of data to the client via \fBgearman_job_send_data()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_WARNING +. +Worker has issued a warning to the client via \fBgearman_job_send_warning()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_STATUS +. +Status has been updated by the worker via \fBgearman_job_send_status()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_EXCEPTION +. +Worker has sent an exception the client via \fBgearman_job_send_exception()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_PAUSE +. +Used only in custom application for client return based on \fI\%GEARMAN_WORK_DATA\fP, \fI\%GEARMAN_WORK_WARNING\fP, \fI\%GEARMAN_WORK_EXCEPTION\fP, \fI\%GEARMAN_WORK_FAIL\fP, or \fI\%GEARMAN_WORK_STATUS\fP. \fI\%gearman_continue()\fP can be used to check for this value. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Any function defined by \fBgearman_worker_define_function()\fP may, and can only, return the following \fI\%gearman_return_t\fP values. +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +The function successfully completed the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FATAL +. +The function failed to complete the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SHUTDOWN +. +\fI\%GEARMAN_SHUTDOWN\fP is a special case. If it is returned the client will be sent \fI\%GEARMAN_SUCCESS\fP, but \fBgearman_worker_work()\fP will exit with \fI\%GEARMAN_SHUTDOWN\fP. +.UNINDENT +.SS TASK ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NOT_FLUSHING +. +\fBgearman_task_send_workload()\fP failed, it was not in the correct state. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_DATA_TOO_LARGE +. +\fBgearman_task_send_workload()\fP failed, the data was too large to be sent. +.UNINDENT +.SS PROTOCOL +.sp +If any of these errors occurred the connection will be dropped/reset. +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_MAGIC +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_COMMAND +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNEXPECTED_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TOO_MANY_ARGS +.UNINDENT +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_string_t.3 gearmand-0.23/docs/man/gearman_string_t.3 --- gearmand-0.14/docs/man/gearman_string_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_string_t.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,64 @@ +.TH "GEARMAN_STRING_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_string_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_string_t +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_size(gearman_string_t); +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_c_str(gearman_string_t); +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +The \fI\%gearman_string_t\fP is a simple type representing a "string". +Once created \fI\%gearman_string_t\fP are not mutable once created. They +only point to the strings that define them and require no deallocation. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_success.3 gearmand-0.23/docs/man/gearman_success.3 --- gearmand-0.14/docs/man/gearman_success.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_success.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,360 @@ +.TH "GEARMAN_SUCCESS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_success \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_strerror(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_success(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_failed(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_continue(\fI\%gearman_return_t\fP\fI\ rc\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_return_t\fP is used as a return/error type for all calls using \fBgearman_client_st\fP and \fBgearman_worker_st\fP. +\fI\%GEARMAN_SUCCESS\fP is returned upon success, otherwise an error is returned. \fI\%gearman_failed()\fP can be used to see if the return value is a failing value. +You can print a text version of the error message with \fI\%gearman_strerror()\fP. +.sp +\fI\%gearman_success()\fP return true if \fI\%GEARMAN_SUCCESS\fP or if +\fI\%GEARMAN_NO_PENDING_TASKS\fP tests true. +.sp +\fI\%gearman_failed()\fP return true if any value other then \fI\%GEARMAN_SUCCESS\fP was provided. +.sp +\fI\%gearman_continue()\fP returns true if any error related to non\-blocking IO +occurred. This should be used for testing loops. +.SS Possible values of \fI\%gearman_return_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +Success +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_PENDING_TASKS +. +\fBgearman_client_run_tasks()\fP was called and it has completed all tasks assigned to the client. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IO_WAIT +. +Blocking IO was found. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERRNO +. +System error occurred. Use either \fBgearman_client_errno()\fP or \fBgearman_worker_errno()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_ACTIVE_FDS +. +No active connections were available. gearman_continue() can be used to test for this. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_GETADDRINFO +. +Name resolution failed for a host. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_SERVERS +. +No servers have been provided for the client/worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_LOST_CONNECTION +. +Connection was lost to the given server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_MEMORY_ALLOCATION_FAILURE +. +Memory allocation failed. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SERVER_ERROR +. +An error occurred on the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NOT_CONNECTED +. +Client/Worker is not currently connected to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_COULD_NOT_CONNECT +. +Server name was valid, but a connection could not be made. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ECHO_DATA_CORRUPTION +. +Either \fBgearman_client_echo()\fP or \fBgearman_work_echo()\fP echo was unsuccessful because the data was returned from \fBgearmand\fP corrupted. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNKNOWN_STATE +. +The gearman_return_t was never set. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FLUSH_DATA +. +Internal state, should never be seen by either client or worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SEND_BUFFER_TOO_SMALL +. +Send buffer was too small. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TIMEOUT +. +A timeout occurred when making a request to the server. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ARGUMENT_TOO_LARGE +. +Argument was too large for the current buffer. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_ARGUMENT +. +One of the arguments to the given API call was invalid. EINVAL will be set if \fBgearman_client_error()\fP or \fBgearman_worker_error()\fP were not settable. This can also be returned if \fBGEARMAN_CLIENT_UNBUFFERED_RESULT\fP was set, but the client is not handling the data correctly. +.UNINDENT +.SS CLIENT ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NEED_WORKLOAD_FN +. +A client was asked for work, but no \fBgearman_workload_fn\fP callback was specified. See \fBgearman_client_set_workload_fn()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_IN_PROGRESS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently being run by a worker. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_JOB_EXISTS +. +\fBgearman_client_job_status()\fP has been called for a \fBgearman_job_handle_t\fP and the Job is currently known by a server, but is not being run by a worker. +.UNINDENT +.SS WORKER ONLY +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_FUNCTION_NAME +. +A worker was sent a request for a job that it did not have a valid function for. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_WORKER_FUNCTION +. +No callback was provided by the worker for a given function. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTION +. +A request for removing a given function from a worker was invalid since that function did not exist. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_REGISTERED_FUNCTIONS +. +The worker has not registered any functions. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_NO_JOBS +. +No jobs were found for the worker. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Client which have registed a custom \fBgearman_actions_t\fP may use these +value as return values to the calling client. +.INDENT 0.0 +.TP +.B GEARMAN_WORK_DATA +. +Worker has sent a chunked piece of data to the client via \fBgearman_job_send_data()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_WARNING +. +Worker has issued a warning to the client via \fBgearman_job_send_warning()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_STATUS +. +Status has been updated by the worker via \fBgearman_job_send_status()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_EXCEPTION +. +Worker has sent an exception the client via \fBgearman_job_send_exception()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_FAIL +. +A task has failed, and the worker has exited with an error or it called \fBgearman_job_send_fail()\fP +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_WORK_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_PAUSE +. +Used only in custom application for client return based on \fI\%GEARMAN_WORK_DATA\fP, \fI\%GEARMAN_WORK_WARNING\fP, \fI\%GEARMAN_WORK_EXCEPTION\fP, \fI\%GEARMAN_WORK_FAIL\fP, or \fI\%GEARMAN_WORK_STATUS\fP. \fI\%gearman_continue()\fP can be used to check for this value. +.UNINDENT +.SS WORKER TO CLIENT +.sp +Any function defined by \fBgearman_worker_define_function()\fP may, and can only, return the following \fI\%gearman_return_t\fP values. +.INDENT 0.0 +.TP +.B GEARMAN_SUCCESS +. +The function successfully completed the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_FATAL +. +The function failed to complete the job. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_ERROR +. +A task has had an error and will be retried. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_SHUTDOWN +. +\fI\%GEARMAN_SHUTDOWN\fP is a special case. If it is returned the client will be sent \fI\%GEARMAN_SUCCESS\fP, but \fBgearman_worker_work()\fP will exit with \fI\%GEARMAN_SHUTDOWN\fP. +.UNINDENT +.SS TASK ONLY +.INDENT 0.0 +.TP +.B GEARMAN_NOT_FLUSHING +. +\fBgearman_task_send_workload()\fP failed, it was not in the correct state. +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_DATA_TOO_LARGE +. +\fBgearman_task_send_workload()\fP failed, the data was too large to be sent. +.UNINDENT +.SS PROTOCOL +.sp +If any of these errors occurred the connection will be dropped/reset. +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_MAGIC +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_COMMAND +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_INVALID_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_UNEXPECTED_PACKET +.UNINDENT +.INDENT 0.0 +.TP +.B GEARMAN_TOO_MANY_ARGS +.UNINDENT +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error()\fP or \fIgearman_worker_error()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_attr_init.3 gearmand-0.23/docs/man/gearman_task_attr_init.3 --- gearmand-0.14/docs/man/gearman_task_attr_init.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_attr_init.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,72 @@ +.TH "GEARMAN_TASK_ATTR_INIT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_attr_init \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_work_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work(gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_epoch(time_t epoch, gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_background(gearman_job_priority_t priority); +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. +.sp +\fBgearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. +.sp +\fBgearman_work_epoch()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload at the time specified by epoch. +.sp +\fBgearman_work_background()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload as a background job. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_execute()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_attr_init_background.3 gearmand-0.23/docs/man/gearman_task_attr_init_background.3 --- gearmand-0.14/docs/man/gearman_task_attr_init_background.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_attr_init_background.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,72 @@ +.TH "GEARMAN_TASK_ATTR_INIT_BACKGROUND" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_attr_init_background \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_work_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work(gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_epoch(time_t epoch, gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_background(gearman_job_priority_t priority); +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. +.sp +\fBgearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. +.sp +\fBgearman_work_epoch()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload at the time specified by epoch. +.sp +\fBgearman_work_background()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload as a background job. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_execute()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_attr_init_epoch.3 gearmand-0.23/docs/man/gearman_task_attr_init_epoch.3 --- gearmand-0.14/docs/man/gearman_task_attr_init_epoch.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_attr_init_epoch.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,72 @@ +.TH "GEARMAN_TASK_ATTR_INIT_EPOCH" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_attr_init_epoch \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_work_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work(gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_epoch(time_t epoch, gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_background(gearman_job_priority_t priority); +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. +.sp +\fBgearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. +.sp +\fBgearman_work_epoch()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload at the time specified by epoch. +.sp +\fBgearman_work_background()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload as a background job. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_execute()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_attr_t.3 gearmand-0.23/docs/man/gearman_task_attr_t.3 --- gearmand-0.14/docs/man/gearman_task_attr_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_attr_t.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,72 @@ +.TH "GEARMAN_TASK_ATTR_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_attr_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_work_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work(gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_epoch(time_t epoch, gearman_job_priority_t priority); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_work_t gearman_work_background(gearman_job_priority_t priority); +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. +.sp +\fBgearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. +.sp +\fBgearman_work_epoch()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload at the time specified by epoch. +.sp +\fBgearman_work_background()\fP creates a \fI\%gearman_work_t\fP which tells \fBgearman_execute()\fP to execute the workload as a background job. +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_execute()\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_context.3 gearmand-0.23/docs/man/gearman_task_context.3 --- gearmand-0.14/docs/man/gearman_task_context.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_context.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_CONTEXT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_context \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_data.3 gearmand-0.23/docs/man/gearman_task_data.3 --- gearmand-0.14/docs/man/gearman_task_data.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_data.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_DATA" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_data \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_data_size.3 gearmand-0.23/docs/man/gearman_task_data_size.3 --- gearmand-0.14/docs/man/gearman_task_data_size.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_data_size.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_DATA_SIZE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_data_size \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_denominator.3 gearmand-0.23/docs/man/gearman_task_denominator.3 --- gearmand-0.14/docs/man/gearman_task_denominator.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_denominator.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_DENOMINATOR" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_denominator \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_error.3 gearmand-0.23/docs/man/gearman_task_error.3 --- gearmand-0.14/docs/man/gearman_task_error.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_error.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_ERROR" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_error \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_free.3 gearmand-0.23/docs/man/gearman_task_free.3 --- gearmand-0.14/docs/man/gearman_task_free.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_free.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_FREE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_free \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_function_name.3 gearmand-0.23/docs/man/gearman_task_function_name.3 --- gearmand-0.14/docs/man/gearman_task_function_name.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_function_name.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_FUNCTION_NAME" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_function_name \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_give_workload.3 gearmand-0.23/docs/man/gearman_task_give_workload.3 --- gearmand-0.14/docs/man/gearman_task_give_workload.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_give_workload.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_GIVE_WORKLOAD" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_give_workload \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_is_known.3 gearmand-0.23/docs/man/gearman_task_is_known.3 --- gearmand-0.14/docs/man/gearman_task_is_known.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_is_known.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_IS_KNOWN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_is_known \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_is_running.3 gearmand-0.23/docs/man/gearman_task_is_running.3 --- gearmand-0.14/docs/man/gearman_task_is_running.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_is_running.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_IS_RUNNING" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_is_running \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_job_handle.3 gearmand-0.23/docs/man/gearman_task_job_handle.3 --- gearmand-0.14/docs/man/gearman_task_job_handle.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_job_handle.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_JOB_HANDLE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_job_handle \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_numerator.3 gearmand-0.23/docs/man/gearman_task_numerator.3 --- gearmand-0.14/docs/man/gearman_task_numerator.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_numerator.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_NUMERATOR" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_numerator \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_recv_data.3 gearmand-0.23/docs/man/gearman_task_recv_data.3 --- gearmand-0.14/docs/man/gearman_task_recv_data.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_recv_data.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_RECV_DATA" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_recv_data \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_return.3 gearmand-0.23/docs/man/gearman_task_return.3 --- gearmand-0.14/docs/man/gearman_task_return.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_return.3 2011-06-29 23:00:20.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_RETURN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_return \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_send_workload.3 gearmand-0.23/docs/man/gearman_task_send_workload.3 --- gearmand-0.14/docs/man/gearman_task_send_workload.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_send_workload.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_SEND_WORKLOAD" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_send_workload \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_set_context.3 gearmand-0.23/docs/man/gearman_task_set_context.3 --- gearmand-0.14/docs/man/gearman_task_set_context.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_set_context.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_SET_CONTEXT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_set_context \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_st.3 gearmand-0.23/docs/man/gearman_task_st.3 --- gearmand-0.14/docs/man/gearman_task_st.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_st.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_ST" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_st \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_take_data.3 gearmand-0.23/docs/man/gearman_task_take_data.3 --- gearmand-0.14/docs/man/gearman_task_take_data.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_take_data.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_TAKE_DATA" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_take_data \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_task_unique.3 gearmand-0.23/docs/man/gearman_task_unique.3 --- gearmand-0.14/docs/man/gearman_task_unique.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_task_unique.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,160 @@ +.TH "GEARMAN_TASK_UNIQUE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_task_unique \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_task_st +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_free(\fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_context(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_set_context(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_function_name(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_unique(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_job_handle(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_known(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_task_is_running(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_numerator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B uint32_t gearman_task_denominator(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_task_give_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_send_workload(\fI\%gearman_task_st\fP\fI\ *task\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const void *gearman_task_data(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_data_size(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_task_take_data(\fI\%gearman_task_st\fP\fI\ *task\fP, size_t\fI\ *data_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B size_t gearman_task_recv_data(\fI\%gearman_task_st\fP\fI\ *task\fP, void\fI\ *data\fP, size_t\fI\ data_size\fP, gearman_return_t\fI\ *ret_ptr\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B const char *gearman_task_error(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.INDENT 0.0 +.TP +.B gearman_return_t gearman_task_return(const \fI\%gearman_task_st\fP\fI\ *task\fP) +.UNINDENT +.sp +New in version 0.21. +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +A \fI\%gearman_task_st\fP represents a \fItask\fP. Work that is sent by a \fIclient\fP to a gearman server is seen as a task (a \fIworker\fP recieves a task in the form of a \fIjob\fP. +.sp +Tasks, i.e. \fI\%gearman_task_st\fP are created by calling either +\fBgearman_execute()\fP, \fBgearman_client_add_task()\fP, or +\fBgearman_client_add_task_background()\fP. +.sp +\fBgearman_client_add_task_status()\fP can also create \fI\%gearman_task_st\fP, these tasks will be used to +monitor a previously created \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_free()\fP is used to free a task. This only needs to be +done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. +.sp +\fI\%gearman_task_set_context()\fP sets the given context of the \fI\%gearman_task_st\fP. The context can be used to pass information to a \fI\%gearman_task_st\fP. +.sp +\fI\%gearman_task_context()\fP returns the context that was used in the creation of the \fI\%gearman_task_st\fP (or that was set with \fI\%gearman_task_set_context()\fP. +.sp +\fI\%gearman_task_data()\fP returns the current data that has been returned to the task. \fI\%gearman_task_data_size()\fP will give you the size of the value. \fI\%gearman_task_take_data()\fP is the same as \fI\%gearman_task_data()\fP but the value that is returned must be freed by the client (\fIfree(3)\fP). \fI\%gearman_task_recv_data()\fP can be used with pre\-allocated buffers. +.sp +\fI\%gearman_task_is_known()\fP, \fI\%gearman_task_is_running()\fP, \fI\%gearman_task_numerator()\fP, and \fI\%gearman_task_denominator()\fP, return values related to the last status update that was made to the \fI\%gearman_task_st\fP. They do not cause the \fI\%gearman_task_st\fP to update itself. +.sp +\fI\%gearman_task_error()\fP return the last error message that the +\fI\%gearman_task_st\fP encountered. \fI\%gearman_task_return()\fP +return the last \fBgearman_return_t\fP stored. A value of +\fBGEARMAN_UNKNOWN_STATE\fP means that the task has not been submitted to server yet. +.SH RETURN VALUE +.sp +Various. Values that are returned by \fI\%gearman_task_take_data()\fP must have \fIfree(3)\fP called on them. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_verbose_name.3 gearmand-0.23/docs/man/gearman_verbose_name.3 --- gearmand-0.14/docs/man/gearman_verbose_name.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_verbose_name.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,87 @@ +.TH "GEARMAN_VERBOSE_NAME" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_verbose_name \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_verbose_name(gearman_verbose_t\fI\ verbose\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_verbose_name()\fP takes a \fBgearman_verbose_t\fP and returns a character representation of it. +.sp +Possible values of \fBgearman_verbose_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_FATAL +.UNINDENT +.sp +Fatal errors. +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_ERROR +.UNINDENT +.sp +All errors. +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_INFO +.UNINDENT +.sp +General information state about any events. +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_DEBUG +.UNINDENT +.sp +Information calls left in the code for debugging events. +.SH RETURN VALUE +.sp +A character string representing the verbose leval. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_verbose_t.3 gearmand-0.23/docs/man/gearman_verbose_t.3 --- gearmand-0.14/docs/man/gearman_verbose_t.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_verbose_t.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,87 @@ +.TH "GEARMAN_VERBOSE_T" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_verbose_t \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_verbose_name(gearman_verbose_t\fI\ verbose\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_verbose_name()\fP takes a \fBgearman_verbose_t\fP and returns a character representation of it. +.sp +Possible values of \fBgearman_verbose_t\fP: +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_FATAL +.UNINDENT +.sp +Fatal errors. +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_ERROR +.UNINDENT +.sp +All errors. +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_INFO +.UNINDENT +.sp +General information state about any events. +.INDENT 0.0 +.TP +.B GEARMAN_VERBOSE_DEBUG +.UNINDENT +.sp +Information calls left in the code for debugging events. +.SH RETURN VALUE +.sp +A character string representing the verbose leval. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_version.3 gearmand-0.23/docs/man/gearman_version.3 --- gearmand-0.14/docs/man/gearman_version.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_version.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,61 @@ +.TH "GEARMAN_VERSION" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_version \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_version(gearman_verbose_t\fI\ verbose\fP) +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +Return the version of the library. +.SH RETURN VALUE +.sp +A constant C style string. No deallocation is required. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_add_function.3 gearmand-0.23/docs/man/gearman_worker_add_function.3 --- gearmand-0.14/docs/man/gearman_worker_add_function.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_add_function.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_ADD_FUNCTION" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_add_function \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_add_options.3 gearmand-0.23/docs/man/gearman_worker_add_options.3 --- gearmand-0.14/docs/man/gearman_worker_add_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_add_options.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,90 @@ +.TH "GEARMAN_WORKER_ADD_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_add_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_options_t gearman_worker_options(const gearman_worker_st\fI\ *worker\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_add_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.sp +Deprecated since version 0.21. +.SH DESCRIPTION +.sp +\fI\%gearman_worker_options()\fP returns the \fBgearman_worker_options_t\fP for \fBgearman_worker_st\fP. You enable options via \fI\%gearman_worker_add_options()\fP and disable options via \fI\%gearman_worker_remove_options()\fP. +.sp +The currently supported options are: +.sp +Enable non\-block IO for the worker. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_GRAB_UNIQ +.UNINDENT +.sp +Only grab jobs that have been assigned unique values. This is useful for workers who only want to worker with background jobs. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_TIMEOUT_RETURN +.UNINDENT +.sp +Has a return timeout been set for the worker. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_add_server.3 gearmand-0.23/docs/man/gearman_worker_add_server.3 --- gearmand-0.14/docs/man/gearman_worker_add_server.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_add_server.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,83 @@ +.TH "GEARMAN_WORKER_ADD_SERVER" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_add_server \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_add_server(gearman_worker_st *worker, const char *host, in_port_t port); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_add_servers(gearman_worker_st *worker, const char *servers); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_servers(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_worker_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the worker will take work from. +.sp +\fBgearman_worker_remove_servers()\fP will remove all servers from the \fBgearman_worker_st\fP. +.sp +\fBgearman_worker_add_servers()\fP takes a list of \fBgearmand\fP servers that will be parsed to provide servers for the worker. The format for this is SERVER[:PORT][,SERVER[:PORT]]... +.sp +Examples of this are: +.sp +.nf +.ft C +10.0.0.1,10.0.0.2,10.0.0.3 +localhost234,jobserver2.domain.com:7003,10.0.0.3 +.ft P +.fi +.SH RETURN VALUE +.sp +\fBgearman_worker_add_server()\fP and \fBgearman_worker_remove_servers()\fP return \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_add_servers.3 gearmand-0.23/docs/man/gearman_worker_add_servers.3 --- gearmand-0.14/docs/man/gearman_worker_add_servers.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_add_servers.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,83 @@ +.TH "GEARMAN_WORKER_ADD_SERVERS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_add_servers \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_add_server(gearman_worker_st *worker, const char *host, in_port_t port); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_add_servers(gearman_worker_st *worker, const char *servers); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_servers(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_worker_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the worker will take work from. +.sp +\fBgearman_worker_remove_servers()\fP will remove all servers from the \fBgearman_worker_st\fP. +.sp +\fBgearman_worker_add_servers()\fP takes a list of \fBgearmand\fP servers that will be parsed to provide servers for the worker. The format for this is SERVER[:PORT][,SERVER[:PORT]]... +.sp +Examples of this are: +.sp +.nf +.ft C +10.0.0.1,10.0.0.2,10.0.0.3 +localhost234,jobserver2.domain.com:7003,10.0.0.3 +.ft P +.fi +.SH RETURN VALUE +.sp +\fBgearman_worker_add_server()\fP and \fBgearman_worker_remove_servers()\fP return \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_clone.3 gearmand-0.23/docs/man/gearman_worker_clone.3 --- gearmand-0.14/docs/man/gearman_worker_clone.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_clone.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,91 @@ +.TH "GEARMAN_WORKER_CLONE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_clone \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st *gearman_worker_create(gearman_worker_st *client); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_worker_st *gearman_worker_clone(gearman_worker_st *client, const gearman_worker_st *from); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_free(gearman_worker_st *client); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +gearman_worker_create() is used to create a \fBgearman_worker_st\fP structure that will then +be used by other libgearman(3) client functions to communicate with the server. You +should either pass a statically declared \fBgearman_worker_st\fP to gearman_worker_create() or +a NULL. If a NULL passed in then a structure is allocated for you. +.sp +\fBgearman_worker_clone()\fP is similar to \fBgearman_worker_create()\fP but it copies the +defaults and list of servers from the source \fBgearman_worker_st\fP. If you pass a null as +the argument for the source to clone, it is the same as a call to gearman_worker_create(). +If the destination argument is NULL a \fBgearman_worker_st\fP will be allocated for you. +.sp +To clean up memory associated with a \fBgearman_worker_st\fP structure you should pass +it to \fBgearman_worker_free()\fP when you are finished using it. \fBgearman_worker_free()\fP is +the only way to make sure all memory is deallocated when you finish using +the structure. +.sp +You may wish to avoid using \fBgearman_worker_create()\fP or \fBgearman_worker_clone()\fP with a +stack based allocation, ie the first parameter. The most common issues related to ABI safety involve +heap allocated structures. +.SH RETURN VALUE +.sp +\fBgearman_worker_create()\fP returns a pointer to the \fBgearman_worker_st\fP that was created +(or initialized). On an allocation failure, it returns NULL. +.sp +\fBgearman_worker_clone()\fP returns a pointer to the \fBgearman_worker_st\fP that was created +(or initialized). On an allocation failure, it returns NULL. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_context.3 gearmand-0.23/docs/man/gearman_worker_context.3 --- gearmand-0.14/docs/man/gearman_worker_context.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_context.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_CONTEXT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_context \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_create.3 gearmand-0.23/docs/man/gearman_worker_create.3 --- gearmand-0.14/docs/man/gearman_worker_create.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_create.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,91 @@ +.TH "GEARMAN_WORKER_CREATE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_create \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st *gearman_worker_create(gearman_worker_st *client); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_worker_st *gearman_worker_clone(gearman_worker_st *client, const gearman_worker_st *from); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_free(gearman_worker_st *client); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +gearman_worker_create() is used to create a \fBgearman_worker_st\fP structure that will then +be used by other libgearman(3) client functions to communicate with the server. You +should either pass a statically declared \fBgearman_worker_st\fP to gearman_worker_create() or +a NULL. If a NULL passed in then a structure is allocated for you. +.sp +\fBgearman_worker_clone()\fP is similar to \fBgearman_worker_create()\fP but it copies the +defaults and list of servers from the source \fBgearman_worker_st\fP. If you pass a null as +the argument for the source to clone, it is the same as a call to gearman_worker_create(). +If the destination argument is NULL a \fBgearman_worker_st\fP will be allocated for you. +.sp +To clean up memory associated with a \fBgearman_worker_st\fP structure you should pass +it to \fBgearman_worker_free()\fP when you are finished using it. \fBgearman_worker_free()\fP is +the only way to make sure all memory is deallocated when you finish using +the structure. +.sp +You may wish to avoid using \fBgearman_worker_create()\fP or \fBgearman_worker_clone()\fP with a +stack based allocation, ie the first parameter. The most common issues related to ABI safety involve +heap allocated structures. +.SH RETURN VALUE +.sp +\fBgearman_worker_create()\fP returns a pointer to the \fBgearman_worker_st\fP that was created +(or initialized). On an allocation failure, it returns NULL. +.sp +\fBgearman_worker_clone()\fP returns a pointer to the \fBgearman_worker_st\fP that was created +(or initialized). On an allocation failure, it returns NULL. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_define_function.3 gearmand-0.23/docs/man/gearman_worker_define_function.3 --- gearmand-0.14/docs/man/gearman_worker_define_function.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_define_function.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,97 @@ +.TH "GEARMAN_WORKER_DEFINE_FUNCTION" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_define_function \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_define_function(gearman_worker_st\fI\ *worker\fP, const char\fI\ *function_name\fP, const size_t\fI\ function_name_length\fP, const gearman_function_t\fI\ function\fP, const uint32_t\fI\ timeout\fP, void\fI\ *context\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_function_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_aggregator_fn +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_define_function()\fP defines functions for a worker. +.sp +The interface is callback by design. When the server has a job for the worker, \fI\%gearman_function_fn\fP is evoked with a \fBgearman_job_st\fP representing the job, and the context that was defined originally when the function was defined. +.sp +Results are sent back to the client by invoking \fBgearman_job_send_data()\fP. +.sp +If the client specified an reducer function, then the output of the \fI\%gearman_function_fn\fP will be sent to that function. You can split the work out to the reducer function by sending data multiple times with \fBgearman_job_send_data()\fP. +.sp +If any errors are detected then the entire job is cancelled. The \fI\%gearman_aggregator_fn\fP will +be called when all mapped jobs have completed. The result of this function +will be what is returned to the client. +.sp +The callback function needs to return one of the following errors: +.sp +\fBGEARMAN_SUCCESS\fP +.sp +The function was successful. +.sp +\fBGEARMAN_FATAL\fP +.sp +An error has occurred, the job we not processed, and the worker cannot continue. +.sp +\fBGEARMAN_ERROR\fP +.sp +A transient error has occurred, like a network failure, and the job can be restarted. +.sp +If a value other then the above are returned it is converted to a \fBGEARMAN_FATAL\fP and \fBgearman_worker_work()\fP returns \fBGEARMAN_INVALID_ARGUMENT\fP. +.sp +\fBgearman_job_send_complete()\fP and \fBgearman_job_send_fail()\fP cannot be used with any functions created with \fI\%gearman_worker_define_function()\fP. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_error\fP \fIgearman_client_execute_reduce\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_echo.3 gearmand-0.23/docs/man/gearman_worker_echo.3 --- gearmand-0.14/docs/man/gearman_worker_echo.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_echo.3 2011-06-29 23:00:19.000000000 +0200 @@ -0,0 +1,64 @@ +.TH "GEARMAN_WORKER_ECHO" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_echo \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_echo(gearman_client_st *client, const void *workload, size_t workload_size); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_echo(gearman_worker_st *worker, const void *workload, size_t workload_size); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_client_echo()\fP and \fBgearman_worker_echo()\fP send a message to a \fBgearmand\fP server. The server will then respond with the message that it sent. These commands are just for testing the connection to the servers that were configure for the \fBgearman_client_st\fP and the \fBgearman_worker_st\fP that were used. +.SH RETURN VALUE +.sp +\fBgearman_return_t\fP +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_errno.3 gearmand-0.23/docs/man/gearman_worker_errno.3 --- gearmand-0.14/docs/man/gearman_worker_errno.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_errno.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,66 @@ +.TH "GEARMAN_WORKER_ERRNO" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_errno \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_worker_error(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_errno(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_worker_error()\fP and \fBgearman_worker_errno()\fP report on the last errors that the worker reported/stored in \fBgearman_worker_st()\fP. If you are interested in recording all errors please see \fBgearman_worker_set_log_fn()\fP. +.SH RETURN VALUE +.sp +\fBgearman_worker_errno()\fP returns the last \fIerrno\fP that the worker recorded. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_error.3 gearmand-0.23/docs/man/gearman_worker_error.3 --- gearmand-0.14/docs/man/gearman_worker_error.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_error.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,66 @@ +.TH "GEARMAN_WORKER_ERROR" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_error \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B const char *gearman_worker_error(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_errno(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_worker_error()\fP and \fBgearman_worker_errno()\fP report on the last errors that the worker reported/stored in \fBgearman_worker_st()\fP. If you are interested in recording all errors please see \fBgearman_worker_set_log_fn()\fP. +.SH RETURN VALUE +.sp +\fBgearman_worker_errno()\fP returns the last \fIerrno\fP that the worker recorded. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_free.3 gearmand-0.23/docs/man/gearman_worker_free.3 --- gearmand-0.14/docs/man/gearman_worker_free.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_free.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,91 @@ +.TH "GEARMAN_WORKER_FREE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_free \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st *gearman_worker_create(gearman_worker_st *client); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_worker_st *gearman_worker_clone(gearman_worker_st *client, const gearman_worker_st *from); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_free(gearman_worker_st *client); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +gearman_worker_create() is used to create a \fBgearman_worker_st\fP structure that will then +be used by other libgearman(3) client functions to communicate with the server. You +should either pass a statically declared \fBgearman_worker_st\fP to gearman_worker_create() or +a NULL. If a NULL passed in then a structure is allocated for you. +.sp +\fBgearman_worker_clone()\fP is similar to \fBgearman_worker_create()\fP but it copies the +defaults and list of servers from the source \fBgearman_worker_st\fP. If you pass a null as +the argument for the source to clone, it is the same as a call to gearman_worker_create(). +If the destination argument is NULL a \fBgearman_worker_st\fP will be allocated for you. +.sp +To clean up memory associated with a \fBgearman_worker_st\fP structure you should pass +it to \fBgearman_worker_free()\fP when you are finished using it. \fBgearman_worker_free()\fP is +the only way to make sure all memory is deallocated when you finish using +the structure. +.sp +You may wish to avoid using \fBgearman_worker_create()\fP or \fBgearman_worker_clone()\fP with a +stack based allocation, ie the first parameter. The most common issues related to ABI safety involve +heap allocated structures. +.SH RETURN VALUE +.sp +\fBgearman_worker_create()\fP returns a pointer to the \fBgearman_worker_st\fP that was created +(or initialized). On an allocation failure, it returns NULL. +.sp +\fBgearman_worker_clone()\fP returns a pointer to the \fBgearman_worker_st\fP that was created +(or initialized). On an allocation failure, it returns NULL. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_function_exist.3 gearmand-0.23/docs/man/gearman_worker_function_exist.3 --- gearmand-0.14/docs/man/gearman_worker_function_exist.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_function_exist.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_FUNCTION_EXIST" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_function_exist \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_grab_job.3 gearmand-0.23/docs/man/gearman_worker_grab_job.3 --- gearmand-0.14/docs/man/gearman_worker_grab_job.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_grab_job.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_GRAB_JOB" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_grab_job \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_options.3 gearmand-0.23/docs/man/gearman_worker_options.3 --- gearmand-0.14/docs/man/gearman_worker_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_options.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,90 @@ +.TH "GEARMAN_WORKER_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_options_t gearman_worker_options(const gearman_worker_st\fI\ *worker\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_add_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.sp +Deprecated since version 0.21. +.SH DESCRIPTION +.sp +\fI\%gearman_worker_options()\fP returns the \fBgearman_worker_options_t\fP for \fBgearman_worker_st\fP. You enable options via \fI\%gearman_worker_add_options()\fP and disable options via \fI\%gearman_worker_remove_options()\fP. +.sp +The currently supported options are: +.sp +Enable non\-block IO for the worker. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_GRAB_UNIQ +.UNINDENT +.sp +Only grab jobs that have been assigned unique values. This is useful for workers who only want to worker with background jobs. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_TIMEOUT_RETURN +.UNINDENT +.sp +Has a return timeout been set for the worker. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_register.3 gearmand-0.23/docs/man/gearman_worker_register.3 --- gearmand-0.14/docs/man/gearman_worker_register.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_register.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_REGISTER" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_register \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_remove_options.3 gearmand-0.23/docs/man/gearman_worker_remove_options.3 --- gearmand-0.14/docs/man/gearman_worker_remove_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_remove_options.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,90 @@ +.TH "GEARMAN_WORKER_REMOVE_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_remove_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_options_t gearman_worker_options(const gearman_worker_st\fI\ *worker\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_add_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.sp +Deprecated since version 0.21. +.SH DESCRIPTION +.sp +\fI\%gearman_worker_options()\fP returns the \fBgearman_worker_options_t\fP for \fBgearman_worker_st\fP. You enable options via \fI\%gearman_worker_add_options()\fP and disable options via \fI\%gearman_worker_remove_options()\fP. +.sp +The currently supported options are: +.sp +Enable non\-block IO for the worker. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_GRAB_UNIQ +.UNINDENT +.sp +Only grab jobs that have been assigned unique values. This is useful for workers who only want to worker with background jobs. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_TIMEOUT_RETURN +.UNINDENT +.sp +Has a return timeout been set for the worker. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_remove_servers.3 gearmand-0.23/docs/man/gearman_worker_remove_servers.3 --- gearmand-0.14/docs/man/gearman_worker_remove_servers.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_remove_servers.3 2011-06-29 23:00:21.000000000 +0200 @@ -0,0 +1,83 @@ +.TH "GEARMAN_WORKER_REMOVE_SERVERS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_remove_servers \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_add_server(gearman_worker_st *worker, const char *host, in_port_t port); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_add_servers(gearman_worker_st *worker, const char *servers); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_servers(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fBgearman_worker_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the worker will take work from. +.sp +\fBgearman_worker_remove_servers()\fP will remove all servers from the \fBgearman_worker_st\fP. +.sp +\fBgearman_worker_add_servers()\fP takes a list of \fBgearmand\fP servers that will be parsed to provide servers for the worker. The format for this is SERVER[:PORT][,SERVER[:PORT]]... +.sp +Examples of this are: +.sp +.nf +.ft C +10.0.0.1,10.0.0.2,10.0.0.3 +localhost234,jobserver2.domain.com:7003,10.0.0.3 +.ft P +.fi +.SH RETURN VALUE +.sp +\fBgearman_worker_add_server()\fP and \fBgearman_worker_remove_servers()\fP return \fBgearman_return_t\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_context.3 gearmand-0.23/docs/man/gearman_worker_set_context.3 --- gearmand-0.14/docs/man/gearman_worker_set_context.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_context.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_SET_CONTEXT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_context \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_log_fn.3 gearmand-0.23/docs/man/gearman_worker_set_log_fn.3 --- gearmand-0.14/docs/man/gearman_worker_set_log_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_log_fn.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,64 @@ +.TH "GEARMAN_WORKER_SET_LOG_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_log_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void gearman_worker_set_log_fn(gearman_worker_st *worker, gearman_log_fn *function, void *context, gearman_verbose_t verbose); +.UNINDENT +.SH DESCRIPTION +.sp +\fBgearman_worker_set_log_fn()\fP is similar to \fBgearman_client_set_log_fn()\fP but it used with workers, aka, \fBgearman_worker_st\fP. +\fBgearman_worker_set_log_fn()\fP allows you to register a callback that will be passed all error messages that are givin to the worker. +.sp +See \fBgearman_log_fn\fP for a description of the callback. +.sp +See \fBgearman_verbose_t\fP for more information on logging levels. +.SH RETURN VALUE +.sp +None +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_set_log_fn(3)\fP \fIgearman_log_fn\fP \fIgearman_verbose_t\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_memory_allocators.3 gearmand-0.23/docs/man/gearman_worker_set_memory_allocators.3 --- gearmand-0.14/docs/man/gearman_worker_set_memory_allocators.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_memory_allocators.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,84 @@ +.TH "GEARMAN_WORKER_SET_MEMORY_ALLOCATORS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_memory_allocators \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_allocator_t +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_malloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_free_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_realloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_calloc_fn +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_client_set_memory_allocators(gearman_client_st *, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st *, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context); +.UNINDENT +.sp +Link to \-lgearman +.SH DESCRIPTION +.sp +Install callbacks for custom allocation. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. You can use \fBgearman_client_set_memory_allocators()\fP and \fBgearman_worker_set_memory_allocators()\fP to set your own custom allocators. +.SH RETURN VALUE +.sp +None +.SH SEE ALSO +.RE +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_namespace.3 gearmand-0.23/docs/man/gearman_worker_set_namespace.3 --- gearmand-0.14/docs/man/gearman_worker_set_namespace.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_namespace.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,68 @@ +.TH "GEARMAN_WORKER_SET_NAMESPACE" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_namespace \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B void gearman_client_set_namespace(gearman_client_st\fI\ *self\fP, const char\fI\ *namespace_key\fP, size_t\fI\ namespace_key_size\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_namespace(gearman_worker_st\fI\ *self\fP, const char\fI\ *namespace_key\fP, size_t\fI\ namespace_key_size\fP) +.UNINDENT +.sp +Compile and link with \-lgearman +.SH DESCRIPTION +.sp +gearman_client_set_namespace() and gearman_worker_set_namespace() set a "namespace" for a given set of functions. Only clients and workers sharing a \fBnamespace_key\fP can +see one anothers workloads and functions. +.sp +By setting \fBnamespace_key\fP to NULL you can disable the namespace. +.SH RETURN +.sp +None +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_options.3 gearmand-0.23/docs/man/gearman_worker_set_options.3 --- gearmand-0.14/docs/man/gearman_worker_set_options.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_options.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,90 @@ +.TH "GEARMAN_WORKER_SET_OPTIONS" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_options \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_options_t gearman_worker_options(const gearman_worker_st\fI\ *worker\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_add_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, gearman_worker_options_t\fI\ options\fP) +.UNINDENT +.sp +Deprecated since version 0.21. +.SH DESCRIPTION +.sp +\fI\%gearman_worker_options()\fP returns the \fBgearman_worker_options_t\fP for \fBgearman_worker_st\fP. You enable options via \fI\%gearman_worker_add_options()\fP and disable options via \fI\%gearman_worker_remove_options()\fP. +.sp +The currently supported options are: +.sp +Enable non\-block IO for the worker. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_GRAB_UNIQ +.UNINDENT +.sp +Only grab jobs that have been assigned unique values. This is useful for workers who only want to worker with background jobs. +.INDENT 0.0 +.TP +.B GEARMAN_WORKER_TIMEOUT_RETURN +.UNINDENT +.sp +Has a return timeout been set for the worker. +.SH RETURN VALUE +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.RE +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_timeout.3 gearmand-0.23/docs/man/gearman_worker_set_timeout.3 --- gearmand-0.14/docs/man/gearman_worker_set_timeout.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_timeout.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_SET_TIMEOUT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_timeout \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_workload_free_fn.3 gearmand-0.23/docs/man/gearman_worker_set_workload_free_fn.3 --- gearmand-0.14/docs/man/gearman_worker_set_workload_free_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_workload_free_fn.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_SET_WORKLOAD_FREE_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_workload_free_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_set_workload_malloc_fn.3 gearmand-0.23/docs/man/gearman_worker_set_workload_malloc_fn.3 --- gearmand-0.14/docs/man/gearman_worker_set_workload_malloc_fn.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_set_workload_malloc_fn.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_SET_WORKLOAD_MALLOC_FN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_set_workload_malloc_fn \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_st.3 gearmand-0.23/docs/man/gearman_worker_st.3 --- gearmand-0.14/docs/man/gearman_worker_st.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_st.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_ST" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_st \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_timeout.3 gearmand-0.23/docs/man/gearman_worker_timeout.3 --- gearmand-0.14/docs/man/gearman_worker_timeout.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_timeout.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_TIMEOUT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_timeout \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_unregister.3 gearmand-0.23/docs/man/gearman_worker_unregister.3 --- gearmand-0.14/docs/man/gearman_worker_unregister.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_unregister.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_UNREGISTER" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_unregister \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_unregister_all.3 gearmand-0.23/docs/man/gearman_worker_unregister_all.3 --- gearmand-0.14/docs/man/gearman_worker_unregister_all.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_unregister_all.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_UNREGISTER_ALL" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_unregister_all \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_wait.3 gearmand-0.23/docs/man/gearman_worker_wait.3 --- gearmand-0.14/docs/man/gearman_worker_wait.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_wait.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_WAIT" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_wait \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/gearman_worker_work.3 gearmand-0.23/docs/man/gearman_worker_work.3 --- gearmand-0.14/docs/man/gearman_worker_work.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/gearman_worker_work.3 2011-06-29 23:00:22.000000000 +0200 @@ -0,0 +1,129 @@ +.TH "GEARMAN_WORKER_WORK" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +gearman_worker_work \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.INDENT 0.0 +.TP +.B gearman_worker_st +.UNINDENT +.INDENT 0.0 +.TP +.B int gearman_worker_timeout(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B void *gearman_worker_context(const gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_context(gearman_worker_st *worker, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, gearman_malloc_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_wait(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); +.UNINDENT +.INDENT 0.0 +.TP +.B void gearman_job_free_all(gearman_worker_st *worker); +.UNINDENT +.INDENT 0.0 +.TP +.B bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); +.UNINDENT +.INDENT 0.0 +.TP +.B gearman_return_t gearman_worker_work(gearman_worker_st *worker); +.UNINDENT +.sp +Link with \-lgearman +.SH DESCRIPTION +.sp +\fI\%gearman_worker_st\fP is used for worker communication with the server. +.sp +\fBgearman_worker_context()\fP and \fBgearman_worker_set_context()\fP can be used to store an arbitrary object for the user. +.sp +\fBgearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. +.sp +\fBgearman_worker_timeout()\fP and \fBgearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. +.sp +\fBgearman_worker_function_exist()\fP is used to determine if a given worker has a specific function. +.sp +Normally \fImalloc(3)\fP and \fIfree(3)\fP are used for allocation and releasing workloads. \fBgearman_worker_set_workload_malloc_fn()\fP and \fBgearman_worker_set_workload_free_fn()\fP can be used to replace these with custom functions. +.sp +If you need to remove a function from the server you can call either \fBgearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fBgearman_worker_unregister()\fP to remove just a single function. +.SH RETURN +.sp +Various +.SH HOME +.sp +To find out more information please check: +\fI\%http://gearman.info/\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/libgearman.3 gearmand-0.23/docs/man/libgearman.3 --- gearmand-0.14/docs/man/libgearman.3 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/docs/man/libgearman.3 2011-06-29 23:00:18.000000000 +0200 @@ -0,0 +1,131 @@ +.TH "LIBGEARMAN" "3" "June 29, 2011" "0.23" "Gearmand" +.SH NAME +libgearman \- Gearmand Documentation, http://gearman.info/ +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" Man page generated from reStructeredText. +. +.SH SYNOPSIS +.sp +#include +.sp +Link \-lgearman +.SH DESCRIPTION +.sp +\fBlibgearman\fP is a small, thread\-safe client library for the +gearman protocol. The code has all been written with an eye to allow +for both web and embedded usage. It handles the work behind routing +particular keys to specific servers that you specify (and values are +matched based on server order as supplied by you). It implements both +the \fIclient\fP and \fIworker\fP interfaces. +.sp +All operations are performed against either a client, ie \fBgearman_client_st\fP +or worker, ie \fBgearman_worker_st\fP. +.sp +Client and Worker structures can either be dynamically allocated or statically +allocated. They must then b initialized by \fBgearman_client_create()\fP or \fBgearman_worker_create()\fP. +.sp +Functions have been written in order to encapsulate all structures in the library. It is +recommended that you do not operate directly against the structure. +.sp +Nearly all functions return a \fBgearman_return_t\fP value. +This value can be translated to a printable string with \fBgearman_strerror()\fP. +.sp +\fBgearman_client_st\fP and \fBgearman_worker_st\fP structures are thread\-safe, but each thread must +contain its own structure (that is, if you want to share these among +threads you must provide your own locking). No global variables are +used in this library. +.sp +If you are working with GNU autotools you will want to add the following to +your configure.ac to properly include libgearman in your application. +.sp +PKG_CHECK_MODULES(DEPS, libgearman >= 0.8.0) +AC_SUBST(DEPS_CFLAGS) +AC_SUBST(DEPS_LIBS) +.sp +Hope you enjoy it! +.SH CONSTANTS +.sp +A number of constants have been provided for in the library. +.INDENT 0.0 +.TP +.B GEARMAN_DEFAULT_TCP_PORT +.UNINDENT +.sp +The default port used by gearmand(3). +.INDENT 0.0 +.TP +.B GEARMAN_DEFAULT_TCP_PORT +.UNINDENT +.sp +The default service used by gearmand(3). +.INDENT 0.0 +.TP +.B LIBGEARMAN_VERSION_STRING +.UNINDENT +.sp +String value of the libgearman version such as "0.20.4" +.INDENT 0.0 +.TP +.B LIBGEARMAN_VERSION_HEX +.UNINDENT +.sp +Hex value of the version number. "0x00048000" This can be used for comparing versions based on number. +.INDENT 0.0 +.TP +.B GEARMAN_UNIQUE_SIZE +.UNINDENT +.sp +Largest number of characters that can be used for a unique value. +.INDENT 0.0 +.TP +.B GEARMAN_JOB_HANDLE_SIZE +.UNINDENT +.sp +Largest number of characters that can will be used for a job handle. Please +see \fBgearman_job_handle_t\fP for additional information. +.SH THREADS AND PROCESSES +.sp +When using threads or forked processes it is important to keep an instance +of \fBgearman_client_st\fP or \fBgearman_worker_st\fP per process +or thread. Without creating your own locking structures you can not share +a single \fBgearman_client_st\fP or \fBgearman_worker_st\fP. +.SH HOME +.sp +To find out more information please check: +\fI\%https://launchpad.net/libgearman\fP +.SH SEE ALSO +.sp +\fIgearmand(8)\fP \fIlibgearman_examples(3)\fP +.SH AUTHOR +Data Differential http://datadifferential.com/ +.SH COPYRIGHT +2011, Data Differential, http://datadifferential.com/ +.\" Generated by docutils manpage writer. +.\" +. diff -Nru gearmand-0.14/docs/man/man1/gearman.1 gearmand-0.23/docs/man/man1/gearman.1 --- gearmand-0.14/docs/man/man1/gearman.1 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/man/man1/gearman.1 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -.TH gearman 1 2009-04-18 "Gearman" "Gearman" -.SH NAME -gearman \- command line interface for Gearman clients and workers -.SH SYNOPSIS -.B gearman -[\fIOPTION\fR]... [\fIWORKLOAD\fR]... -.SH DESCRIPTION -This tool allows you to run both Gearman clients and workers from the -command line. Client mode is the default, with worker mode triggered -with the \-w option. More documentation on this tool coming soon! -.SH EXAMPLES -\fBExample Client:\fR -.TP -This command will act as a client and send a job to function "test" with the payload "Hello World!". -.TP -gearman \-f test "Hello World!" -.TP -\fBExample Worker:\fR -.TP -This command will start a worker and take jobs destined to "test" and run the payload through the 'wc' shell command. It will return the output of that command to the client. -.TP -gearman \-w \-f test wc -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_bugreport.3 gearmand-0.23/docs/man/man3/gearman_bugreport.3 --- gearmand-0.14/docs/man/man3/gearman_bugreport.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_bugreport.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -.TH gearman_bugreport 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_bugreport \- Gearman Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_bugreport(void);" -.SH DESCRIPTION -Get bug report URL. -* -.SH "RETURN VALUE" -Bug report URL string. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_options.3 gearmand-0.23/docs/man/man3/gearman_client_add_options.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_add_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_options \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_add_options(gearman_client_st " *client ", gearman_client_options_t options);" -.SH DESCRIPTION -Add options for a client structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] options Available options for client structures. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_server.3 gearmand-0.23/docs/man/man3/gearman_client_add_server.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_server.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_server.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,32 +0,0 @@ -.TH gearman_client_add_server 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_server \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_add_server(gearman_client_st " *client ", const char " *host ", in_port_t port);" -.SH DESCRIPTION -Add a job server to a client. This goes into a list of servers that can be -used to run tasks. No socket I/O happens here, it is just added to a list. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] host Hostname or IP address (IPv4 or IPv6) of the server to add. -.TP -.BR -[in] port Port of the server to add. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_servers.3 gearmand-0.23/docs/man/man3/gearman_client_add_servers.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_servers.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_servers.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,32 +0,0 @@ -.TH gearman_client_add_servers 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_servers \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_add_servers(gearman_client_st " *client ", const char *servers);" -.SH DESCRIPTION -Add a list of job servers to a client. The format for the server list is: -SERVER[:PORT][,SERVER[:PORT]]... -Some examples are: -10.0.0.1,10.0.0.2,10.0.0.3 -localhost LIBGEARMAN_BITFIELD234,jobserver2.domain.com:7003,10.0.0.3 -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] servers Server list described above. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task.3 gearmand-0.23/docs/man/man3/gearman_client_add_task.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,47 +0,0 @@ -.TH gearman_client_add_task 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st *gearman_client_add_task(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add a task to be run in parallel. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] task Caller allocated structure, or NULL to allocate one. -.TP -.BR -[in] context Application context to associate with the task. -.TP -.BR -[in] function_name The name of the function to run. -.TP -.BR -[in] unique Optional unique job identifier, or NULL for a new UUID. -.TP -.BR -[in] workload The workload to pass to the function when it is run. -.TP -.BR -[in] workload_size Size of the workload. -.TP -.BR -[out] ret_ptr Standard gearman return value. -.SH "RETURN VALUE" -On success, a pointer to the (possibly allocated) structure. On -failure this will be NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task_background.3 gearmand-0.23/docs/man/man3/gearman_client_add_task_background.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task_background.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task_background.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_add_task_background 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task_background \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st *gearman_client_add_task_background(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add a background task to be run in parallel. See -gearman_client_add_task() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task_high.3 gearmand-0.23/docs/man/man3/gearman_client_add_task_high.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task_high.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task_high.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_add_task_high 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task_high \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st *gearman_client_add_task_high(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add a high priority task to be run in parallel. See -gearman_client_add_task() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task_high_background.3 gearmand-0.23/docs/man/man3/gearman_client_add_task_high_background.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task_high_background.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task_high_background.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_add_task_high_background 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task_high_background \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st * gearman_client_add_task_high_background(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add a high priority background task to be run in parallel. See -gearman_client_add_task() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task_low.3 gearmand-0.23/docs/man/man3/gearman_client_add_task_low.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task_low.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task_low.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_add_task_low 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task_low \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st *gearman_client_add_task_low(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add a low priority task to be run in parallel. See -gearman_client_add_task() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task_low_background.3 gearmand-0.23/docs/man/man3/gearman_client_add_task_low_background.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task_low_background.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task_low_background.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_add_task_low_background 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task_low_background \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st * gearman_client_add_task_low_background(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add a low priority background task to be run in parallel. See -gearman_client_add_task() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_add_task_status.3 gearmand-0.23/docs/man/man3/gearman_client_add_task_status.3 --- gearmand-0.14/docs/man/man3/gearman_client_add_task_status.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_add_task_status.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -.TH gearman_client_add_task_status 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_add_task_status \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_task_st *gearman_client_add_task_status(gearman_client_st " *client ", gearman_task_st " *task ", void " *context ", const char " *job_handle ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Add task to get the status for a backgound task in parallel. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] task Caller allocated structure, or NULL to allocate one. -.TP -.BR -[in] context Application context to associate with the task. -.TP -.BR -[in] job_handle The job handle to get status for. -.TP -.BR -[out] ret_ptr Standard gearman return value. -.SH "RETURN VALUE" -On success, a pointer to the (possibly allocated) structure. On -failure this will be NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_clear_fn.3 gearmand-0.23/docs/man/man3/gearman_client_clear_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_clear_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_clear_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_client_clear_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_clear_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_clear_fn(gearman_client_st *client);" -.SH DESCRIPTION -Clear all task callback functions. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_clone.3 gearmand-0.23/docs/man/man3/gearman_client_clone.3 --- gearmand-0.14/docs/man/man3/gearman_client_clone.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_clone.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -.TH gearman_client_clone 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_clone \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_client_st *gearman_client_clone(gearman_client_st " *client ", const gearman_client_st *from);" -.SH DESCRIPTION -Clone a client structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Caller allocated structure, or NULL to allocate one. -.TP -.BR -[in] from Structure to use as a source to clone from. -.SH "RETURN VALUE" -Same return as gearman_client_create(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_context.3 gearmand-0.23/docs/man/man3/gearman_client_context.3 --- gearmand-0.14/docs/man/man3/gearman_client_context.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_context.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_client_context 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_context \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_client_context(const gearman_client_st *client);" -.SH DESCRIPTION -Get the application context for a client. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "RETURN VALUE" -Application context that was previously set, or NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_create.3 gearmand-0.23/docs/man/man3/gearman_client_create.3 --- gearmand-0.14/docs/man/man3/gearman_client_create.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_create.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -.TH gearman_client_create 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_create \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_client_st *gearman_client_create(gearman_client_st *client);" -.SH DESCRIPTION -Initialize a client structure. Always check the return value even if passing -in a pre-allocated structure. Some other initialization may have failed. It -is not required to memset() a structure before providing it. -* -.SH PARAMETERS -.TP -.BR -[in] client Caller allocated structure, or NULL to allocate one. -.SH "RETURN VALUE" -On success, a pointer to the (possibly allocated) structure. On -failure this will be NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do.3 gearmand-0.23/docs/man/man3/gearman_client_do.3 --- gearmand-0.14/docs/man/man3/gearman_client_do.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -.TH gearman_client_do 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_client_do(gearman_client_st " *client ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", size_t " *result_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Run a single task and return an allocated result. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function_name The name of the function to run. -.TP -.BR -[in] unique Optional unique job identifier, or NULL for a new UUID. -.TP -.BR -[in] workload The workload to pass to the function when it is run. -.TP -.BR -[in] workload_size Size of the workload. -.TP -.BR -[out] result_size The size of the data being returned. -.TP -.BR -[out] ret_ptr Standard gearman return value. In the case of -GEARMAN_WORK_DATA, GEARMAN_WORK_WARNING, or GEARMAN_WORK_STATUS, the caller -should take any actions to handle the event and then call this function -again. This may happen multiple times until a GEARMAN_WORK_ERROR, -GEARMAN_WORK_FAIL, or GEARMAN_SUCCESS (work complete) is returned. For -GEARMAN_WORK_DATA or GEARMAN_WORK_WARNING, the result_size will be set to -the intermediate data chunk being returned and an allocated data buffer -will be returned. For GEARMAN_WORK_STATUS, the caller can use -gearman_client_do_status() to get the current tasks status. -.SH "RETURN VALUE" -The result allocated by the library, this needs to be freed when the -caller is done using it. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_background.3 gearmand-0.23/docs/man/man3/gearman_client_do_background.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_background.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_background.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -.TH gearman_client_do_background 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_background \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_do_background(gearman_client_st " *client ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", char *job_handle);" -.SH DESCRIPTION -Run a task in the background. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function_name The name of the function to run. -.TP -.BR -[in] unique Optional unique job identifier, or NULL for a new UUID. -.TP -.BR -[in] workload The workload to pass to the function when it is run. -.TP -.BR -[in] workload_size Size of the workload. -.TP -.BR -[out] job_handle A buffer to store the job handle in. Must be at least -GEARMAN_JOB_HANDLE_SIZE bytes long. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_high.3 gearmand-0.23/docs/man/man3/gearman_client_do_high.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_high.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_high.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_do_high 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_high \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_client_do_high(gearman_client_st " *client ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", size_t " *result_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Run a high priority task and return an allocated result. See -gearman_client_do() for parameter and return information. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_high_background.3 gearmand-0.23/docs/man/man3/gearman_client_do_high_background.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_high_background.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_high_background.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_do_high_background 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_high_background \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_do_high_background(gearman_client_st " *client ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", char *job_handle);" -.SH DESCRIPTION -Run a high priority task in the background. See -gearman_client_do_background() for parameter and return information. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_job_handle.3 gearmand-0.23/docs/man/man3/gearman_client_do_job_handle.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_job_handle.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_job_handle.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -.TH gearman_client_do_job_handle 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_job_handle \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_client_do_job_handle(const gearman_client_st *client);" -.SH DESCRIPTION -Get the job handle for the running task. This should be used between -repeated gearman_client_do() (and related) calls to get information. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "RETURN VALUE" -Pointer to static buffer in the client structure that holds the job -handle. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_low.3 gearmand-0.23/docs/man/man3/gearman_client_do_low.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_low.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_low.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_do_low 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_low \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_client_do_low(gearman_client_st " *client ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", size_t " *result_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Run a low priority task and return an allocated result. See -gearman_client_do() for parameter and return information. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_low_background.3 gearmand-0.23/docs/man/man3/gearman_client_do_low_background.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_low_background.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_low_background.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_client_do_low_background 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_low_background \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_do_low_background(gearman_client_st " *client ", const char " *function_name ", const char " *unique ", const void " *workload ", size_t " workload_size ", char *job_handle);" -.SH DESCRIPTION -Run a low priority task in the background. See -gearman_client_do_background() for parameter and return information. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_do_status.3 gearmand-0.23/docs/man/man3/gearman_client_do_status.3 --- gearmand-0.14/docs/man/man3/gearman_client_do_status.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_do_status.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -.TH gearman_client_do_status 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_do_status \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_do_status(gearman_client_st " *client ", uint32_t " *numerator ", uint32_t *denominator);" -.SH DESCRIPTION -Get the status for the running task. This should be used between -repeated gearman_client_do() (and related) calls to get information. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[out] numerator Optional parameter to store the numerator in. -.TP -.BR -[out] denominator Optional parameter to store the denominator in. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_echo.3 gearmand-0.23/docs/man/man3/gearman_client_echo.3 --- gearmand-0.14/docs/man/man3/gearman_client_echo.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_echo.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,32 +0,0 @@ -.TH gearman_client_echo 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_echo \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_echo(gearman_client_st " *client ", const void " *workload ", size_t workload_size);" -.SH DESCRIPTION -Send data to all job servers to see if they echo it back. This is a test -function to see if the job servers are responding properly. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] workload The workload to ask the server to echo back. -.TP -.BR -[in] workload_size Size of the workload. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_errno.3 gearmand-0.23/docs/man/man3/gearman_client_errno.3 --- gearmand-0.14/docs/man/man3/gearman_client_errno.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_errno.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_errno 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_errno \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " int gearman_client_errno(const gearman_client_st *client);" -.SH DESCRIPTION -See gearman_errno() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_error.3 gearmand-0.23/docs/man/man3/gearman_client_error.3 --- gearmand-0.14/docs/man/man3/gearman_client_error.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_error.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_error 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_error \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_client_error(const gearman_client_st *client);" -.SH DESCRIPTION -See gearman_error() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_free.3 gearmand-0.23/docs/man/man3/gearman_client_free.3 --- gearmand-0.14/docs/man/man3/gearman_client_free.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_free.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_client_free 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_free \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_free(gearman_client_st *client);" -.SH DESCRIPTION -Free resources used by a client structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_job_status.3 gearmand-0.23/docs/man/man3/gearman_client_job_status.3 --- gearmand-0.14/docs/man/man3/gearman_client_job_status.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_job_status.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,40 +0,0 @@ -.TH gearman_client_job_status 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_job_status \- Single Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_job_status(gearman_client_st " *client ", const char " *job_handle ", bool " *is_known ", bool " *is_running ", uint32_t " *numerator ", uint32_t *denominator);" -.SH DESCRIPTION -Get the status for a backgound job. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] job_handle The job handle to get status for. -.TP -.BR -[out] is_known Optional parameter to store the known status in. -.TP -.BR -[out] is_running Optional parameter to store the running status in. -.TP -.BR -[out] numerator Optional parameter to store the numerator in. -.TP -.BR -[out] denominator Optional parameter to store the denominator in. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_options.3 gearmand-0.23/docs/man/man3/gearman_client_options.3 --- gearmand-0.14/docs/man/man3/gearman_client_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_client_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_options \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_client_options_t gearman_client_options(const gearman_client_st *client);" -.SH DESCRIPTION -Get options for a client structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "RETURN VALUE" -Options set for the client structure. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_remove_options.3 gearmand-0.23/docs/man/man3/gearman_client_remove_options.3 --- gearmand-0.14/docs/man/man3/gearman_client_remove_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_remove_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_remove_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_remove_options \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_remove_options(gearman_client_st " *client ", gearman_client_options_t options);" -.SH DESCRIPTION -Remove options for a client structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] options Available options for client structures. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_remove_servers.3 gearmand-0.23/docs/man/man3/gearman_client_remove_servers.3 --- gearmand-0.14/docs/man/man3/gearman_client_remove_servers.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_remove_servers.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_client_remove_servers 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_remove_servers \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_remove_servers(gearman_client_st *client);" -.SH DESCRIPTION -Remove all servers currently associated with the client. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_run_tasks.3 gearmand-0.23/docs/man/man3/gearman_client_run_tasks.3 --- gearmand-0.14/docs/man/man3/gearman_client_run_tasks.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_run_tasks.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_client_run_tasks 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_run_tasks \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_run_tasks(gearman_client_st *client);" -.SH DESCRIPTION -Run tasks that have been added in parallel. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_complete_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_complete_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_complete_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_complete_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_complete_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_complete_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_complete_fn(gearman_client_st " *client ", gearman_complete_fn *function);" -.SH DESCRIPTION -Callback function when a task is complete. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_context.3 gearmand-0.23/docs/man/man3/gearman_client_set_context.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_context.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_context.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_context 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_context \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_context(gearman_client_st " *client ", void *context);" -.SH DESCRIPTION -Set the application context for a client. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] context Application context to set. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_created_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_created_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_created_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_created_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_created_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_created_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_created_fn(gearman_client_st " *client ", gearman_created_fn *function);" -.SH DESCRIPTION -Callback function when a job has been created for a task. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_data_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_data_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_data_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_data_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_data_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_data_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_data_fn(gearman_client_st " *client ", gearman_data_fn *function);" -.SH DESCRIPTION -Callback function when there is a data packet for a task. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_exception_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_exception_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_exception_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_exception_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_exception_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_exception_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_exception_fn(gearman_client_st " *client ", gearman_exception_fn *function);" -.SH DESCRIPTION -Callback function when there is an exception packet for a task. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_fail_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_fail_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_fail_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_fail_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_fail_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_fail_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_fail_fn(gearman_client_st " *client ", gearman_fail_fn *function);" -.SH DESCRIPTION -Callback function when a task has failed. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_log_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_log_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_log_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_log_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_set_log_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_log_fn \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_log_fn(gearman_client_st " *client ", gearman_log_fn " *function ", void " *context ", gearman_verbose_t verbose);" -.SH DESCRIPTION -See gearman_set_log_fn() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_options.3 gearmand-0.23/docs/man/man3/gearman_client_set_options.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_options \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_options(gearman_client_st " *client ", gearman_client_options_t options);" -.SH DESCRIPTION -Set options for a client structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] options Available options for client structures. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_status_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_status_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_status_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_status_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_status_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_status_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_status_fn(gearman_client_st " *client ", gearman_universal_status_fn *function);" -.SH DESCRIPTION -Callback function when there is a status packet for a task. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_task_context_free_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_task_context_free_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_task_context_free_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_task_context_free_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -.TH gearman_client_set_task_context_free_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_task_context_free_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_task_context_free_fn(gearman_client_st " *client ", gearman_task_context_free_fn *function);" -.SH DESCRIPTION -Set function to call when tasks are being cleaned up so applications can -clean up the task context. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call to clean up task context. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_timeout.3 gearmand-0.23/docs/man/man3/gearman_client_set_timeout.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_timeout.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_timeout.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_set_timeout 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_timeout \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_timeout(gearman_client_st " *client ", int timeout);" -.SH DESCRIPTION -See gearman_universal_set_timeout() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_warning_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_warning_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_warning_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_warning_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_warning_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_warning_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_warning_fn(gearman_client_st " *client ", gearman_warning_fn *function);" -.SH DESCRIPTION -Callback function when there is a warning packet for a task. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_workload_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_workload_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_workload_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_workload_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_client_set_workload_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_workload_fn \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_workload_fn(gearman_client_st " *client ", gearman_workload_fn *function);" -.SH DESCRIPTION -Callback function when workload data needs to be sent for a task. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.TP -.BR -[in] function Function to call. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_workload_free_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_workload_free_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_workload_free_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_workload_free_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_set_workload_free_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_workload_free_fn \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_workload_free_fn(gearman_client_st " *client ", gearman_free_fn " *function ", void *context);" -.SH DESCRIPTION -See gearman_set_workload_malloc_fn() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_set_workload_malloc_fn.3 gearmand-0.23/docs/man/man3/gearman_client_set_workload_malloc_fn.3 --- gearmand-0.14/docs/man/man3/gearman_client_set_workload_malloc_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_set_workload_malloc_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_set_workload_malloc_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_set_workload_malloc_fn \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_set_workload_malloc_fn(gearman_client_st " *client ", gearman_malloc_fn " *function ", void *context);" -.SH DESCRIPTION -See gearman_set_workload_malloc_fn() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_task_free_all.3 gearmand-0.23/docs/man/man3/gearman_client_task_free_all.3 --- gearmand-0.14/docs/man/man3/gearman_client_task_free_all.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_task_free_all.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_client_task_free_all 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_task_free_all \- Concurrent Task Interface -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_client_task_free_all(gearman_client_st *client);" -.SH DESCRIPTION -Free all tasks for a gearman structure. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_timeout.3 gearmand-0.23/docs/man/man3/gearman_client_timeout.3 --- gearmand-0.14/docs/man/man3/gearman_client_timeout.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_timeout.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_client_timeout 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_timeout \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " int gearman_client_timeout(gearman_client_st *client);" -.SH DESCRIPTION -See gearman_universal_timeout() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_client_wait.3 gearmand-0.23/docs/man/man3/gearman_client_wait.3 --- gearmand-0.14/docs/man/man3/gearman_client_wait.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_client_wait.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_client_wait 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_client_wait \- Client Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_client_wait(gearman_client_st *client);" -.SH DESCRIPTION -When in non-blocking I/O mode, wait for activity from one of the servers. -* -.SH PARAMETERS -.TP -.BR -[in] client Structure previously initialized with -gearman_client_create() or gearman_client_clone(). -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_free.3 gearmand-0.23/docs/man/man3/gearman_job_free.3 --- gearmand-0.14/docs/man/man3/gearman_job_free.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_free.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_job_free 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_free \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_job_free(gearman_job_st *job);" -.SH DESCRIPTION -Free a job structure. -* -.SH PARAMETERS -.TP -.BR -[in] job Structure previously initialized with -gearman_worker_grab_job(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_free_all.3 gearmand-0.23/docs/man/man3/gearman_job_free_all.3 --- gearmand-0.14/docs/man/man3/gearman_job_free_all.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_free_all.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_job_free_all 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_free_all \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_job_free_all(gearman_worker_st *worker);" -.SH DESCRIPTION -Free all jobs for a gearman structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_function_name.3 gearmand-0.23/docs/man/man3/gearman_job_function_name.3 --- gearmand-0.14/docs/man/man3/gearman_job_function_name.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_function_name.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_function_name 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_function_name \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_job_function_name(const gearman_job_st *job);" -.SH DESCRIPTION -Get the function name associated with a job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_handle.3 gearmand-0.23/docs/man/man3/gearman_job_handle.3 --- gearmand-0.14/docs/man/man3/gearman_job_handle.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_handle.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_handle 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_handle \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_job_handle(const gearman_job_st *job);" -.SH DESCRIPTION -Get job handle. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_send_complete.3 gearmand-0.23/docs/man/man3/gearman_job_send_complete.3 --- gearmand-0.14/docs/man/man3/gearman_job_send_complete.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_send_complete.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_send_complete 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_send_complete \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_job_send_complete(gearman_job_st " *job ", const void " *result ", size_t result_size);" -.SH DESCRIPTION -Send result and complete status for a job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_send_data.3 gearmand-0.23/docs/man/man3/gearman_job_send_data.3 --- gearmand-0.14/docs/man/man3/gearman_job_send_data.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_send_data.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_send_data 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_send_data \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_job_send_data(gearman_job_st " *job ", const void " *data ", size_t data_size);" -.SH DESCRIPTION -Send data for a running job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_send_exception.3 gearmand-0.23/docs/man/man3/gearman_job_send_exception.3 --- gearmand-0.14/docs/man/man3/gearman_job_send_exception.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_send_exception.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_send_exception 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_send_exception \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_job_send_exception(gearman_job_st " *job ", const void " *exception ", size_t exception_size);" -.SH DESCRIPTION -Send exception for a running job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_send_fail.3 gearmand-0.23/docs/man/man3/gearman_job_send_fail.3 --- gearmand-0.14/docs/man/man3/gearman_job_send_fail.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_send_fail.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_send_fail 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_send_fail \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_job_send_fail(gearman_job_st *job);" -.SH DESCRIPTION -Send fail status for a job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_send_status.3 gearmand-0.23/docs/man/man3/gearman_job_send_status.3 --- gearmand-0.14/docs/man/man3/gearman_job_send_status.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_send_status.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_send_status 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_send_status \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_job_send_status(gearman_job_st " *job ", uint32_t " numerator ", uint32_t denominator);" -.SH DESCRIPTION -Send status information for a running job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_send_warning.3 gearmand-0.23/docs/man/man3/gearman_job_send_warning.3 --- gearmand-0.14/docs/man/man3/gearman_job_send_warning.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_send_warning.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_send_warning 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_send_warning \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_job_send_warning(gearman_job_st " *job ", const void " *warning ", size_t warning_size);" -.SH DESCRIPTION -Send warning for a running job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_take_workload.3 gearmand-0.23/docs/man/man3/gearman_job_take_workload.3 --- gearmand-0.14/docs/man/man3/gearman_job_take_workload.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_take_workload.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_job_take_workload 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_take_workload \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_job_take_workload(gearman_job_st " *job ", size_t *data_size);" -.SH DESCRIPTION -Take allocated workload from job. After this, the caller is responsible -for free()ing the memory. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_unique.3 gearmand-0.23/docs/man/man3/gearman_job_unique.3 --- gearmand-0.14/docs/man/man3/gearman_job_unique.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_unique.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_unique 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_unique \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_job_unique(const gearman_job_st *job);" -.SH DESCRIPTION -Get the unique ID associated with a job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_workload.3 gearmand-0.23/docs/man/man3/gearman_job_workload.3 --- gearmand-0.14/docs/man/man3/gearman_job_workload.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_workload.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_workload 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_workload \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const void *gearman_job_workload(const gearman_job_st *job);" -.SH DESCRIPTION -Get a pointer to the workload for a job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_job_workload_size.3 gearmand-0.23/docs/man/man3/gearman_job_workload_size.3 --- gearmand-0.14/docs/man/man3/gearman_job_workload_size.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_job_workload_size.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_job_workload_size 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_job_workload_size \- Job Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " size_t gearman_job_workload_size(const gearman_job_st *job);" -.SH DESCRIPTION -Get size of the workload for a job. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_parse_servers.3 gearmand-0.23/docs/man/man3/gearman_parse_servers.3 --- gearmand-0.14/docs/man/man3/gearman_parse_servers.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_parse_servers.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -.TH gearman_parse_servers 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_parse_servers \- Gearman Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_parse_servers(const char " *servers ", gearman_parse_server_fn " *callback ", void *context);" -.SH DESCRIPTION -Utility function used for parsing server lists. -* -.SH PARAMETERS -.TP -.BR -[in] servers String containing a list of servers to parse. -.TP -.BR -[in] callback Function to call for each server that is found. -.TP -.BR -[in] context Argument to pass along with callback function. -.SH "RETURN VALUE" -Standard Gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_context.3 gearmand-0.23/docs/man/man3/gearman_task_context.3 --- gearmand-0.14/docs/man/man3/gearman_task_context.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_context.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_context 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_context \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const void *gearman_task_context(const gearman_task_st *task);" -.SH DESCRIPTION -Get context for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_data.3 gearmand-0.23/docs/man/man3/gearman_task_data.3 --- gearmand-0.14/docs/man/man3/gearman_task_data.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_data.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_data 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_data \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const void *gearman_task_data(const gearman_task_st *task);" -.SH DESCRIPTION -Get result data being returned for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_data_size.3 gearmand-0.23/docs/man/man3/gearman_task_data_size.3 --- gearmand-0.14/docs/man/man3/gearman_task_data_size.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_data_size.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_data_size 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_data_size \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " size_t gearman_task_data_size(const gearman_task_st *task);" -.SH DESCRIPTION -Get result data size being returned for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_denominator.3 gearmand-0.23/docs/man/man3/gearman_task_denominator.3 --- gearmand-0.14/docs/man/man3/gearman_task_denominator.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_denominator.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_denominator 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_denominator \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " uint32_t gearman_task_denominator(const gearman_task_st *task);" -.SH DESCRIPTION -Get the denominator of percentage complete for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_free.3 gearmand-0.23/docs/man/man3/gearman_task_free.3 --- gearmand-0.14/docs/man/man3/gearman_task_free.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_free.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_task_free 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_free \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_task_free(gearman_task_st *task);" -.SH DESCRIPTION -Free a task structure. -* -.SH PARAMETERS -.TP -.BR -[in] task Structure previously initialized with one of the -gearman_client_add_task() functions. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_function_name.3 gearmand-0.23/docs/man/man3/gearman_task_function_name.3 --- gearmand-0.14/docs/man/man3/gearman_task_function_name.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_function_name.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_function_name 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_function_name \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_task_function_name(const gearman_task_st *task);" -.SH DESCRIPTION -Get function name associated with a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_give_workload.3 gearmand-0.23/docs/man/man3/gearman_task_give_workload.3 --- gearmand-0.14/docs/man/man3/gearman_task_give_workload.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_give_workload.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_task_give_workload 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_give_workload \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_task_give_workload(gearman_task_st " *task ", const void " *workload ", size_t workload_size);" -.SH DESCRIPTION -Give allocated memory to task. After this, the library will be responsible -for freeing the workload memory when the task is destroyed. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_is_known.3 gearmand-0.23/docs/man/man3/gearman_task_is_known.3 --- gearmand-0.14/docs/man/man3/gearman_task_is_known.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_is_known.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_is_known 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_is_known \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " bool gearman_task_is_known(const gearman_task_st *task);" -.SH DESCRIPTION -Get status on whether a task is known or not. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_is_running.3 gearmand-0.23/docs/man/man3/gearman_task_is_running.3 --- gearmand-0.14/docs/man/man3/gearman_task_is_running.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_is_running.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_is_running 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_is_running \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " bool gearman_task_is_running(const gearman_task_st *task);" -.SH DESCRIPTION -Get status on whether a task is running or not. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_job_handle.3 gearmand-0.23/docs/man/man3/gearman_task_job_handle.3 --- gearmand-0.14/docs/man/man3/gearman_task_job_handle.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_job_handle.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_job_handle 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_job_handle \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_task_job_handle(const gearman_task_st *task);" -.SH DESCRIPTION -Get job handle for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_numerator.3 gearmand-0.23/docs/man/man3/gearman_task_numerator.3 --- gearmand-0.14/docs/man/man3/gearman_task_numerator.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_numerator.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_numerator 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_numerator \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " uint32_t gearman_task_numerator(const gearman_task_st *task);" -.SH DESCRIPTION -Get the numerator of percentage complete for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_recv_data.3 gearmand-0.23/docs/man/man3/gearman_task_recv_data.3 --- gearmand-0.14/docs/man/man3/gearman_task_recv_data.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_recv_data.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_recv_data 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_recv_data \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " size_t gearman_task_recv_data(gearman_task_st " *task ", void " *data ", size_t " data_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Read result data into a buffer for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_send_workload.3 gearmand-0.23/docs/man/man3/gearman_task_send_workload.3 --- gearmand-0.14/docs/man/man3/gearman_task_send_workload.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_send_workload.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_send_workload 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_send_workload \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " size_t gearman_task_send_workload(gearman_task_st " *task ", const void " *workload ", size_t " workload_size ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Send packet workload for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_set_context.3 gearmand-0.23/docs/man/man3/gearman_task_set_context.3 --- gearmand-0.14/docs/man/man3/gearman_task_set_context.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_set_context.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_set_context 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_set_context \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_task_set_context(gearman_task_st " *task ", void *context);" -.SH DESCRIPTION -Set context for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_take_data.3 gearmand-0.23/docs/man/man3/gearman_task_take_data.3 --- gearmand-0.14/docs/man/man3/gearman_task_take_data.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_take_data.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.TH gearman_task_take_data 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_take_data \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_task_take_data(gearman_task_st " *task ", size_t *data_size);" -.SH DESCRIPTION -Take allocated result data from task. After this, the caller is responsible -for free()ing the memory. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_task_unique.3 gearmand-0.23/docs/man/man3/gearman_task_unique.3 --- gearmand-0.14/docs/man/man3/gearman_task_unique.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_task_unique.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_task_unique 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_task_unique \- Task Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_task_unique(const gearman_task_st *task);" -.SH DESCRIPTION -Get unique identifier for a task. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_verbose_name.3 gearmand-0.23/docs/man/man3/gearman_verbose_name.3 --- gearmand-0.14/docs/man/man3/gearman_verbose_name.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_verbose_name.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -.TH gearman_verbose_name 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_verbose_name \- Gearman Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_verbose_name(gearman_verbose_t verbose);" -.SH DESCRIPTION -Get string with the name of the given verbose level. -* -.SH PARAMETERS -.TP -.BR -[in] verbose Verbose logging level. -.SH "RETURN VALUE" -String form of verbose level. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_version.3 gearmand-0.23/docs/man/man3/gearman_version.3 --- gearmand-0.14/docs/man/man3/gearman_version.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_version.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -.TH gearman_version 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_version \- Gearman Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_version(void);" -.SH DESCRIPTION -Get Gearman library version. -* -.SH "RETURN VALUE" -Version string of library. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_add_function.3 gearmand-0.23/docs/man/man3/gearman_worker_add_function.3 --- gearmand-0.14/docs/man/man3/gearman_worker_add_function.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_add_function.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -.TH gearman_worker_add_function 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_add_function \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_add_function(gearman_worker_st " *worker ", const char " *function_name ", uint32_t " timeout ", gearman_worker_fn " *function ", void *context);" -.SH DESCRIPTION -Register and add callback function for worker. To remove functions that have -been added, call gearman_worker_unregister() or -gearman_worker_unregister_all(). -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] function_name Function name to register. -.TP -.BR -[in] timeout Optional timeout (in seconds) that specifies the maximum -time a job should. This is enforced on the job server. A value of 0 means -an infinite time. -.TP -.BR -[in] function Function to run when there is a job ready. -.TP -.BR -[in] context Argument to pass into the callback function. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_add_options.3 gearmand-0.23/docs/man/man3/gearman_worker_add_options.3 --- gearmand-0.14/docs/man/man3/gearman_worker_add_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_add_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_worker_add_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_add_options \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_add_options(gearman_worker_st " *worker ", gearman_worker_options_t options);" -.SH DESCRIPTION -Add options for a worker structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR options -Available options for worker structures. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_add_server.3 gearmand-0.23/docs/man/man3/gearman_worker_add_server.3 --- gearmand-0.14/docs/man/man3/gearman_worker_add_server.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_add_server.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,32 +0,0 @@ -.TH gearman_worker_add_server 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_add_server \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_add_server(gearman_worker_st " *worker ", const char " *host ", in_port_t port);" -.SH DESCRIPTION -Add a job server to a worker. This goes into a list of servers that can be -used to run tasks. No socket I/O happens here, it is just added to a list. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] host Hostname or IP address (IPv4 or IPv6) of the server to add. -.TP -.BR -[in] port Port of the server to add. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_add_servers.3 gearmand-0.23/docs/man/man3/gearman_worker_add_servers.3 --- gearmand-0.14/docs/man/man3/gearman_worker_add_servers.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_add_servers.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,32 +0,0 @@ -.TH gearman_worker_add_servers 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_add_servers \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_add_servers(gearman_worker_st " *worker ", const char *servers);" -.SH DESCRIPTION -Add a list of job servers to a worker. The format for the server list is: -SERVER[:PORT][,SERVER[:PORT]]... -Some examples are: -10.0.0.1,10.0.0.2,10.0.0.3 -localhost LIBGEARMAN_BITFIELD234,jobserver2.domain.com:7003,10.0.0.3 -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] servers Server list described above. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_clone.3 gearmand-0.23/docs/man/man3/gearman_worker_clone.3 --- gearmand-0.14/docs/man/man3/gearman_worker_clone.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_clone.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -.TH gearman_worker_clone 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_clone \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_worker_st *gearman_worker_clone(gearman_worker_st " *worker ", const gearman_worker_st *from);" -.SH DESCRIPTION -Clone a worker structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Caller allocated structure, or NULL to allocate one. -.TP -.BR -[in] from Structure to use as a source to clone from. -.SH "RETURN VALUE" -Same return as gearman_worker_create(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_context.3 gearmand-0.23/docs/man/man3/gearman_worker_context.3 --- gearmand-0.14/docs/man/man3/gearman_worker_context.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_context.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_worker_context 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_context \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void *gearman_worker_context(const gearman_worker_st *worker);" -.SH DESCRIPTION -Get the application context for a worker. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "RETURN VALUE" -Application context that was previously set, or NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_create.3 gearmand-0.23/docs/man/man3/gearman_worker_create.3 --- gearmand-0.14/docs/man/man3/gearman_worker_create.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_create.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -.TH gearman_worker_create 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_create \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_worker_st *gearman_worker_create(gearman_worker_st *worker);" -.SH DESCRIPTION -Initialize a worker structure. Always check the return value even if passing -in a pre-allocated structure. Some other initialization may have failed. It -is not required to memset() a structure before providing it. -* -.SH PARAMETERS -.TP -.BR -[in] worker Caller allocated structure, or NULL to allocate one. -.SH "RETURN VALUE" -On success, a pointer to the (possibly allocated) structure. On -failure this will be NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_echo.3 gearmand-0.23/docs/man/man3/gearman_worker_echo.3 --- gearmand-0.14/docs/man/man3/gearman_worker_echo.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_echo.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,32 +0,0 @@ -.TH gearman_worker_echo 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_echo \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_echo(gearman_worker_st " *worker ", const void " *workload ", size_t workload_size);" -.SH DESCRIPTION -Send data to all job servers to see if they echo it back. This is a test -function to see if job servers are responding properly. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] workload The workload to ask the server to echo back. -.TP -.BR -[in] workload_size Size of the workload. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_errno.3 gearmand-0.23/docs/man/man3/gearman_worker_errno.3 --- gearmand-0.14/docs/man/man3/gearman_worker_errno.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_errno.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_worker_errno 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_errno \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " int gearman_worker_errno(gearman_worker_st *worker);" -.SH DESCRIPTION -See gearman_errno() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_error.3 gearmand-0.23/docs/man/man3/gearman_worker_error.3 --- gearmand-0.14/docs/man/man3/gearman_worker_error.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_error.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_worker_error 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_error \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " const char *gearman_worker_error(gearman_worker_st *worker);" -.SH DESCRIPTION -See gearman_error() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_free.3 gearmand-0.23/docs/man/man3/gearman_worker_free.3 --- gearmand-0.14/docs/man/man3/gearman_worker_free.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_free.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_worker_free 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_free \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_free(gearman_worker_st *worker);" -.SH DESCRIPTION -Free resources used by a worker structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_function_exist.3 gearmand-0.23/docs/man/man3/gearman_worker_function_exist.3 --- gearmand-0.14/docs/man/man3/gearman_worker_function_exist.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_function_exist.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -.TH gearman_worker_function_exist 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_function_exist \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " bool gearman_worker_function_exist(gearman_worker_st " *worker ", const char " *function_name ", size_t function_length);" -.SH DESCRIPTION -See if a function exists in the server. It will not return -true if the function is currently being de-allocated. -.SH PARAMETERS -.TP -.BR -[in] worker gearman_worker_st that will be used. -.TP -.BR -[in] function_name Function name for search. -.TP -.BR -[in] function_length Length of function name. -.SH "RETURN VALUE" -bool -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_grab_job.3 gearmand-0.23/docs/man/man3/gearman_worker_grab_job.3 --- gearmand-0.14/docs/man/man3/gearman_worker_grab_job.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_grab_job.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -.TH gearman_worker_grab_job 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_grab_job \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_job_st *gearman_worker_grab_job(gearman_worker_st " *worker ", gearman_job_st " *job ", gearman_return_t *ret_ptr);" -.SH DESCRIPTION -Get a job from one of the job servers. This does not used the callback -interface below, which means results must be sent back to the job server -manually. It is also the responsibility of the caller to free the job once -it has been completed. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] job Caller allocated structure, or NULL to allocate one. -.TP -.BR -[out] ret_ptr Standard gearman return value. -.SH "RETURN VALUE" -On success, a pointer to the (possibly allocated) structure. On -failure this will be NULL. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_options.3 gearmand-0.23/docs/man/man3/gearman_worker_options.3 --- gearmand-0.14/docs/man/man3/gearman_worker_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_worker_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_options \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_worker_options_t gearman_worker_options(const gearman_worker_st *worker);" -.SH DESCRIPTION -Get options for a worker structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "RETURN VALUE" -Options set for the worker structure. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_register.3 gearmand-0.23/docs/man/man3/gearman_worker_register.3 --- gearmand-0.14/docs/man/man3/gearman_worker_register.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_register.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -.TH gearman_worker_register 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_register \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_register(gearman_worker_st " *worker ", const char " *function_name ", uint32_t timeout);" -.SH DESCRIPTION -Register function with job servers with an optional timeout. The timeout -specifies how many seconds the server will wait before marking a job as -failed. If timeout is zero, there is no timeout. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] function_name Function name to register. -.TP -.BR -[in] timeout Optional timeout (in seconds) that specifies the maximum -time a job should. This is enforced on the job server. A value of 0 means -an infinite time. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_remove_options.3 gearmand-0.23/docs/man/man3/gearman_worker_remove_options.3 --- gearmand-0.14/docs/man/man3/gearman_worker_remove_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_remove_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_worker_remove_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_remove_options \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_remove_options(gearman_worker_st " *worker ", gearman_worker_options_t options);" -.SH DESCRIPTION -Remove options for a worker structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR options -Available options for worker structures. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_remove_servers.3 gearmand-0.23/docs/man/man3/gearman_worker_remove_servers.3 --- gearmand-0.14/docs/man/man3/gearman_worker_remove_servers.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_remove_servers.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -.TH gearman_worker_remove_servers 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_remove_servers \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_remove_servers(gearman_worker_st *worker);" -.SH DESCRIPTION -Remove all servers currently associated with the worker. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_set_context.3 gearmand-0.23/docs/man/man3/gearman_worker_set_context.3 --- gearmand-0.14/docs/man/man3/gearman_worker_set_context.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_set_context.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_worker_set_context 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_set_context \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_set_context(gearman_worker_st " *worker ", void *context);" -.SH DESCRIPTION -Set the application context for a worker. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] context Application context to set. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_set_log_fn.3 gearmand-0.23/docs/man/man3/gearman_worker_set_log_fn.3 --- gearmand-0.14/docs/man/man3/gearman_worker_set_log_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_set_log_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_worker_set_log_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_set_log_fn \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_set_log_fn(gearman_worker_st " *worker ", gearman_log_fn " *function ", void " *context ", gearman_verbose_t verbose);" -.SH DESCRIPTION -See gearman_set_log_fn() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_set_options.3 gearmand-0.23/docs/man/man3/gearman_worker_set_options.3 --- gearmand-0.14/docs/man/man3/gearman_worker_set_options.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_set_options.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -.TH gearman_worker_set_options 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_set_options \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_set_options(gearman_worker_st " *worker ", gearman_worker_options_t options);" -.SH DESCRIPTION -Set options for a worker structure. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR options -Available options for worker structures. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_set_timeout.3 gearmand-0.23/docs/man/man3/gearman_worker_set_timeout.3 --- gearmand-0.14/docs/man/man3/gearman_worker_set_timeout.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_set_timeout.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_worker_set_timeout 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_set_timeout \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_set_timeout(gearman_worker_st " *worker ", int timeout);" -.SH DESCRIPTION -See gearman_universal_set_timeout() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_set_workload_free_fn.3 gearmand-0.23/docs/man/man3/gearman_worker_set_workload_free_fn.3 --- gearmand-0.14/docs/man/man3/gearman_worker_set_workload_free_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_set_workload_free_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -.TH gearman_worker_set_workload_free_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_set_workload_free_fn \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_set_workload_free_fn(gearman_worker_st " *worker ", gearman_free_fn " *function ", void *context);" -.SH DESCRIPTION -Set custom memory free function for workloads. Normally gearman uses the -standard system free to free memory used with workloads. The provided -function will be used instead. -* -.SH PARAMETERS -.TP -.BR -[in] gearman Structure previously initialized with gearman_universal_create() or -gearman_clone(). -.TP -.BR -[in] function Memory free function to use instead of free(). -.TP -.BR -[in] context Argument to pass into the callback function. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_set_workload_malloc_fn.3 gearmand-0.23/docs/man/man3/gearman_worker_set_workload_malloc_fn.3 --- gearmand-0.14/docs/man/man3/gearman_worker_set_workload_malloc_fn.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_set_workload_malloc_fn.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_worker_set_workload_malloc_fn 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_set_workload_malloc_fn \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " void gearman_worker_set_workload_malloc_fn(gearman_worker_st " *worker ", gearman_malloc_fn " *function ", void *context);" -.SH DESCRIPTION -See gearman_set_workload_malloc_fn() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_timeout.3 gearmand-0.23/docs/man/man3/gearman_worker_timeout.3 --- gearmand-0.14/docs/man/man3/gearman_worker_timeout.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_timeout.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -.TH gearman_worker_timeout 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_timeout \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " int gearman_worker_timeout(gearman_worker_st *worker);" -.SH DESCRIPTION -See gearman_universal_timeout() for details. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_unregister.3 gearmand-0.23/docs/man/man3/gearman_worker_unregister.3 --- gearmand-0.14/docs/man/man3/gearman_worker_unregister.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_unregister.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -.TH gearman_worker_unregister 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_unregister \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_unregister(gearman_worker_st " *worker ", const char *function_name);" -.SH DESCRIPTION -Unregister function with job servers. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.TP -.BR -[in] function_name Function name to unregister. -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_unregister_all.3 gearmand-0.23/docs/man/man3/gearman_worker_unregister_all.3 --- gearmand-0.14/docs/man/man3/gearman_worker_unregister_all.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_unregister_all.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_worker_unregister_all 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_unregister_all \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker);" -.SH DESCRIPTION -Unregister all functions with job servers. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_wait.3 gearmand-0.23/docs/man/man3/gearman_worker_wait.3 --- gearmand-0.14/docs/man/man3/gearman_worker_wait.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_wait.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_worker_wait 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_wait \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_wait(gearman_worker_st *worker);" -.SH DESCRIPTION -When in non-blocking I/O mode, wait for activity from one of the servers. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man3/gearman_worker_work.3 gearmand-0.23/docs/man/man3/gearman_worker_work.3 --- gearmand-0.14/docs/man/man3/gearman_worker_work.3 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man/man3/gearman_worker_work.3 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.TH gearman_worker_work 3 2010-06-30 "Gearman" "Gearman" -.SH NAME -gearman_worker_work \- Worker Declarations -.SH SYNOPSIS -.B #include -.sp -.BI " gearman_return_t gearman_worker_work(gearman_worker_st *worker);" -.SH DESCRIPTION -Wait for a job and call the appropriate callback function when it gets one. -* -.SH PARAMETERS -.TP -.BR -[in] worker Structure previously initialized with -gearman_worker_create() or gearman_worker_clone(). -.SH "RETURN VALUE" -Standard gearman return value. -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man/man8/gearmand.8 gearmand-0.23/docs/man/man8/gearmand.8 --- gearmand-0.14/docs/man/man8/gearmand.8 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/docs/man/man8/gearmand.8 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -.TH gearmand 8 2009-05-31 "Gearman" "Gearman" -.SH NAME -gearmand \- Gearman job server -.SH SYNOPSIS -.B gearmand -[\fIOPTION\fR]... -.SH DESCRIPTION -This is the C implementation of the Gearman job server. Run 'gearmand \-\-help' for usage details. Better documentation coming soon. :) -.SH "SEE ALSO" -The Gearman homepage: http://www.gearman.org/ -.SH BUGS -Bugs should be reported at https://bugs.launchpad.net/gearmand -.SH COPYING -Copyright (C) 2008 Brian Aker, Eric Day. All rights reserved. - -Use and distribution licensed under the BSD license. See the COPYING file in the original source for full text. diff -Nru gearmand-0.14/docs/man_list gearmand-0.23/docs/man_list --- gearmand-0.14/docs/man_list 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/docs/man_list 1970-01-01 01:00:00.000000000 +0100 @@ -1,114 +0,0 @@ - -dist_man_MANS= docs/man/man1/gearman.1 docs/man/man8/gearmand.8 \ - docs/man/man3/gearman_client_create.3 \ - docs/man/man3/gearman_client_clone.3 \ - docs/man/man3/gearman_client_free.3 \ - docs/man/man3/gearman_client_error.3 \ - docs/man/man3/gearman_client_errno.3 \ - docs/man/man3/gearman_client_options.3 \ - docs/man/man3/gearman_client_set_options.3 \ - docs/man/man3/gearman_client_add_options.3 \ - docs/man/man3/gearman_client_remove_options.3 \ - docs/man/man3/gearman_client_timeout.3 \ - docs/man/man3/gearman_client_set_timeout.3 \ - docs/man/man3/gearman_client_context.3 \ - docs/man/man3/gearman_client_set_context.3 \ - docs/man/man3/gearman_client_set_log_fn.3 \ - docs/man/man3/gearman_client_set_workload_malloc_fn.3 \ - docs/man/man3/gearman_client_set_workload_free_fn.3 \ - docs/man/man3/gearman_client_add_server.3 \ - docs/man/man3/gearman_client_add_servers.3 \ - docs/man/man3/gearman_client_remove_servers.3 \ - docs/man/man3/gearman_client_wait.3 \ - docs/man/man3/gearman_client_do.3 \ - docs/man/man3/gearman_client_do_high.3 \ - docs/man/man3/gearman_client_do_low.3 \ - docs/man/man3/gearman_client_do_job_handle.3 \ - docs/man/man3/gearman_client_do_status.3 \ - docs/man/man3/gearman_client_do_background.3 \ - docs/man/man3/gearman_client_do_high_background.3 \ - docs/man/man3/gearman_client_do_low_background.3 \ - docs/man/man3/gearman_client_job_status.3 \ - docs/man/man3/gearman_client_echo.3 \ - docs/man/man3/gearman_client_task_free_all.3 \ - docs/man/man3/gearman_client_set_task_context_free_fn.3 \ - docs/man/man3/gearman_client_add_task.3 \ - docs/man/man3/gearman_client_add_task_high.3 \ - docs/man/man3/gearman_client_add_task_low.3 \ - docs/man/man3/gearman_client_add_task_background.3 \ - docs/man/man3/gearman_client_add_task_high_background.3 \ - docs/man/man3/gearman_client_add_task_low_background.3 \ - docs/man/man3/gearman_client_add_task_status.3 \ - docs/man/man3/gearman_client_set_workload_fn.3 \ - docs/man/man3/gearman_client_set_created_fn.3 \ - docs/man/man3/gearman_client_set_data_fn.3 \ - docs/man/man3/gearman_client_set_warning_fn.3 \ - docs/man/man3/gearman_client_set_status_fn.3 \ - docs/man/man3/gearman_client_set_complete_fn.3 \ - docs/man/man3/gearman_client_set_exception_fn.3 \ - docs/man/man3/gearman_client_set_fail_fn.3 \ - docs/man/man3/gearman_client_clear_fn.3 \ - docs/man/man3/gearman_client_run_tasks.3 \ - docs/man/man3/gearman_version.3 \ - docs/man/man3/gearman_bugreport.3 \ - docs/man/man3/gearman_verbose_name.3 \ - docs/man/man3/gearman_parse_servers.3 \ - docs/man/man3/gearman_job_free.3 \ - docs/man/man3/gearman_job_send_data.3 \ - docs/man/man3/gearman_job_send_warning.3 \ - docs/man/man3/gearman_job_send_status.3 \ - docs/man/man3/gearman_job_send_complete.3 \ - docs/man/man3/gearman_job_send_exception.3 \ - docs/man/man3/gearman_job_send_fail.3 \ - docs/man/man3/gearman_job_handle.3 \ - docs/man/man3/gearman_job_function_name.3 \ - docs/man/man3/gearman_job_unique.3 \ - docs/man/man3/gearman_job_workload.3 \ - docs/man/man3/gearman_job_workload_size.3 \ - docs/man/man3/gearman_job_take_workload.3 \ - docs/man/man3/gearman_task_free.3 \ - docs/man/man3/gearman_task_context.3 \ - docs/man/man3/gearman_task_set_context.3 \ - docs/man/man3/gearman_task_function_name.3 \ - docs/man/man3/gearman_task_unique.3 \ - docs/man/man3/gearman_task_job_handle.3 \ - docs/man/man3/gearman_task_is_known.3 \ - docs/man/man3/gearman_task_is_running.3 \ - docs/man/man3/gearman_task_numerator.3 \ - docs/man/man3/gearman_task_denominator.3 \ - docs/man/man3/gearman_task_give_workload.3 \ - docs/man/man3/gearman_task_send_workload.3 \ - docs/man/man3/gearman_task_data.3 \ - docs/man/man3/gearman_task_data_size.3 \ - docs/man/man3/gearman_task_take_data.3 \ - docs/man/man3/gearman_task_recv_data.3 \ - docs/man/man3/gearman_worker_create.3 \ - docs/man/man3/gearman_worker_clone.3 \ - docs/man/man3/gearman_worker_free.3 \ - docs/man/man3/gearman_worker_error.3 \ - docs/man/man3/gearman_worker_errno.3 \ - docs/man/man3/gearman_worker_options.3 \ - docs/man/man3/gearman_worker_set_options.3 \ - docs/man/man3/gearman_worker_add_options.3 \ - docs/man/man3/gearman_worker_remove_options.3 \ - docs/man/man3/gearman_worker_timeout.3 \ - docs/man/man3/gearman_worker_set_timeout.3 \ - docs/man/man3/gearman_worker_context.3 \ - docs/man/man3/gearman_worker_set_context.3 \ - docs/man/man3/gearman_worker_set_log_fn.3 \ - docs/man/man3/gearman_worker_set_workload_malloc_fn.3 \ - docs/man/man3/gearman_worker_set_workload_free_fn.3 \ - docs/man/man3/gearman_worker_add_server.3 \ - docs/man/man3/gearman_worker_add_servers.3 \ - docs/man/man3/gearman_worker_remove_servers.3 \ - docs/man/man3/gearman_worker_wait.3 \ - docs/man/man3/gearman_worker_register.3 \ - docs/man/man3/gearman_worker_unregister.3 \ - docs/man/man3/gearman_worker_unregister_all.3 \ - docs/man/man3/gearman_worker_grab_job.3 \ - docs/man/man3/gearman_job_free_all.3 \ - docs/man/man3/gearman_worker_function_exist.3 \ - docs/man/man3/gearman_worker_add_function.3 \ - docs/man/man3/gearman_worker_work.3 \ - docs/man/man3/gearman_worker_echo.3 - diff -Nru gearmand-0.14/examples/echo_client.c gearmand-0.23/examples/echo_client.c --- gearmand-0.14/examples/echo_client.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/echo_client.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,83 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Echo Client - */ - -#include -#include -#include -#include - -#include - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - char *host= NULL; - in_port_t port= 0; - gearman_return_t ret; - gearman_client_st client; - - while ((c = getopt(argc, argv, "h:p:")) != -1) - { - switch(c) - { - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if (argc != (optind + 1)) - { - usage(argv[0]); - exit(1); - } - - if (gearman_client_create(&client) == NULL) - { - fprintf(stderr, "Memory allocation failure on client creation\n"); - exit(1); - } - - ret= gearman_client_add_server(&client, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - ret= gearman_client_echo(&client, (void *)argv[optind], - (size_t)strlen(argv[optind])); - if (ret != GEARMAN_SUCCESS) - fprintf(stderr, "%s\n", gearman_client_error(&client)); - - gearman_client_free(&client); - - return 0; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ] \n", name); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); -} diff -Nru gearmand-0.14/examples/echo_client.cc gearmand-0.23/examples/echo_client.cc --- gearmand-0.14/examples/echo_client.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/echo_client.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,133 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "config.h" + +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +int main(int args, char *argv[]) +{ + std::string text_to_echo; + std::string host; + in_port_t port; + + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("text", boost::program_options::value(&text_to_echo), "Text used for echo") + ; + + boost::program_options::positional_options_description text_options; + text_options.add("text", -1); + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::command_line_parser(args, argv). + options(desc).positional(text_options).run(), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (text_to_echo.empty()) + { + while(std::cin.good()) + { + char buffer[1024]; + + std::cin.read(buffer, sizeof(buffer)); + text_to_echo.append(buffer, std::cin.gcount()); + } + + if (text_to_echo.empty()) + { + std::cerr << "No text was provided for --text or via stdin" << std::endl; + std::cerr << desc << std::endl; + return EXIT_FAILURE; + } + } + + gearman_client_st client; + if (gearman_client_create(&client) == NULL) + { + std::cerr << "Memory allocation failure on client creation" << std::endl; + return EXIT_FAILURE; + } + + gearman_return_t ret; + ret= gearman_client_add_server(&client, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + return EXIT_FAILURE; + } + + ret= gearman_client_echo(&client, text_to_echo.c_str(), text_to_echo.size()); + gearman_client_free(&client); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + return EXIT_FAILURE; + } + + std::cout << text_to_echo; + + return EXIT_SUCCESS; +} diff -Nru gearmand-0.14/examples/echo_worker.c gearmand-0.23/examples/echo_worker.c --- gearmand-0.14/examples/echo_worker.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/echo_worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,83 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Echo Worker - */ - -#include -#include -#include -#include - -#include - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - char *host= NULL; - in_port_t port= 0; - gearman_return_t ret; - gearman_worker_st worker; - - while ((c = getopt(argc, argv, "h:p:")) != -1) - { - switch(c) - { - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if (argc != (optind + 1)) - { - usage(argv[0]); - exit(1); - } - - if (gearman_worker_create(&worker) == NULL) - { - fprintf(stderr, "Memory allocation failure on worker creation\n"); - exit(1); - } - - ret= gearman_worker_add_server(&worker, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - - ret= gearman_worker_echo(&worker, (void *)argv[optind], - (size_t)strlen(argv[optind])); - if (ret != GEARMAN_SUCCESS) - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - - gearman_worker_free(&worker); - - return 0; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ] \n", name); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); -} diff -Nru gearmand-0.14/examples/echo_worker.cc gearmand-0.23/examples/echo_worker.cc --- gearmand-0.14/examples/echo_worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/echo_worker.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,133 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" + +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +int main(int args, char *argv[]) +{ + std::string text_to_echo; + std::string host; + in_port_t port; + + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("text", boost::program_options::value(&text_to_echo), "Text used for echo") + ; + + boost::program_options::positional_options_description text_options; + text_options.add("text", -1); + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::command_line_parser(args, argv). + options(desc).positional(text_options).run(), vm); + + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (text_to_echo.empty()) + { + while(std::cin.good()) + { + char buffer[1024]; + + std::cin.read(buffer, sizeof(buffer)); + text_to_echo.append(buffer, std::cin.gcount()); + } + + if (text_to_echo.empty()) + { + std::cerr << "No text was provided for --text or via stdin" << std::endl; + std::cerr << desc << std::endl; + return EXIT_FAILURE; + } + } + + gearman_worker_st worker; + if (gearman_worker_create(&worker) == NULL) + { + std::cerr << "Memory allocation failure on worker creation" << std::endl; + return EXIT_FAILURE; + } + + gearman_return_t ret; + ret= gearman_worker_add_server(&worker, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + return EXIT_FAILURE; + } + + ret= gearman_worker_echo(&worker, text_to_echo.c_str(), text_to_echo.size()); + gearman_worker_free(&worker); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + return EXIT_FAILURE; + } + + std::cout << text_to_echo; + + return EXIT_SUCCESS; +} diff -Nru gearmand-0.14/examples/include.am gearmand-0.23/examples/include.am --- gearmand-0.14/examples/include.am 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/include.am 2011-04-28 19:44:27.000000000 +0200 @@ -2,6 +2,7 @@ # Gearman server and library # Copyright (C) 2008 Brian Aker, Eric Day # Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See @@ -10,34 +11,65 @@ # Included from Top Level Makefile.am # All paths should be given relative to the root -EXAMPLES_LDADD= $(LTLIBUUID) $(LTLIBEVENT) libgearman/libgearman.la +EXAMPLES_LDADD= \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + libgearman/libgearman.la + +EXAMPLES_LD_FLAGS= \ + $(AM_LDFLAGS) \ + $(CLIENT_LDFLAGS) \ + $(LTLIBEVENT) \ + $(LTLIBUUID) +EXAMPLES_CPPFLAGS= \ + $(AM_CPPFLAGS) \ + $(BOOST_CPPFLAGS) noinst_PROGRAMS+= \ - examples/echo_client \ - examples/echo_worker \ - examples/reverse_client \ - examples/reverse_client_bg \ - examples/reverse_client_cb \ - examples/reverse_worker \ - examples/wc_worker - -examples_echo_client_SOURCES= examples/echo_client.c -examples_echo_client_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) - -examples_echo_worker_SOURCES= examples/echo_worker.c -examples_echo_worker_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) - -examples_reverse_client_SOURCES= examples/reverse_client.c -examples_reverse_client_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) - -examples_reverse_client_bg_SOURCES= examples/reverse_client_bg.c -examples_reverse_client_bg_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) - -examples_reverse_client_cb_SOURCES= examples/reverse_client_cb.c -examples_reverse_client_cb_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) - -examples_reverse_worker_SOURCES= examples/reverse_worker.c -examples_reverse_worker_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) - -examples_wc_worker_SOURCES= examples/wc_worker.c -examples_wc_worker_LDADD= $(AM_LDADD) $(EXAMPLES_LDADD) + examples/echo_client \ + examples/echo_worker \ + examples/reverse_client \ + examples/reverse_client_bg \ + examples/reverse_client_epoch \ + examples/reverse_client_cb \ + examples/reverse_worker \ + examples/wc_worker + +examples_echo_client_SOURCES= examples/echo_client.cc +examples_echo_client_LDADD= $(EXAMPLES_LDADD) +examples_echo_client_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_echo_client_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_echo_worker_SOURCES= examples/echo_worker.cc +examples_echo_worker_LDADD= $(EXAMPLES_LDADD) +examples_echo_worker_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_echo_worker_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_reverse_client_SOURCES= examples/reverse_client.cc +examples_reverse_client_LDADD= $(EXAMPLES_LDADD) +examples_reverse_client_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_reverse_client_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_reverse_client_bg_SOURCES= examples/reverse_client_bg.cc +examples_reverse_client_bg_LDADD= $(EXAMPLES_LDADD) +examples_reverse_client_bg_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_reverse_client_bg_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_reverse_client_epoch_SOURCES= examples/reverse_client_epoch.cc +examples_reverse_client_epoch_LDADD= $(EXAMPLES_LDADD) +examples_reverse_client_epoch_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_reverse_client_epoch_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_reverse_client_cb_SOURCES= examples/reverse_client_cb.cc +examples_reverse_client_cb_LDADD= $(EXAMPLES_LDADD) +examples_reverse_client_cb_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_reverse_client_cb_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_reverse_worker_SOURCES= examples/reverse_worker.cc +examples_reverse_worker_LDADD= $(EXAMPLES_LDADD) +examples_reverse_worker_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_reverse_worker_LDFLAGS= $(EXAMPLES_LD_FLAGS) + +examples_wc_worker_SOURCES= examples/wc_worker.cc +examples_wc_worker_LDADD= $(EXAMPLES_LDADD) +examples_wc_worker_CPPFLAGS= $(EXAMPLES_CPPFLAGS) +examples_wc_worker_LDFLAGS= $(EXAMPLES_LD_FLAGS) diff -Nru gearmand-0.14/examples/reverse_client_bg.c gearmand-0.23/examples/reverse_client_bg.c --- gearmand-0.14/examples/reverse_client_bg.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/reverse_client_bg.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,114 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Example Background Client - */ - -#include -#include -#include -#include - -#include - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - char *host= NULL; - in_port_t port= 0; - gearman_return_t ret; - gearman_client_st client; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - bool is_known; - bool is_running; - uint32_t numerator; - uint32_t denominator; - - while ((c = getopt(argc, argv, "h:p:")) != -1) - { - switch(c) - { - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if(argc != (optind + 1)) - { - usage(argv[0]); - exit(1); - } - - if (gearman_client_create(&client) == NULL) - { - fprintf(stderr, "Memory allocation failure on client creation\n"); - exit(1); - } - - ret= gearman_client_add_server(&client, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - ret= gearman_client_do_background(&client, "reverse", NULL, - (void *)argv[optind], - (size_t)strlen(argv[optind]), job_handle); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - printf("Background Job Handle=%s\n", job_handle); - - while (1) - { - ret= gearman_client_job_status(&client, job_handle, &is_known, &is_running, - &numerator, &denominator); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - printf("Known=%s, Running=%s, Percent Complete=%u/%u\n", - is_known ? "true" : "false", is_running ? "true" : "false", - numerator, denominator); - - if (!is_known) - break; - - sleep(1); - } - - gearman_client_free(&client); - - return 0; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ] \n", name); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); -} diff -Nru gearmand-0.14/examples/reverse_client_bg.cc gearmand-0.23/examples/reverse_client_bg.cc --- gearmand-0.14/examples/reverse_client_bg.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/reverse_client_bg.cc 2011-06-18 20:23:05.000000000 +0200 @@ -0,0 +1,178 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +int main(int args, char *argv[]) +{ + in_port_t port; + int timeout; + std::string host; + std::string text_to_echo; + + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ("text", boost::program_options::value(&text_to_echo), "Text used for echo") + ; + + boost::program_options::positional_options_description text_options; + text_options.add("text", -1); + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::command_line_parser(args, argv). + options(desc).positional(text_options).run(), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (text_to_echo.empty()) + { + while(std::cin.good()) + { + char buffer[1024]; + + std::cin.read(buffer, sizeof(buffer)); + text_to_echo.append(buffer, std::cin.gcount()); + } + + if (text_to_echo.empty()) + { + std::cerr << "No text was provided for --text or via stdin" << std::endl; + std::cerr << desc << std::endl; + return EXIT_FAILURE; + } + } + + gearman_client_st client; + if (gearman_client_create(&client) == NULL) + { + std::cerr << "Memory allocation failure on client creation" << std::endl; + return EXIT_FAILURE; + } + + gearman_return_t ret; + ret= gearman_client_add_server(&client, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + return EXIT_FAILURE; + } + + if (timeout >= 0) + gearman_client_set_timeout(&client, timeout); + + + gearman_task_attr_t workload= gearman_task_attr_init(GEARMAN_JOB_PRIORITY_NORMAL); + + gearman_task_st *task; + gearman_argument_t values[]= { + gearman_argument_make(0, 0, text_to_echo.c_str(), text_to_echo.size()), + gearman_argument_make(0, 0, 0, 0) + }; + + if (not (task= gearman_execute(&client, gearman_literal_param("reverse"), NULL, 0, &workload, values, 0))) + { + std::cerr << "Failed to process job (" << gearman_client_error(&client) << std::endl; + gearman_client_free(&client); + return EXIT_FAILURE; + } + + std::cout << "Background Job Handle=" << gearman_task_job_handle(task) << std::endl; + + int exit_code= EXIT_SUCCESS; + bool is_known; + do + { + bool is_running; + uint32_t numerator; + uint32_t denominator; + + ret= gearman_client_job_status(&client, gearman_task_job_handle(task), + &is_known, &is_running, + &numerator, &denominator); + if (gearman_continue(ret)) // Non-blocking event occurred, try again + { + continue; + } + else if (gearman_failed(ret)) + { + std::cerr << gearman_client_error(&client) << std::endl; + exit_code= EXIT_FAILURE; + break; + } + + std::cout << std::boolalpha + << "Known =" << is_known + << ", Running=" << is_running + << ", Percent Complete=" << numerator << "/" << denominator << std::endl; + + } while (is_known); + + gearman_client_free(&client); + + return exit_code; +} diff -Nru gearmand-0.14/examples/reverse_client.c gearmand-0.23/examples/reverse_client.c --- gearmand-0.14/examples/reverse_client.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/reverse_client.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,122 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Example Client - */ - -#include -#include -#include -#include - -#include - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - char *host= NULL; - in_port_t port= 0; - int timeout= -1; - gearman_return_t ret; - gearman_client_st client; - char *result; - size_t result_size; - uint32_t numerator; - uint32_t denominator; - - while ((c = getopt(argc, argv, "h:p:t:")) != -1) - { - switch(c) - { - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - case 't': - timeout= atoi(optarg); - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if (argc != (optind + 1)) - { - usage(argv[0]); - exit(1); - } - - if (gearman_client_create(&client) == NULL) - { - fprintf(stderr, "Memory allocation failure on client creation\n"); - exit(1); - } - - if (timeout >= 0) - gearman_client_set_timeout(&client, timeout); - - ret= gearman_client_add_server(&client, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - while (1) - { - result= (char *)gearman_client_do(&client, "reverse", NULL, - (void *)argv[optind], - (size_t)strlen(argv[optind]), - &result_size, &ret); - if (ret == GEARMAN_WORK_DATA) - { - printf("Data=%.*s\n", (int)result_size, result); - free(result); - continue; - } - else if (ret == GEARMAN_WORK_STATUS) - { - gearman_client_do_status(&client, &numerator, &denominator); - printf("Status: %u/%u\n", numerator, denominator); - continue; - } - else if (ret == GEARMAN_SUCCESS) - { - printf("Result=%.*s\n", (int)result_size, result); - free(result); - } - else if (ret == GEARMAN_WORK_FAIL) - fprintf(stderr, "Work failed\n"); - else - fprintf(stderr, "%s\n", gearman_client_error(&client)); - - break; - } - - gearman_client_free(&client); - - return 0; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ] \n", name); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); - printf("\t-t - timeout in milliseconds\n"); -} diff -Nru gearmand-0.14/examples/reverse_client_cb.c gearmand-0.23/examples/reverse_client_cb.c --- gearmand-0.14/examples/reverse_client_cb.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/reverse_client_cb.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,146 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Example Client Using Callbacks - */ - -#include -#include -#include -#include - -#include - -#define REVERSE_TASKS 10 - -static gearman_return_t created(gearman_task_st *task); -static gearman_return_t data(gearman_task_st *task); -static gearman_return_t status(gearman_task_st *task); -static gearman_return_t complete(gearman_task_st *task); -static gearman_return_t fail(gearman_task_st *task); - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - char *host= NULL; - in_port_t port= 0; - gearman_return_t ret; - gearman_client_st client; - gearman_task_st task[REVERSE_TASKS]; - uint32_t x; - - while ((c = getopt(argc, argv, "h:p:")) != -1) - { - switch(c) - { - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if(argc != (optind + 1)) - { - usage(argv[0]); - exit(1); - } - - if (gearman_client_create(&client) == NULL) - { - fprintf(stderr, "Memory allocation failure on client creation\n"); - exit(1); - } - - ret= gearman_client_add_server(&client, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - for (x= 0; x < REVERSE_TASKS; x++) - { - if (gearman_client_add_task(&client, &(task[x]), NULL, "reverse", NULL, - (void *)argv[optind], - (size_t)strlen(argv[optind]), &ret) == NULL || - ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - } - - gearman_client_set_created_fn(&client, created); - gearman_client_set_data_fn(&client, data); - gearman_client_set_status_fn(&client, status); - gearman_client_set_complete_fn(&client, complete); - gearman_client_set_fail_fn(&client, fail); - ret= gearman_client_run_tasks(&client); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_client_error(&client)); - exit(1); - } - - gearman_client_free(&client); - - return 0; -} - -static gearman_return_t created(gearman_task_st *task) -{ - printf("Created: %s\n", gearman_task_job_handle(task)); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t data(gearman_task_st *task) -{ - printf("Data: %s %.*s\n", gearman_task_job_handle(task), - (int)gearman_task_data_size(task), (char *)gearman_task_data(task)); - return GEARMAN_SUCCESS; -} - -static gearman_return_t status(gearman_task_st *task) -{ - printf("Status: %s (%u/%u)\n", gearman_task_job_handle(task), - gearman_task_numerator(task), gearman_task_denominator(task)); - return GEARMAN_SUCCESS; -} - -static gearman_return_t complete(gearman_task_st *task) -{ - printf("Completed: %s %.*s\n", gearman_task_job_handle(task), - (int)gearman_task_data_size(task), (char *)gearman_task_data(task)); - return GEARMAN_SUCCESS; -} - -static gearman_return_t fail(gearman_task_st *task) -{ - printf("Failed: %s\n", gearman_task_job_handle(task)); - return GEARMAN_SUCCESS; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ] \n", name); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); -} diff -Nru gearmand-0.14/examples/reverse_client_cb.cc gearmand-0.23/examples/reverse_client_cb.cc --- gearmand-0.14/examples/reverse_client_cb.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/reverse_client_cb.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,188 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +#define REVERSE_TASKS 10 + +static gearman_return_t created(gearman_task_st *task); +static gearman_return_t data(gearman_task_st *task); +static gearman_return_t status(gearman_task_st *task); +static gearman_return_t complete(gearman_task_st *task); +static gearman_return_t fail(gearman_task_st *task); + +int main(int args, char *argv[]) +{ + in_port_t port; + int timeout; + std::string host; + std::string text_to_echo; + + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ("text", boost::program_options::value(&text_to_echo), "Text used for echo") + ; + + boost::program_options::positional_options_description text_options; + text_options.add("text", -1); + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::command_line_parser(args, argv). + options(desc).positional(text_options).run(), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + gearman_client_st client; + if (gearman_client_create(&client) == NULL) + { + std::cerr << "Memory allocation failure on client creation" << std::endl; + return EXIT_FAILURE; + } + + gearman_return_t ret; + ret= gearman_client_add_server(&client, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + gearman_client_free(&client); + return EXIT_FAILURE; + } + + gearman_task_st task[REVERSE_TASKS]; + for (uint32_t x= 0; x < REVERSE_TASKS; x++) + { + if (gearman_client_add_task(&client, &(task[x]), NULL, "reverse", NULL, + text_to_echo.c_str(), text_to_echo.size(), + &ret) == NULL || + ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + gearman_client_free(&client); + return EXIT_FAILURE; + } + } + + gearman_client_set_created_fn(&client, created); + gearman_client_set_data_fn(&client, data); + gearman_client_set_status_fn(&client, status); + gearman_client_set_complete_fn(&client, complete); + gearman_client_set_fail_fn(&client, fail); + + ret= gearman_client_run_tasks(&client); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + gearman_client_free(&client); + return EXIT_FAILURE; + } + + gearman_client_free(&client); + + return EXIT_SUCCESS; +} + +static gearman_return_t created(gearman_task_st *task) +{ + std::cout << "Created: " << gearman_task_job_handle(task) << std::endl; + + return GEARMAN_SUCCESS; +} + +static gearman_return_t data(gearman_task_st *task) +{ + std::cout << "Data: " << gearman_task_job_handle(task) << " "; + std::cout.write((char *)gearman_task_data(task), gearman_task_data_size(task)); + std::cout << std::endl; + + return GEARMAN_SUCCESS; +} + +static gearman_return_t status(gearman_task_st *task) +{ + std::clog << "Status: " + << gearman_task_job_handle(task) + << " (" << gearman_task_numerator(task) << "/" << gearman_task_denominator(task) << ")" + << std::endl; + + return GEARMAN_SUCCESS; +} + +static gearman_return_t complete(gearman_task_st *task) +{ + std::cout << "Completed: " << gearman_task_job_handle(task) << " "; + std::cout.write((char *)gearman_task_data(task), gearman_task_data_size(task)); + std::cout << std::endl; + + return GEARMAN_SUCCESS; +} + +static gearman_return_t fail(gearman_task_st *task) +{ + std::cerr << "Failed: " << gearman_task_job_handle(task) << std::endl; + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/examples/reverse_client.cc gearmand-0.23/examples/reverse_client.cc --- gearmand-0.14/examples/reverse_client.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/reverse_client.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,173 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +int main(int args, char *argv[]) +{ + in_port_t port; + std::string text_to_echo; + std::string host; + int timeout; + + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ("text", boost::program_options::value(&text_to_echo), "Text used for echo") + ; + + boost::program_options::positional_options_description text_options; + text_options.add("text", -1); + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::command_line_parser(args, argv). + options(desc).positional(text_options).run(), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (text_to_echo.empty()) + { + while(std::cin.good()) + { + char buffer[1024]; + + std::cin.read(buffer, sizeof(buffer)); + text_to_echo.append(buffer, std::cin.gcount()); + } + + if (text_to_echo.empty()) + { + std::cerr << "No text was provided for --text or via stdin" << std::endl; + std::cerr << desc << std::endl; + return EXIT_FAILURE; + } + } + + gearman_client_st client; + if (gearman_client_create(&client) == NULL) + { + std::cerr << "Memory allocation failure on client creation" << std::endl; + return EXIT_FAILURE; + } + + if (timeout >= 0) + gearman_client_set_timeout(&client, timeout); + + gearman_return_t ret; + ret= gearman_client_add_server(&client, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + return EXIT_FAILURE; + } + + int exit_code= EXIT_SUCCESS; + while (1) + { + size_t result_size; + char *result; + result= (char *)gearman_client_do(&client, "reverse", NULL, + text_to_echo.c_str(), text_to_echo.size(), + &result_size, &ret); + if (ret == GEARMAN_WORK_DATA) + { + std::cout.write(result, result_size); + + free(result); + continue; + } + else if (ret == GEARMAN_WORK_STATUS) + { + uint32_t numerator; + uint32_t denominator; + + gearman_client_do_status(&client, &numerator, &denominator); + std::clog << "Status: " << numerator << "/" << denominator << std::endl; + continue; + } + else if (ret == GEARMAN_SUCCESS) + { + std::cout.write(result, result_size); + free(result); + } + else if (ret == GEARMAN_WORK_FAIL) + { + std::cerr << "Work failed" << std::endl; + exit_code= EXIT_FAILURE; + } + else + { + std::cerr << gearman_client_error(&client) << std::endl; + exit_code= EXIT_FAILURE; + } + + break; + } + + gearman_client_free(&client); + + return EXIT_SUCCESS; +} diff -Nru gearmand-0.14/examples/reverse_client_epoch.cc gearmand-0.23/examples/reverse_client_epoch.cc --- gearmand-0.14/examples/reverse_client_epoch.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/reverse_client_epoch.cc 2011-06-18 20:23:18.000000000 +0200 @@ -0,0 +1,173 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +int main(int args, char *argv[]) +{ + in_port_t port; + int timeout; + time_t epoch; + std::string host; + std::string text_to_echo; + + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ("epoch", boost::program_options::value(&epoch)->default_value(10), "Seconds forward in time for task to run.") + ("text", boost::program_options::value(&text_to_echo), "Text used for echo") + ; + + boost::program_options::positional_options_description text_options; + text_options.add("text", -1); + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::command_line_parser(args, argv). + options(desc).positional(text_options).run(), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (text_to_echo.empty()) + { + while(std::cin.good()) + { + char buffer[1024]; + + std::cin.read(buffer, sizeof(buffer)); + text_to_echo.append(buffer, std::cin.gcount()); + } + + if (text_to_echo.empty()) + { + std::cerr << "No text was provided for --text or via stdin" << std::endl; + std::cerr << desc << std::endl; + return EXIT_FAILURE; + } + } + + gearman_client_st client; + if (gearman_client_create(&client) == NULL) + { + std::cerr << "Memory allocation failure on client creation" << std::endl; + return EXIT_FAILURE; + } + + gearman_return_t ret; + ret= gearman_client_add_server(&client, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_client_error(&client) << std::endl; + return EXIT_FAILURE; + } + + if (timeout >= 0) + gearman_client_set_timeout(&client, timeout); + + gearman_task_attr_t workload= gearman_task_attr_init_epoch(time(NULL) +epoch, GEARMAN_JOB_PRIORITY_NORMAL); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, text_to_echo.c_str(), text_to_echo.size()); + + if (not (task= gearman_execute(&client, gearman_literal_param("reverse"), NULL, 0, &workload, &value, 0))) + { + std::cerr << gearman_client_error(&client) << std::endl; + return EXIT_FAILURE; + } + std::cout << "Background Job Handle=" << gearman_task_job_handle(task) << std::endl; + + int exit_code= EXIT_SUCCESS; + bool is_known; + do + { + bool is_running; + uint32_t numerator; + uint32_t denominator; + + ret= gearman_client_job_status(&client, gearman_task_job_handle(task), + &is_known, &is_running, + &numerator, &denominator); + if (gearman_continue(ret)) // Non-blocking event occurred, try again + { + continue; + } + else if (gearman_failed(ret)) + { + std::cerr << gearman_client_error(&client) << std::endl; + exit_code= EXIT_FAILURE; + break; + } + + std::cout << std::boolalpha + << "Known =" << is_known + << ", Running=" << is_running + << ", Percent Complete=" << numerator << "/" << denominator << std::endl; + + } while (is_known); + + gearman_client_free(&client); + + return exit_code; +} diff -Nru gearmand-0.14/examples/reverse_worker.c gearmand-0.23/examples/reverse_worker.c --- gearmand-0.14/examples/reverse_worker.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/reverse_worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,213 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Example Worker - */ - -#include -#include -#include -#include -#include - -#include - -typedef enum -{ - REVERSE_WORKER_OPTIONS_NONE= 0, - REVERSE_WORKER_OPTIONS_DATA= (1 << 0), - REVERSE_WORKER_OPTIONS_STATUS= (1 << 1), - REVERSE_WORKER_OPTIONS_UNIQUE= (1 << 2) -} reverse_worker_options_t; - -static void *reverse(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr); - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - uint32_t count= 0; - char *host= NULL; - in_port_t port= 0; - reverse_worker_options_t options= REVERSE_WORKER_OPTIONS_NONE; - int timeout= -1; - gearman_return_t ret; - gearman_worker_st worker; - - while ((c = getopt(argc, argv, "c:dh:p:st:u")) != -1) - { - switch(c) - { - case 'c': - count= (uint32_t)atoi(optarg); - break; - - case 'd': - options|= REVERSE_WORKER_OPTIONS_DATA; - break; - - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - case 's': - options|= REVERSE_WORKER_OPTIONS_STATUS; - break; - - case 't': - timeout= atoi(optarg); - break; - - case 'u': - options|= REVERSE_WORKER_OPTIONS_UNIQUE; - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) - { - fprintf(stderr, "signal:%d\n", errno); - exit(1); - } - - if (gearman_worker_create(&worker) == NULL) - { - fprintf(stderr, "Memory allocation failure on worker creation\n"); - exit(1); - } - - if (options & REVERSE_WORKER_OPTIONS_UNIQUE) - gearman_worker_add_options(&worker, GEARMAN_WORKER_GRAB_UNIQ); - - if (timeout >= 0) - gearman_worker_set_timeout(&worker, timeout); - - ret= gearman_worker_add_server(&worker, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - - ret= gearman_worker_add_function(&worker, "reverse", 0, reverse, - &options); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - - while (1) - { - ret= gearman_worker_work(&worker); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - break; - } - - if (count > 0) - { - count--; - if (count == 0) - break; - } - } - - gearman_worker_free(&worker); - - return 0; -} - -static void *reverse(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr) -{ - reverse_worker_options_t options= *((reverse_worker_options_t *)context); - const uint8_t *workload; - uint8_t *result; - size_t x; - size_t y; - - workload= gearman_job_workload(job); - *result_size= gearman_job_workload_size(job); - - result= malloc(*result_size); - if (result == NULL) - { - fprintf(stderr, "malloc:%d\n", errno); - *ret_ptr= GEARMAN_WORK_FAIL; - return NULL; - } - - for (y= 0, x= *result_size; x; x--, y++) - { - result[y]= ((uint8_t *)workload)[x - 1]; - - if (options & REVERSE_WORKER_OPTIONS_DATA) - { - *ret_ptr= gearman_job_send_data(job, &(result[y]), 1); - if (*ret_ptr != GEARMAN_SUCCESS) - { - free(result); - return NULL; - } - } - - if (options & REVERSE_WORKER_OPTIONS_STATUS) - { - *ret_ptr= gearman_job_send_status(job, (uint32_t)y, - (uint32_t)*result_size); - if (*ret_ptr != GEARMAN_SUCCESS) - { - free(result); - return NULL; - } - - sleep(1); - } - } - - printf("Job=%s%s%s Workload=%.*s Result=%.*s\n", gearman_job_handle(job), - options & REVERSE_WORKER_OPTIONS_UNIQUE ? " Unique=" : "", - options & REVERSE_WORKER_OPTIONS_UNIQUE ? gearman_job_unique(job) : "", - (int)*result_size, workload, (int)*result_size, result); - - *ret_ptr= GEARMAN_SUCCESS; - - if (options & REVERSE_WORKER_OPTIONS_DATA) - { - *result_size= 0; - return NULL; - } - - return result; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ]\n", name); - printf("\t-c - number of jobs to run before exiting\n"); - printf("\t-d - send result back in data chunks\n"); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); - printf("\t-s - send status updates and sleep while running job\n"); - printf("\t-t - timeout in milliseconds\n"); - printf("\t-u - when grabbing jobs, grab the uniqie id\n"); -} diff -Nru gearmand-0.14/examples/reverse_worker.cc gearmand-0.23/examples/reverse_worker.cc --- gearmand-0.14/examples/reverse_worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/reverse_worker.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,241 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +struct reverse_worker_options_t +{ + bool chunk; + bool status; + bool unique; + + reverse_worker_options_t(): + chunk(false), + status(false), + unique(false) + { } +}; + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static void *reverse(gearman_job_st *job, void *context, + size_t *result_size, gearman_return_t *ret_ptr); + +int main(int args, char *argv[]) +{ + uint32_t count; + reverse_worker_options_t options; + int timeout; + + in_port_t port; + std::string host; + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("count,c", boost::program_options::value(&count)->default_value(0), "Number of jobs to run before exiting") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ("chunk,d", boost::program_options::bool_switch(&options.chunk)->default_value(false), "Send result back in data chunks") + ("status,s", boost::program_options::bool_switch(&options.status)->default_value(false), "Send status updates and sleep while running job") + ("unique,u", boost::program_options::bool_switch(&options.unique)->default_value(false), "When grabbing jobs, grab the uniqie id") + ; + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::parse_command_line(args, argv, desc), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) + { + std::cerr << "signal:" << strerror(errno) << std::endl; + return EXIT_FAILURE; + } + + gearman_worker_st worker; + if (gearman_worker_create(&worker) == NULL) + { + std::cerr << "Memory allocation failure on worker creation." << std::endl; + return EXIT_FAILURE; + } + + if (options.unique) + gearman_worker_add_options(&worker, GEARMAN_WORKER_GRAB_UNIQ); + + if (timeout >= 0) + gearman_worker_set_timeout(&worker, timeout); + + gearman_return_t ret; + ret= gearman_worker_add_server(&worker, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + return EXIT_FAILURE; + } + + ret= gearman_worker_add_function(&worker, "reverse", 0, reverse, &options); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + return EXIT_FAILURE; + } + + while (1) + { + ret= gearman_worker_work(&worker); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + break; + } + + if (count > 0) + { + count--; + if (count == 0) + break; + } + } + + gearman_worker_free(&worker); + + return EXIT_SUCCESS; +} + +static void *reverse(gearman_job_st *job, void *context, + size_t *result_size, gearman_return_t *ret_ptr) +{ + reverse_worker_options_t options= *((reverse_worker_options_t *)context); + + + const char *workload; + workload= (const char *)gearman_job_workload(job); + *result_size= gearman_job_workload_size(job); + + char *result; + result= (char *)malloc(*result_size); + if (result == NULL) + { + perror("malloc"); + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + + size_t x; + size_t y; + for (y= 0, x= *result_size; x; x--, y++) + { + result[y]= ((uint8_t *)workload)[x - 1]; + + if (options.chunk) + { + *ret_ptr= gearman_job_send_data(job, &(result[y]), 1); + if (*ret_ptr != GEARMAN_SUCCESS) + { + free(result); + return NULL; + } + } + + if (options.status) + { + *ret_ptr= gearman_job_send_status(job, (uint32_t)y, + (uint32_t)*result_size); + if (*ret_ptr != GEARMAN_SUCCESS) + { + free(result); + return NULL; + } + + sleep(1); + } + } + + std::cout << "Job=" << gearman_job_handle(job); + + if (options.unique) + { + std::cout << "Unique=" << gearman_job_unique(job); + } + + + std::cout << " Workload="; + std::cout.write(workload, *result_size); + + std::cout << " Result="; + std::cout.write(result, *result_size); + + std::cout << std::endl; + + *ret_ptr= GEARMAN_SUCCESS; + + if (options.chunk) + { + *result_size= 0; + return NULL; + } + + return result; +} diff -Nru gearmand-0.14/examples/wc_worker.c gearmand-0.23/examples/wc_worker.c --- gearmand-0.14/examples/wc_worker.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/examples/wc_worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,160 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Example Worker - */ - -#include -#include -#include -#include -#include - -#include - -static void *wc(gearman_job_st *job, void *context, size_t *result_size, - gearman_return_t *ret_ptr); - -static void usage(char *name); - -int main(int argc, char *argv[]) -{ - int c; - uint32_t count= 0; - char *host= NULL; - in_port_t port= 0; - gearman_return_t ret; - gearman_worker_st worker; - - while ((c = getopt(argc, argv, "c:h:p:")) != -1) - { - switch(c) - { - case 'c': - count= (uint32_t)atoi(optarg); - break; - - case 'h': - host= optarg; - break; - - case 'p': - port= (in_port_t)atoi(optarg); - break; - - default: - usage(argv[0]); - exit(1); - } - } - - if (gearman_worker_create(&worker) == NULL) - { - fprintf(stderr, "Memory allocation failure on worker creation\n"); - exit(1); - } - - ret= gearman_worker_add_server(&worker, host, port); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - - ret= gearman_worker_add_function(&worker, "wc", 0, wc, NULL); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - exit(1); - } - - while (1) - { - ret= gearman_worker_work(&worker); - if (ret != GEARMAN_SUCCESS) - { - fprintf(stderr, "%s\n", gearman_worker_error(&worker)); - break; - } - - if (count > 0) - { - count--; - if (count == 0) - break; - } - } - - gearman_worker_free(&worker); - - return 0; -} - -static void *wc(gearman_job_st *job, void *context, size_t *result_size, - gearman_return_t *ret_ptr) -{ - const uint8_t *workload; - uint8_t *result; - size_t x; - uint64_t count= 0; - (void)context; - - workload= gearman_job_workload(job); - *result_size= gearman_job_workload_size(job); - - result= malloc(21); /* Max digits for a 64 bit int. */ - if (result == NULL) - { - fprintf(stderr, "malloc:%d\n", errno); - *ret_ptr= GEARMAN_WORK_FAIL; - return NULL; - } - - if (workload != NULL) - { - if (workload[0] != ' ' && workload[0] != '\t' && workload[0] != '\n') - count++; - - for (x= 0; x < *result_size; x++) - { - if (workload[x] != ' ' && workload[x] != '\t' && workload[x] != '\n') - continue; - - count++; - - while (workload[x] == ' ' || workload[x] == '\t' || workload[x] == '\n') - { - x++; - if (x == *result_size) - { - count--; - break; - } - } - } - } - - snprintf((char *)result, 21, "%" PRIu64, count); - - printf("Job=%s Workload=%.*s Result=%s\n", gearman_job_handle(job), - (int)*result_size, workload, result); - - *result_size= strlen((char *)result) + 1; - - *ret_ptr= GEARMAN_SUCCESS; - return result; -} - -static void usage(char *name) -{ - printf("\nusage: %s [-h ] [-p ]\n", name); - printf("\t-h - job server host\n"); - printf("\t-p - job server port\n"); -} diff -Nru gearmand-0.14/examples/wc_worker.cc gearmand-0.23/examples/wc_worker.cc --- gearmand-0.14/examples/wc_worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/examples/wc_worker.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,185 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static void *wc(gearman_job_st *job, void *context, size_t *result_size, + gearman_return_t *ret_ptr); + +int main(int args, char *argv[]) +{ + uint32_t count; + int timeout; + + in_port_t port; + std::string host; + boost::program_options::options_description desc("Options"); + desc.add_options() + ("help", "Options related to the program.") + ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") + ("count,c", boost::program_options::value(&count)->default_value(0), "Number of jobs to run before exiting") + ("timeout,u", boost::program_options::value(&timeout)->default_value(-1), "Timeout in milliseconds") + ; + + boost::program_options::variables_map vm; + try + { + boost::program_options::store(boost::program_options::parse_command_line(args, argv, desc), vm); + boost::program_options::notify(vm); + } + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("help")) + { + std::cout << desc << std::endl; + return EXIT_SUCCESS; + } + + gearman_worker_st worker; + if (gearman_worker_create(&worker) == NULL) + { + std::cerr << "Memory allocation failure on worker creation." << std::endl; + return EXIT_FAILURE; + } + + if (timeout >= 0) + gearman_worker_set_timeout(&worker, timeout); + + gearman_return_t ret; + ret= gearman_worker_add_server(&worker, host.c_str(), port); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + return EXIT_FAILURE; + } + + ret= gearman_worker_add_function(&worker, "wc", 0, wc, NULL); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + return EXIT_FAILURE; + } + + + while (1) + { + ret= gearman_worker_work(&worker); + if (ret != GEARMAN_SUCCESS) + { + std::cerr << gearman_worker_error(&worker) << std::endl; + break; + } + + if (count > 0) + { + count--; + if (count == 0) + break; + } + } + + gearman_worker_free(&worker); + + return EXIT_SUCCESS; +} + +static void *wc(gearman_job_st *job, void *context, size_t *result_size, + gearman_return_t *ret_ptr) +{ + (void)context; + + const char *workload; + workload= (const char *)gearman_job_workload(job); + *result_size= gearman_job_workload_size(job); + + uint64_t count= 0; + if (workload != NULL) + { + if (workload[0] != ' ' && workload[0] != '\t' && workload[0] != '\n') + count++; + + for (size_t x= 0; x < *result_size; x++) + { + if (workload[x] != ' ' && workload[x] != '\t' && workload[x] != '\n') + continue; + + count++; + + while (workload[x] == ' ' || workload[x] == '\t' || workload[x] == '\n') + { + x++; + if (x == *result_size) + { + count--; + break; + } + } + } + } + + + std::string result= boost::lexical_cast(count); + std::cerr << "Job= " << gearman_job_handle(job) << " Workload="; + std::cerr.write(workload, *result_size); + + std::cerr << " Result=" << result << std::endl; + + *result_size= result.size(); + + *ret_ptr= GEARMAN_SUCCESS; + return strdup(result.c_str()); +} diff -Nru gearmand-0.14/gearmand/gearmand.c gearmand-0.23/gearmand/gearmand.c --- gearmand-0.14/gearmand/gearmand.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/gearmand/gearmand.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,659 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#ifdef HAVE_ERRNO_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_PWD_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_STDIO_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include - -#ifdef HAVE_LIBDRIZZLE -#include -#endif - -#ifdef HAVE_LIBMEMCACHED -#include -#endif - -#ifdef HAVE_LIBSQLITE3 -#include -#endif - -#ifdef HAVE_LIBPQ -#include -#endif - -#ifdef HAVE_LIBTOKYOCABINET -#include -#endif - -#include - -#define GEARMAND_LOG_REOPEN_TIME 60 -#define GEARMAND_LISTEN_BACKLOG 32 - -typedef struct -{ - const char *file; - int fd; - time_t reopen; -} gearmand_log_info_st; - -static gearmand_st *_gearmand; - -static bool _set_fdlimit(rlim_t fds); -static bool _pid_write(const char *pid_file); -static void _pid_delete(const char *pid_file); -static bool _switch_user(const char *user); -static bool _set_signals(void); -static void _shutdown_handler(int signal_arg); -static void _log(const char *line, gearman_verbose_t verbose, void *context); - -int main(int argc, char *argv[]) -{ - gearman_conf_st conf; - gearman_conf_module_st module; - const char *name; - const char *value; - int backlog= GEARMAND_LISTEN_BACKLOG; - rlim_t fds= 0; - uint8_t job_retries= 0; - uint8_t worker_wakeup= 0; - in_port_t port= 0; - const char *host= NULL; - const char *pid_file= NULL; - const char *queue_type= NULL; - uint32_t threads= 0; - const char *user= NULL; - uint8_t verbose= 0; - gearman_return_t ret; - gearmand_log_info_st log_info; - bool close_stdio= false; - int fd; - bool round_robin= false; - - log_info.file= NULL; - log_info.fd= -1; - log_info.reopen= 0; - - if (gearman_conf_create(&conf) == NULL) - { - fprintf(stderr, "gearmand: gearman_conf_create: NULL\n"); - return 1; - } - - if (gearman_conf_module_create(&conf, &module, NULL) == NULL) - { - fprintf(stderr, "gearmand: gearman_conf_module_create: NULL\n"); - return 1; - } - - /* Add all main configuration options. */ -#define MCO(__name, __short, __value, __help) \ - gearman_conf_module_add_option(&module, __name, __short, __value, __help); - - MCO("backlog", 'b', "BACKLOG", "Number of backlog connections for listen.") - MCO("daemon", 'd', NULL, "Daemon, detach and run in the background.") - MCO("file-descriptors", 'f', "FDS", - "Number of file descriptors to allow for the process (total connections " - "will be slightly less). Default is max allowed for user.") - MCO("help", 'h', NULL, "Print this help menu."); - MCO("job-retries", 'j', "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.") - MCO("log-file", 'l', "FILE", - "Log file to write errors and information to. Turning this option on " - "also forces the first verbose level to be enabled.") - MCO("listen", 'L', "ADDRESS", - "Address the server should listen on. Default is INADDR_ANY.") - MCO("port", 'p', "PORT", "Port the server should listen on.") - MCO("pid-file", 'P', "FILE", "File to write process ID out to.") - MCO("protocol", 'r', "PROTOCOL", "Load protocol module.") - MCO("round-robin", 'R', NULL, "Assign work in round-robin order per worker" - "connection. The default is to assign work in the order of functions " - "added by the worker.") - MCO("queue-type", 'q', "QUEUE", "Persistent queue type to use.") - MCO("threads", 't', "THREADS", "Number of I/O threads to use. Default=0.") - MCO("user", 'u', "USER", "Switch to given user after startup.") - MCO("verbose", 'v', NULL, "Increase verbosity level by one.") - MCO("version", 'V', NULL, "Display the version of gearmand and exit.") - MCO("worker-wakeup", 'w', "WORKERS", - "Number of workers to wakeup for each job received. The default is to " - "wakeup all available workers.") - - /* Make sure none of the gearman_conf_module_add_option calls failed. */ - if (gearman_conf_return(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_conf_module_add_option: %s\n", - gearman_conf_error(&conf)); - return 1; - } - - /* Add queue configuration options. */ - -#ifdef HAVE_LIBDRIZZLE - if (gearman_server_queue_libdrizzle_conf(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_queue_libdrizzle_conf: %s\n", - gearman_conf_error(&conf)); - return 1; - } -#endif - -#ifdef HAVE_LIBMEMCACHED - if (gearman_server_queue_libmemcached_conf(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_queue_libmemcached_conf: %s\n", - gearman_conf_error(&conf)); - return 1; - } -#endif -#ifdef HAVE_LIBTOKYOCABINET - if (gearman_server_queue_libtokyocabinet_conf(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_queue_libtokyocabinet_conf: %s\n", - gearman_conf_error(&conf)); - return 1; - } -#endif - -#ifdef HAVE_LIBSQLITE3 - if (gearman_server_queue_libsqlite3_conf(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_queue_libsqlite3_conf: %s\n", - gearman_conf_error(&conf)); - return 1; - } -#endif - -#ifdef HAVE_LIBPQ - if (gearman_server_queue_libpq_conf(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_queue_libpq_conf: %s\n", - gearman_conf_error(&conf)); - return 1; - } -#endif - - if (gearmand_protocol_http_conf(&conf) != GEARMAN_SUCCESS) - { - fprintf(stderr, "gearmand: gearman_protocol_http_conf: %s\n", - gearman_conf_error(&conf)); - return 1; - } - - /* Let gearman conf parse the command line arguments. */ - if (gearman_conf_parse_args(&conf, argc, argv) != GEARMAN_SUCCESS) - { - printf("\n%s\n\n", gearman_conf_error(&conf)); - printf("gearmand %s - %s\n\n", gearman_version(), gearman_bugreport()); - printf("usage: %s [OPTIONS]\n", argv[0]); - gearman_conf_usage(&conf); - return 1; - } - - /* Check for option values that were given. */ - while (gearman_conf_module_value(&module, &name, &value)) - { - if (!strcmp(name, "backlog")) - backlog= atoi(value); - else if (!strcmp(name, "daemon")) - { - switch (fork()) - { - case -1: - fprintf(stderr, "gearmand: fork:%d\n", errno); - return 1; - - case 0: - break; - - default: - return 0; - } - - if (setsid() == -1) - { - fprintf(stderr, "gearmand: setsid:%d\n", errno); - return 1; - } - - close_stdio= true; - } - else if (!strcmp(name, "file-descriptors")) - fds= (rlim_t)atoi(value); - else if (!strcmp(name, "help")) - { - printf("\ngearmand %s - %s\n\n", gearman_version(), gearman_bugreport()); - printf("usage: %s [OPTIONS]\n", argv[0]); - gearman_conf_usage(&conf); - return 1; - } - else if (!strcmp(name, "job-retries")) - job_retries= (uint8_t)atoi(value); - else if (!strcmp(name, "log-file")) - log_info.file= value; - else if (!strcmp(name, "listen")) - host= value; - else if (!strcmp(name, "port")) - port= (in_port_t)atoi(value); - else if (!strcmp(name, "pid-file")) - pid_file= value; - else if (!strcmp(name, "protocol")) - continue; - else if (!strcmp(name, "queue-type")) - queue_type= value; - else if (!strcmp(name, "threads")) - threads= (uint32_t)atoi(value); - else if (!strcmp(name, "user")) - user= value; - else if (!strcmp(name, "verbose")) - verbose++; - else if (!strcmp(name, "round-robin")) - round_robin++; - else if (!strcmp(name, "version")) - printf("\ngearmand %s - %s\n", gearman_version(), gearman_bugreport()); - else if (!strcmp(name, "worker-wakeup")) - worker_wakeup= (uint8_t)atoi(value); - else - { - fprintf(stderr, "gearmand: Unknown option:%s\n", name); - return 1; - } - } - - if (verbose == 0 && close_stdio) - { - /* If we can't remap stdio, it should not a fatal error. */ - fd = open("/dev/null", O_RDWR, 0); - if (fd != -1) - { - if (dup2(fd, STDIN_FILENO) == -1) - { - fprintf(stderr, "gearmand: dup2:%d\n", errno); - return 1; - } - - if (dup2(fd, STDOUT_FILENO) == -1) - { - fprintf(stderr, "gearmand: dup2:%d\n", errno); - return 1; - } - - if (dup2(fd, STDERR_FILENO) == -1) - { - fprintf(stderr, "gearmand: dup2:%d\n", errno); - return 1; - } - - close(fd); - } - } - - if ((fds > 0 && _set_fdlimit(fds)) || _switch_user(user) || _set_signals()) - return 1; - - if (pid_file != NULL && _pid_write(pid_file)) - return 1; - - _gearmand= gearmand_create(host, port); - if (_gearmand == NULL) - { - fprintf(stderr, "gearmand: Could not create gearmand library instance\n"); - return 1; - } - - gearmand_set_backlog(_gearmand, backlog); - gearmand_set_threads(_gearmand, threads); - gearmand_set_job_retries(_gearmand, job_retries); - gearmand_set_worker_wakeup(_gearmand, worker_wakeup); - gearmand_set_log_fn(_gearmand, _log, &log_info, verbose); - gearmand_set_round_robin(_gearmand, round_robin); - - if (queue_type != NULL) - { -#ifdef HAVE_LIBDRIZZLE - if (!strcmp(queue_type, "libdrizzle")) - { - ret= gearmand_queue_libdrizzle_init(_gearmand, &conf); - if (ret != GEARMAN_SUCCESS) - return 1; - } - else -#endif -#ifdef HAVE_LIBMEMCACHED - if (!strcmp(queue_type, "libmemcached")) - { - ret= gearmand_queue_libmemcached_init(_gearmand, &conf); - if (ret != GEARMAN_SUCCESS) - return 1; - } - else -#endif -#ifdef HAVE_LIBSQLITE3 - if (!strcmp(queue_type, "libsqlite3")) - { - ret= gearmand_queue_libsqlite3_init(_gearmand, &conf); - if (ret != GEARMAN_SUCCESS) - return 1; - } - else -#endif -#ifdef HAVE_LIBPQ - if (!strcmp(queue_type, "libpq")) - { - ret= gearmand_queue_libpq_init(_gearmand, &conf); - if (ret != GEARMAN_SUCCESS) - return 1; - } - else -#endif -#ifdef HAVE_LIBTOKYOCABINET - if (!strcmp(queue_type, "libtokyocabinet")) - { - ret= gearmand_queue_libtokyocabinet_init(_gearmand, &conf); - if (ret != GEARMAN_SUCCESS) - return 1; - } - else -#endif - { - fprintf(stderr, "gearmand: Unknown queue module: %s\n", queue_type); - return 1; - } - } - - while (gearman_conf_module_value(&module, &name, &value)) - { - if (strcmp(name, "protocol")) - continue; - - if (!strcmp(value, "http")) - { - ret= gearmand_protocol_http_init(_gearmand, &conf); - if (ret != GEARMAN_SUCCESS) - return 1; - } - else - { - fprintf(stderr, "gearmand: Unknown protocol module: %s\n", value); - return 1; - } - } - - ret= gearmand_run(_gearmand); - - if (queue_type != NULL) - { -#ifdef HAVE_LIBDRIZZLE - if (!strcmp(queue_type, "libdrizzle")) - gearmand_queue_libdrizzle_deinit(_gearmand); -#endif -#ifdef HAVE_LIBMEMCACHED - if (!strcmp(queue_type, "libmemcached")) - gearmand_queue_libmemcached_deinit(_gearmand); -#endif -#ifdef HAVE_LIBSQLITE3 - if (!strcmp(queue_type, "libsqlite3")) - gearmand_queue_libsqlite3_deinit(_gearmand); -#endif -#ifdef HAVE_LIBPQ - if (!strcmp(queue_type, "libpq")) - gearmand_queue_libpq_deinit(_gearmand); -#endif -#ifdef HAVE_LIBTOKYOCABINET - if (!strcmp(queue_type, "libtokyocabinet")) - gearmand_queue_libtokyocabinet_deinit(_gearmand); -#endif - } - - while (gearman_conf_module_value(&module, &name, &value)) - { - if (strcmp(name, "protocol")) - continue; - - if (!strcmp(value, "http")) - gearmand_protocol_http_deinit(_gearmand); - } - - gearmand_free(_gearmand); - - if (pid_file != NULL) - _pid_delete(pid_file); - - if (log_info.fd != -1) - (void) close(log_info.fd); - - gearman_conf_free(&conf); - - return (ret == GEARMAN_SUCCESS || ret == GEARMAN_SHUTDOWN) ? 0 : 1; -} - -static bool _set_fdlimit(rlim_t fds) -{ - struct rlimit rl; - - if (getrlimit(RLIMIT_NOFILE, &rl) == -1) - { - fprintf(stderr, "gearmand: Could not get file descriptor limit:%d\n", - errno); - return true; - } - - rl.rlim_cur= fds; - if (rl.rlim_max < rl.rlim_cur) - rl.rlim_max= rl.rlim_cur; - - if (setrlimit(RLIMIT_NOFILE, &rl) == -1) - { - fprintf(stderr, "gearmand: Failed to set limit for the number of file " - "descriptors (%d). Try running as root or giving a " - "smaller value to -f.\n", - errno); - return true; - } - - return false; -} - -static bool _pid_write(const char *pid_file) -{ - FILE *f; - - f= fopen(pid_file, "w"); - if (f == NULL) - { - fprintf(stderr, "gearmand: Could not open pid file for writing: %s (%d)\n", - pid_file, errno); - return true; - } - - fprintf(f, "%" PRId64 "\n", (int64_t)getpid()); - - if (fclose(f) == -1) - { - fprintf(stderr, "gearmand: Could not close the pid file: %s (%d)\n", - pid_file, errno); - return true; - } - - return false; -} - -static void _pid_delete(const char *pid_file) -{ - if (unlink(pid_file) == -1) - { - fprintf(stderr, "gearmand: Could not remove the pid file: %s (%d)\n", - pid_file, errno); - } -} - -static bool _switch_user(const char *user) -{ - struct passwd *pw; - - if (getuid() == 0 || geteuid() == 0) - { - if (user == NULL || user[0] == 0) - { - fprintf(stderr, - "gearmand: Must specify '-u root' if you want to run as root\n"); - return true; - } - - pw= getpwnam(user); - if (pw == NULL) - { - fprintf(stderr, "gearmand: Could not find user '%s'\n", user); - return 1; - } - - if (setgid(pw->pw_gid) == -1 || setuid(pw->pw_uid) == -1) - { - fprintf(stderr, "gearmand: Could not switch to user '%s'\n", user); - return 1; - } - } - else if (user != NULL) - { - fprintf(stderr, "gearmand: Must be root to switch users\n"); - return true; - } - - return false; -} - -static bool _set_signals(void) -{ - struct sigaction sa; - - memset(&sa, 0, sizeof(struct sigaction)); - - sa.sa_handler= SIG_IGN; - if (sigemptyset(&sa.sa_mask) == -1 || - sigaction(SIGPIPE, &sa, 0) == -1) - { - fprintf(stderr, "gearmand: Could not set SIGPIPE handler (%d)\n", errno); - return true; - } - - sa.sa_handler= _shutdown_handler; - if (sigaction(SIGTERM, &sa, 0) == -1) - { - fprintf(stderr, "gearmand: Could not set SIGTERM handler (%d)\n", errno); - return true; - } - - if (sigaction(SIGINT, &sa, 0) == -1) - { - fprintf(stderr, "gearmand: Could not set SIGINT handler (%d)\n", errno); - return true; - } - - if (sigaction(SIGUSR1, &sa, 0) == -1) - { - fprintf(stderr, "gearmand: Could not set SIGUSR1 handler (%d)\n", errno); - return true; - } - - return false; -} - -static void _shutdown_handler(int signal_arg) -{ - if (signal_arg == SIGUSR1) - gearmand_wakeup(_gearmand, GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL); - else - gearmand_wakeup(_gearmand, GEARMAND_WAKEUP_SHUTDOWN); -} - -static void _log(const char *line, gearman_verbose_t verbose, void *context) -{ - gearmand_log_info_st *log_info= (gearmand_log_info_st *)context; - int fd; - time_t t; - char buffer[GEARMAN_MAX_ERROR_SIZE]; - - if (log_info->file == NULL) - fd= 1; - else - { - t= time(NULL); - - if (log_info->fd != -1 && log_info->reopen < t) - { - (void) close(log_info->fd); - log_info->fd= -1; - } - - if (log_info->fd == -1) - { - log_info->fd= open(log_info->file, O_CREAT | O_WRONLY | O_APPEND, 0644); - if (log_info->fd == -1) - { - fprintf(stderr, "gearmand: Could not open log file for writing (%d)\n", - errno); - return; - } - - log_info->reopen= t + GEARMAND_LOG_REOPEN_TIME; - } - - fd= log_info->fd; - } - - snprintf(buffer, GEARMAN_MAX_ERROR_SIZE, "%5s %s\n", - gearman_verbose_name(verbose), line); - if (write(fd, buffer, strlen(buffer)) == -1) - fprintf(stderr, "gearmand: Could not write to log file: %d\n", errno); -} diff -Nru gearmand-0.14/gearmand/gearmand.cc gearmand-0.23/gearmand/gearmand.cc --- gearmand-0.14/gearmand/gearmand.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/gearmand/gearmand.cc 2011-06-27 20:34:15.000000000 +0200 @@ -0,0 +1,447 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include +#include +#include + +#define GEARMAND_LOG_REOPEN_TIME 60 + +#include "util/daemon.h" +#include "util/pidfile.h" + +#include +#include + +using namespace gearman_util; + +namespace error { + +inline void perror(const char *message) +{ + char *errmsg_ptr; + char errmsg[BUFSIZ]; + errmsg[0]= 0; + +#ifdef STRERROR_R_CHAR_P + errmsg_ptr= strerror_r(errno, errmsg, sizeof(errmsg)); +#else + strerror_r(errno, errmsg, sizeof(errmsg)); + errmsg_ptr= errmsg; +#endif + std::cerr << "gearman: " << message << " (" << errmsg_ptr << ")" << std::endl; +} + +inline void message(const char *arg) +{ + std::cerr << "gearmand: " << arg << std::endl; +} + +inline void message(const char *arg, const char *arg2) +{ + std::cerr << "gearmand: " << arg << " : " << arg2 << std::endl; +} + +inline void message(const std::string &arg, gearmand_error_t rc) +{ + std::cerr << "gearmand: " << arg << " : " << gearmand_strerror(rc) << std::endl; +} + +} // namespace error + +struct gearmand_log_info_st +{ + std::string filename; + int fd; + time_t reopen; + + gearmand_log_info_st(const std::string &filename_arg) : + filename(filename_arg), + fd(-1), + reopen(0) + { + } +}; + +static bool _set_fdlimit(rlim_t fds); +static bool _switch_user(const char *user); + +extern "C" { +static bool _set_signals(void); +} + +static void _shutdown_handler(int signal_arg); +static void _log(const char *line, gearmand_verbose_t verbose, void *context); + +int main(int argc, char *argv[]) +{ + int backlog; + rlim_t fds= 0; + uint32_t job_retries; + uint32_t worker_wakeup; + + std::string host; + std::string user; + std::string log_file; + std::string pid_file; + std::string port; + std::string protocol; + std::string queue_type; + std::string verbose_string; + + uint32_t threads; + bool opt_round_robin; + bool opt_daemon; + bool opt_check_args; + + boost::program_options::options_description general("General options"); + + general.add_options() + ("backlog,b", boost::program_options::value(&backlog)->default_value(32), + "Number of backlog connections for listen.") + + ("check-args", boost::program_options::bool_switch(&opt_check_args)->default_value(false), + "Check command line and configuration file argments and then exit.") + + ("daemon,d", boost::program_options::bool_switch(&opt_daemon)->default_value(false), + "Daemon, detach and run in the background.") + + ("file-descriptors,f", boost::program_options::value(&fds), + "Number of file descriptors to allow for the process (total connections will be slightly less). Default is max allowed for user.") + + ("help,h", "Print this help menu.") + + ("job-retries,j", boost::program_options::value(&job_retries)->default_value(0), + "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.") + + ("log-file,l", boost::program_options::value(&log_file), + "Log file to write errors and information to. Turning this option on also forces the first verbose level to be enabled.") + + ("listen,L", boost::program_options::value(&host), + "Address the server should listen on. Default is INADDR_ANY.") + + ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT_STRING), + "Port the server should listen on.") + + ("pid-file,P", boost::program_options::value(&pid_file), + "File to write process ID out to.") + + ("protocol,r", boost::program_options::value(&protocol), + "Load protocol module.") + + ("round-robin,R", boost::program_options::bool_switch(&opt_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.") + + ("queue-type,q", boost::program_options::value(&queue_type), + "Persistent queue type to use.") + + ("threads,t", boost::program_options::value(&threads)->default_value(4), + "Number of I/O threads to use. Default=4.") + + ("user,u", boost::program_options::value(&user), + "Switch to given user after startup.") + + ("verbose,v", boost::program_options::value(&verbose_string)->default_value("v"), + "Increase verbosity level by one.") + + ("version,V", "Display the version of gearmand and exit.") + ("worker-wakeup,w", boost::program_options::value(&worker_wakeup)->default_value(0), + "Number of workers to wakeup for each job received. The default is to wakeup all available workers.") + ; + + boost::program_options::options_description all("Allowed options"); + all.add(general); + + gearmand::protocol::HTTP http; + all.add(http.command_line_options()); + + gearmand::plugins::initialize(all); + + boost::program_options::variables_map vm; + try { + store(parse_command_line(argc, argv, all), vm); + notify(vm); + } + + catch(std::exception &e) + { + std::cout << e.what() << std::endl; + return EXIT_FAILURE; + } + + uint8_t verbose_count; + verbose_count= static_cast(verbose_string.length()); + + if (opt_check_args) + { + return EXIT_SUCCESS; + } + + if (vm.count("help")) + { + std::cout << all << std::endl; + return EXIT_FAILURE; + } + + if (vm.count("version")) + { + std::cout << std::endl << "gearmand " << gearmand_version() << " - " << gearmand_bugreport() << std::endl; + return EXIT_FAILURE; + } + + if (fds > 0 && _set_fdlimit(fds)) + { + return EXIT_FAILURE; + } + + if (not user.empty() and _switch_user(user.c_str())) + { + return EXIT_FAILURE; + } + + if (_set_signals()) + { + return EXIT_FAILURE; + } + + if (opt_daemon) + { + gearmand::daemonize(false, true); + } + + if (opt_daemon) + gearmand::daemon_is_ready(verbose_count == 0); + + gearmand_verbose_t verbose= verbose_count > static_cast(GEARMAND_VERBOSE_CRAZY) ? GEARMAND_VERBOSE_CRAZY : static_cast(verbose_count); + + Pidfile _pid_file(pid_file); + + if (not _pid_file.create()) + { + error::perror(_pid_file.error_message().c_str()); + return EXIT_FAILURE; + } + + gearmand_log_info_st log_info(log_file); + + gearmand_st *_gearmand; + _gearmand= gearmand_create(host.empty() ? NULL : host.c_str(), + port.c_str(), threads, backlog, + static_cast(job_retries), + static_cast(worker_wakeup), + _log, &log_info, verbose, + opt_round_robin); + if (not _gearmand) + { + error::message("Could not create gearmand library instance."); + return EXIT_FAILURE; + } + + if (not queue_type.empty()) + { + gearmand_error_t rc; + if ((rc= gearmand::queue::initialize(_gearmand, queue_type.c_str())) != GEARMAN_SUCCESS) + { + gearmand_free(_gearmand); + + return EXIT_FAILURE; + } + } + + if (not protocol.compare("http")) + { + if (http.start(_gearmand) != GEARMAN_SUCCESS) + { + error::message("Error while enabling protocol module", protocol.c_str()); + return EXIT_FAILURE; + } + } + else if (not protocol.empty()) + { + error::message("Unknown protocol module", protocol.c_str()); + return EXIT_FAILURE; + } + + gearmand_error_t ret; + ret= gearmand_run(_gearmand); + + gearmand_free(_gearmand); + + if (log_info.fd != -1) + (void) close(log_info.fd); + + return (ret == GEARMAN_SUCCESS || ret == GEARMAN_SHUTDOWN) ? 0 : 1; +} + +static bool _set_fdlimit(rlim_t fds) +{ + struct rlimit rl; + + if (getrlimit(RLIMIT_NOFILE, &rl) == -1) + { + error::perror("Could not get file descriptor limit"); + return true; + } + + rl.rlim_cur= fds; + if (rl.rlim_max < rl.rlim_cur) + rl.rlim_max= rl.rlim_cur; + + if (setrlimit(RLIMIT_NOFILE, &rl) == -1) + { + error::perror("Failed to set limit for the number of file " + "descriptors. Try running as root or giving a " + "smaller value to -f."); + return true; + } + + return false; +} + +static bool _switch_user(const char *user) +{ + + if (getuid() == 0 || geteuid() == 0) + { + struct passwd *pw= getpwnam(user); + + if (not pw) + { + error::message("Could not find user", user); + return EXIT_FAILURE; + } + + if (setgid(pw->pw_gid) == -1 || setuid(pw->pw_uid) == -1) + { + error::message("Could not switch to user", user); + return EXIT_FAILURE; + } + } + else + { + error::message("Must be root to switch users."); + return true; + } + + return false; +} + +extern "C" { +static bool _set_signals(void) +{ + struct sigaction sa; + + memset(&sa, 0, sizeof(struct sigaction)); + + sa.sa_handler= SIG_IGN; + if (sigemptyset(&sa.sa_mask) == -1 || + sigaction(SIGPIPE, &sa, 0) == -1) + { + error::perror("Could not set SIGPIPE handler."); + return true; + } + + sa.sa_handler= _shutdown_handler; + if (sigaction(SIGTERM, &sa, 0) == -1) + { + error::perror("Could not set SIGTERM handler."); + return true; + } + + if (sigaction(SIGINT, &sa, 0) == -1) + { + error::perror("Could not set SIGINT handler."); + return true; + } + + if (sigaction(SIGUSR1, &sa, 0) == -1) + { + error::perror("Could not set SIGUSR1 handler."); + return true; + } + + return false; +} +} + +static void _shutdown_handler(int signal_arg) +{ + if (signal_arg == SIGUSR1) + gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL); + else + gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); +} + +static void _log(const char *line, gearmand_verbose_t verbose, void *context) +{ + gearmand_log_info_st *log_info= static_cast(context); + int fd; + + if (log_info->filename.empty()) + { + fd= 1; + } + else + { + time_t t= time(NULL); + + if (log_info->fd != -1 && log_info->reopen < t) + { + (void) close(log_info->fd); + log_info->fd= -1; + } + + if (log_info->fd == -1) + { + log_info->fd= open(log_info->filename.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644); + if (log_info->fd == -1) + { + error::perror("Could not open log file for writing."); + return; + } + + log_info->reopen= t + GEARMAND_LOG_REOPEN_TIME; + } + + fd= log_info->fd; + } + + char buffer[GEARMAN_MAX_ERROR_SIZE]; + snprintf(buffer, GEARMAN_MAX_ERROR_SIZE, "%5s %s\n", + gearmand_verbose_name(verbose), line); + if (write(fd, buffer, strlen(buffer)) == -1) + { + error::perror("Could not write to log file."); + } +} diff -Nru gearmand-0.14/gearmand/include.am gearmand-0.23/gearmand/include.am --- gearmand-0.14/gearmand/include.am 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/gearmand/include.am 2011-04-28 21:39:46.000000000 +0200 @@ -13,13 +13,60 @@ sbin_PROGRAMS+= gearmand/gearmand gearmand_gearmand_LDADD= \ - libgearman-server/libgearman-server.la \ - ${BETTER_MALLOC_LIBS} + $(AM_LDADD) \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + ${BETTER_MALLOC_LIBS} \ + libgearman-server/libgearman-server.la -gearmand_gearmand_SOURCES= gearmand/gearmand.c +gearmand_gearmand_LDFLAGS= $(BOOST_PROGRAM_OPTIONS_LDFLAGS) + +gearmand_gearmand_CPPFLAGS= \ + $(AM_CPPFLAGS) \ + $(BOOST_CPPFLAGS) + +gearmand_gearmand_SOURCES= \ + gearmand/gearmand.cc \ + util/daemon.cc \ + util/pidfile.cc gearmand-valgrind: gearmand/gearmand $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes gearmand/gearmand gearmand-debug: gearmand/gearmand $(LIBTOOL) --mode=execute gdb gearmand/gearmand + +gearmand-test-args: gearmand/gearmand + @gearmand/gearmand --check-args + @gearmand/gearmand --backlog=10 --check-args + @gearmand/gearmand --b 10 --check-args + @gearmand/gearmand --d --check-args + @gearmand/gearmand --daemon --check-args + @gearmand/gearmand --file-descriptors=100 --check-args + @gearmand/gearmand --f 100 --check-args + @gearmand/gearmand -h --check-args + @gearmand/gearmand --help --check-args + @gearmand/gearmand -l "tmp/foo" --check-args + @gearmand/gearmand --log-file="tmp/foo" --check-args + @gearmand/gearmand --listen=10 --check-args + @gearmand/gearmand -L 10 --check-args + @gearmand/gearmand --port=10 --check-args + @gearmand/gearmand -p 10 --check-args + @gearmand/gearmand --pid-file="tmp/file.pid" --check-args + @gearmand/gearmand -P "tmp/file.pid" --check-args + @gearmand/gearmand --round-robin --check-args + @gearmand/gearmand -R --check-args + @gearmand/gearmand --pid-file="tmp/file.pid" --check-args + @gearmand/gearmand -P "tmp/file.pid" --check-args + @gearmand/gearmand --threads=10 --check-args + @gearmand/gearmand -t 10 --check-args + @gearmand/gearmand --user=nobody --check-args + @gearmand/gearmand -u nobody --check-args + @gearmand/gearmand --check-args -vvvv + @gearmand/gearmand -V --check-args + @gearmand/gearmand --version --check-args + @gearmand/gearmand -w 10 --check-args + @gearmand/gearmand --worker-wakeup=10 --check-args + @gearmand/gearmand --protocol=http --check-args + @gearmand/gearmand --queue-type=http --check-args + @gearmand/gearmand -j 10 --check-args + @gearmand/gearmand --job-retries=10 --check-args diff -Nru gearmand-0.14/HACKING gearmand-0.23/HACKING --- gearmand-0.14/HACKING 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/HACKING 2011-06-17 08:47:09.000000000 +0200 @@ -0,0 +1,48 @@ +Hi! + +If you are working on the server here are some handy environmental variables +you can set so that you can debug make test: + +GEARMAN_VALGRIND <- runs the server under valgrind. +GEARMAN_MANUAL_GDB <-- runs the server under a remote version of GDB. +GEARMAN_LOG <-- generates a log file for you with the output of the debug for the server + +GDB will pause the server while you do run the GDB command. + +Coding Style +------------ + +Variables during assignment should be like: +a= 12; + +When in doubt, use (). It means I clearly know that you meant for an +operation to follow a specific order. + +Cast return types void when there is a possibility of failure (don't +bother with printf, use common sense): + +(void)some_function(...); + +New functions should be named "object_verb_(item_to_act_on)". You +should email the list if you are extending the API. + +Use spaces after while, for, do, if, else. Don't around anything else. + +If/else bracket style is: +if () +{ +} +else +{ +} + +Make sure structs have a typedef with a _st suffix, enums have a _t +suffix, and functions have a _fn suffix. For example: + +typedef struct gearman_task { ... } gearman_task_st; +typedef enum gearman_return { ... } gearman_return_t; +typedef gearman_return_t (gearman_complete_fn)(gearman_task_st *task); + + +Cheers, + -Brian diff -Nru gearmand-0.14/libgearman/actions.cc gearmand-0.23/libgearman/actions.cc --- gearmand-0.14/libgearman/actions.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/actions.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,192 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +struct gearman_result_st; + +static gearman_return_t _client_pause_data(gearman_task_st *task) +{ + if (task->options.is_paused) + { + task->options.is_paused= false; + return GEARMAN_SUCCESS; + } + + if (gearman_task_data_size(task)) + { + if (not task->result_ptr) + { + task->result_ptr= new (std::nothrow) gearman_result_st(gearman_task_data_size(task)); + } + else + { + task->result_ptr->clear(); + } + assert_msg(task->result_ptr, "programmer error, result_ptr has not been allocated for task"); + + gearman_string_append(gearman_task_mutable_result(task)->string(), static_cast(gearman_task_data(task)), gearman_task_data_size(task)); + } + + if (task->recv->command == GEARMAN_COMMAND_WORK_DATA) + { } + else if (task->recv->command == GEARMAN_COMMAND_WORK_WARNING) + { } + else if (task->recv->command == GEARMAN_COMMAND_WORK_EXCEPTION) + { } + else // GEARMAN_COMMAND_WORK_COMPLETE + { + return GEARMAN_SUCCESS; + } + + task->options.is_paused= true; + + return GEARMAN_PAUSE; +} + +static gearman_return_t _client_pause_complete(gearman_task_st *task) +{ + return _client_pause_data(task); +} + + +static gearman_return_t _client_pause_status(gearman_task_st *task) +{ + assert_msg(task->recv->command == GEARMAN_COMMAND_WORK_STATUS or + task->recv->command == GEARMAN_COMMAND_STATUS_RES, "status has been called out of order for task, or was registered to run on non-status callback, see gearman_actions_t(3)"); + if (task->options.is_paused) + { + task->options.is_paused= false; + return GEARMAN_SUCCESS; + } + task->options.is_paused= true; + + return GEARMAN_PAUSE; +} + +static gearman_return_t _client_pause_fail(gearman_task_st *task) +{ + assert_msg(task->recv->command == GEARMAN_COMMAND_WORK_FAIL, + "fail callback has been called out of order for task, or was registered to run on non-fail callback, see gearman_actions_t(3)"); + if (task->options.is_paused) + { + task->options.is_paused= false; + return GEARMAN_SUCCESS; + } + task->options.is_paused= true; + + return GEARMAN_PAUSE; +} + +static gearman_return_t _client_do_data(gearman_task_st *task) +{ + if (gearman_task_data_size(task)) + { + if (not task->result_ptr) + { + task->result_ptr= new (std::nothrow) gearman_result_st(gearman_task_data_size(task)); + if (not task->result_ptr) + { + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + } + + gearman_string_append(gearman_task_mutable_result(task)->string(), static_cast(gearman_task_data(task)), gearman_task_data_size(task)); + } + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _client_do_complete(gearman_task_st *task) +{ + if (gearman_task_data_size(task)) + { + if (not task->result_ptr) + { + task->result_ptr= new (std::nothrow) gearman_result_st(gearman_task_data_size(task)); + if (not task->result_ptr) + { + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + } + + gearman_string_append(gearman_task_mutable_result(task)->string(), static_cast(gearman_task_data(task)), gearman_task_data_size(task)); + } + + task->result_rc= GEARMAN_SUCCESS; + + return GEARMAN_SUCCESS; +} + +gearman_actions_t &gearman_actions_default(void) +{ + static gearman_actions_t default_actions= { 0, 0, 0, 0, 0, 0, 0, 0 }; + + return default_actions; +} + + +gearman_actions_t &gearman_actions_do_default(void) +{ + static gearman_actions_t default_actions= { 0, 0, _client_do_data, 0, 0, _client_do_complete, 0, 0 }; + + return default_actions; +} + +gearman_actions_t &gearman_actions_execute_defaults(void) +{ + static gearman_actions_t default_actions= { 0, 0, _client_do_data, 0, 0, _client_do_complete, 0, 0 }; + + return default_actions; +} + +gearman_actions_t &gearman_actions_pause(void) +{ + static gearman_actions_t default_actions= { 0, 0, + _client_pause_data, // gearman_data_fn + _client_pause_data, // gearman_warning_fn + _client_pause_status, // gearman_universal_status_fn + _client_pause_complete, // gearman_complete_fn + _client_pause_data, // gearman_exception_fn + _client_pause_fail }; // gearman_fail_fn + + return default_actions; +} diff -Nru gearmand-0.14/libgearman/actions.h gearmand-0.23/libgearman/actions.h --- gearmand-0.14/libgearman/actions.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/actions.h 2011-06-20 04:36:50.000000000 +0200 @@ -0,0 +1,68 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +struct gearman_actions_t +{ + gearman_workload_fn *workload_fn; + gearman_created_fn *created_fn; + gearman_data_fn *data_fn; + gearman_warning_fn *warning_fn; + gearman_universal_status_fn *status_fn; + gearman_complete_fn *complete_fn; + gearman_exception_fn *exception_fn; + gearman_fail_fn *fail_fn; +}; + +#ifdef __cplusplus // Local only + +GEARMAN_LOCAL +gearman_actions_t &gearman_actions_default(); + +GEARMAN_LOCAL +gearman_actions_t &gearman_actions_do_default(); + +GEARMAN_LOCAL +gearman_actions_t &gearman_actions_execute_defaults(); + +GEARMAN_API +gearman_actions_t &gearman_actions_pause(); + +#endif diff -Nru gearmand-0.14/libgearman/add.cc gearmand-0.23/libgearman/add.cc --- gearmand-0.14/libgearman/add.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/add.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,333 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#ifdef HAVE_UUID_UUID_H +#include +#endif + +gearman_task_st *add_task(gearman_client_st *client, + void *context, + gearman_command_t command, + const gearman_string_t &function, + const gearman_unique_t &unique, + const gearman_string_t &workload, + time_t when, + struct gearman_actions_t &actions) +{ + return add_task(client, NULL, context, command, function, unique, workload, when, actions); +} + +gearman_task_st *add_task(gearman_client_st *client, + gearman_task_st *task, + void *context, + gearman_command_t command, + const char *function_name, + const char *unique, + const void *workload_str, size_t workload_size, + time_t when, + gearman_return_t *ret_ptr, + struct gearman_actions_t &actions) +{ + gearman_return_t unused; + if (not ret_ptr) + ret_ptr= &unused; + + if (not client) + { + *ret_ptr= GEARMAN_ERRNO; + errno= EINVAL; + return NULL; + } + + gearman_string_t function= { gearman_string_param_cstr(function_name) }; + gearman_unique_t local_unique= gearman_unique_make(unique, unique ? strlen(unique) : 0); + gearman_string_t workload= { static_cast(workload_str), workload_size }; + + task= add_task(client, task, context, command, function, local_unique, workload, when, actions); + if (not task) + { + *ret_ptr= gearman_universal_error_code(client->universal); + return NULL; + } + + *ret_ptr= GEARMAN_SUCCESS; + + return task; +} + +gearman_task_st *add_task(gearman_client_st *client, + gearman_task_st *task, + void *context, + gearman_command_t command, + const gearman_string_t &function, + const gearman_unique_t &unique, + const gearman_string_t &workload, + time_t when, + struct gearman_actions_t &actions) +{ + uuid_t uuid; + char uuid_string[37]; + const void *args[4]; + size_t args_size[4]; + + if ((gearman_size(workload) && gearman_c_str(workload) == NULL) or (gearman_size(workload) == 0 && gearman_c_str(workload))) + { + gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "invalid workload"); + return NULL; + } + + task= gearman_task_internal_create(client, task); + if (not task) + { + gearman_error(client->universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, ""); + return NULL; + } + + task->context= context; + task->func= actions; + + /** + @todo fix it so that NULL is done by default by the API not by happenstance. + */ + char function_buffer[1024]; + if (client->universal._namespace) + { + char *ptr= function_buffer; + memcpy(ptr, gearman_string_value(client->universal._namespace), gearman_string_length(client->universal._namespace)); + ptr+= gearman_string_length(client->universal._namespace); + + memcpy(ptr, gearman_c_str(function), gearman_size(function) +1); + ptr+= gearman_size(function); + + args[0]= function_buffer; + args_size[0]= ptr -function_buffer +1; + } + else + { + args[0]= gearman_c_str(function); + args_size[0]= gearman_size(function) + 1; + } + + if (gearman_size(unique)) + { + args[1]= gearman_c_str(unique); + args_size[1]= gearman_size(unique) + 1; + } + else + { + uuid_generate(uuid); + uuid_unparse(uuid, uuid_string); + uuid_string[36]= 0; + args[1]= uuid_string; + args_size[1]= 36 + 1; // +1 is for the needed null + } + + gearman_return_t rc; + if (command == GEARMAN_COMMAND_SUBMIT_JOB_EPOCH) + { + char time_string[30]; + int length= snprintf(time_string, sizeof(time_string), "%lld", static_cast(when)); + args[2]= time_string; + args_size[2]= length +1; + args[3]= gearman_c_str(workload); + args_size[3]= gearman_size(workload); + + rc= gearman_packet_create_args(client->universal, task->send, + GEARMAN_MAGIC_REQUEST, command, + args, args_size, + 4); + } + else + { + args[2]= gearman_c_str(workload); + args_size[2]= gearman_size(workload); + + rc= gearman_packet_create_args(client->universal, task->send, + GEARMAN_MAGIC_REQUEST, command, + args, args_size, + 3); + } + + if (gearman_success(rc)) + { + client->new_tasks++; + client->running_tasks++; + task->options.send_in_use= true; + + return task; + } + + gearman_task_free(task); + gearman_gerror(client->universal, rc); + + return NULL; +} + +gearman_task_st *add_reducer_task(gearman_client_st *client, + gearman_command_t command, + const gearman_job_priority_t, + const gearman_string_t &function, + const gearman_string_t &reducer, + const gearman_unique_t &unique, + const gearman_string_t &workload, + struct gearman_actions_t &actions, + const time_t, + void *context) +{ + uuid_t uuid; + char uuid_string[37]; + const void *args[5]; + size_t args_size[5]; + + if ((gearman_size(workload) and not gearman_c_str(workload)) or (gearman_size(workload) == 0 && gearman_c_str(workload))) + { + gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "invalid workload"); + return NULL; + } + + gearman_task_st *task= gearman_task_internal_create(client, NULL); + if (not task) + { + gearman_error(client->universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, ""); + return NULL; + } + + task->context= context; + task->func= actions; + + /** + @todo fix it so that NULL is done by default by the API not by happenstance. + */ + char function_buffer[1024]; + if (client->universal._namespace) + { + char *ptr= function_buffer; + memcpy(ptr, gearman_string_value(client->universal._namespace), gearman_string_length(client->universal._namespace)); + ptr+= gearman_string_length(client->universal._namespace); + + memcpy(ptr, gearman_c_str(function), gearman_size(function) +1); + ptr+= gearman_size(function); + + args[0]= function_buffer; + args_size[0]= ptr- function_buffer +1; + } + else + { + args[0]= gearman_c_str(function); + args_size[0]= gearman_size(function) + 1; + } + + if (gearman_size(unique)) + { + args[1]= gearman_c_str(unique); + args_size[1]= gearman_size(unique) + 1; + } + else + { + uuid_generate(uuid); + uuid_unparse(uuid, uuid_string); + uuid_string[36]= 0; + args[1]= uuid_string; + args_size[1]= 36 +1; // +1 is for the needed null + } + + assert_msg(command == GEARMAN_COMMAND_SUBMIT_REDUCE_JOB or command == GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND, + "Command was not appropriate for request"); + + char reducer_buffer[1024]; + if (client->universal._namespace) + { + char *ptr= reducer_buffer; + memcpy(ptr, gearman_string_value(client->universal._namespace), gearman_string_length(client->universal._namespace)); + ptr+= gearman_string_length(client->universal._namespace); + + memcpy(ptr, gearman_c_str(reducer), gearman_size(reducer) +1); + ptr+= gearman_size(reducer); + + args[2]= reducer_buffer; + args_size[2]= ptr- reducer_buffer +1; + } + else + { + args[2]= gearman_c_str(reducer); + args_size[2]= gearman_size(reducer) +1; + } + + char aggregate[1]; + aggregate[0]= 0; + args[3]= aggregate; + args_size[3]= 1; + + assert_msg(gearman_c_str(workload), "Invalid workload (NULL)"); + assert_msg(gearman_size(workload), "Invalid workload of zero"); + args[4]= gearman_c_str(workload); + args_size[4]= gearman_size(workload); + + gearman_return_t rc; + if (gearman_success(rc= gearman_packet_create_args(client->universal, task->send, + GEARMAN_MAGIC_REQUEST, command, + args, args_size, + 5))) + { + client->new_tasks++; + client->running_tasks++; + task->options.send_in_use= true; + } + else + { + gearman_gerror(client->universal, rc); + gearman_task_free(task); + task= NULL; + } + task->type= GEARMAN_TASK_KIND_EXECUTE; + + return task; +} diff -Nru gearmand-0.14/libgearman/add.hpp gearmand-0.23/libgearman/add.hpp --- gearmand-0.14/libgearman/add.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/add.hpp 2011-06-19 07:39:05.000000000 +0200 @@ -0,0 +1,84 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief Client Declarations + */ + +#pragma once + +gearman_task_st *add_task(gearman_client_st *client, + void *context, + gearman_command_t command, + const gearman_string_t &function, + const gearman_unique_t &unique, + const gearman_string_t &work, + time_t when, + struct gearman_actions_t &actions); + +gearman_task_st *add_task(gearman_client_st *client, + gearman_task_st *task, + void *context, + gearman_command_t command, + const char *function_name, + const char *unique, + const void *workload_str, size_t workload_size, + time_t when, + gearman_return_t *ret_ptr, + struct gearman_actions_t &actions); + +gearman_task_st *add_task(gearman_client_st *client, + gearman_task_st *task, + void *context, + gearman_command_t command, + const gearman_string_t &function, + const gearman_unique_t &unique, + const gearman_string_t &workload, + time_t when, + struct gearman_actions_t &actions); + +gearman_task_st *add_reducer_task(gearman_client_st *client, + gearman_command_t command, + const gearman_job_priority_t priority, + const gearman_string_t &function, + const gearman_string_t &reducer, + const gearman_unique_t &unique, + const gearman_string_t &workload, + struct gearman_actions_t &actions, + const time_t epoch, + void *context); diff -Nru gearmand-0.14/libgearman/aggregator.cc gearmand-0.23/libgearman/aggregator.cc --- gearmand-0.14/libgearman/aggregator.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/aggregator.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,55 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +void *gearman_aggegator_context(gearman_aggregator_st *self) +{ + if (not self) + return NULL; + + return self->context; +} diff -Nru gearmand-0.14/libgearman/aggregator.h gearmand-0.23/libgearman/aggregator.h --- gearmand-0.14/libgearman/aggregator.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/aggregator.h 2011-06-14 23:38:57.000000000 +0200 @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + + GEARMAN_API + void *gearman_aggegator_context(gearman_aggregator_st *self); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/aggregator.hpp gearmand-0.23/libgearman/aggregator.hpp --- gearmand-0.14/libgearman/aggregator.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/aggregator.hpp 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,46 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +struct gearman_aggregator_st { + void *context; + + gearman_aggregator_st(void *context_arg) : + context(context_arg) + { } +}; diff -Nru gearmand-0.14/libgearman/allocator.cc gearmand-0.23/libgearman/allocator.cc --- gearmand-0.14/libgearman/allocator.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/allocator.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,174 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearman library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +#include +#include + +void *gearman_real_malloc(gearman_allocator_t& allocator, size_t size, const char *func, const char *file, int line) +{ + void *ptr; + if (allocator.malloc) + { + ptr= allocator.malloc(size, allocator.context); + } + else + { + ptr= malloc(size); + } + +#if 0 + fprintf(stderr, "gearman_real_malloc(%s, %lu) : %p -> %s:%d\n", func, static_cast(size), ptr, file, line); +#else + (void)func; (void)file; (void)line; +#endif + + + return ptr; +} + +void *gearman_real_calloc(gearman_allocator_t& allocator, size_t nelem, size_t size, const char *func, const char *file, int line) +{ + void *ptr; + if (allocator.calloc) + { + ptr= allocator.calloc(nelem, size, allocator.context); + } + else if (allocator.malloc) + { + ptr= gearman_real_malloc(allocator, nelem * size, func, file, line); + if (not ptr) + memset(ptr, 0, nelem * size); + } + else + { + ptr= calloc(nelem, size); + } + +#if 0 + fprintf(stderr, "gearman_real_calloc(%s, %lu) : %p -> %s:%d\n", func, static_cast(size), ptr, file, line); +#else + (void)func; (void)file; (void)line; +#endif + + + return ptr; +} + +void *gearman_real_realloc(gearman_allocator_t& allocator, void *ptr, size_t size, const char *func, const char *file, int line) +{ + void *new_ptr; + + if (allocator.realloc) + { + new_ptr= allocator.realloc(ptr, size, allocator.context); + } + else if (allocator.malloc) + { + new_ptr= NULL; + } + else + { + new_ptr= realloc(ptr, size); + } + +#if 0 + fprintf(stderr, "gearman_real_realloc(%s, %lu) : %p -> %s:%d\n", func, static_cast(size), ptr, file, line); +#else + (void)func; (void)file; (void)line; +#endif + + return new_ptr; +} + +void gearman_real_free(gearman_allocator_t& allocator, void *ptr, const char *func, const char *file, int line) +{ +#if 0 + fprintf(stderr, "gearman_real_free(%s) : %p -> %s:%d\n", func, ptr, file, line); +#else + (void)func; (void)file; (void)line; +#endif + + if (not ptr) + return; + + if (allocator.free) + { + allocator.free(ptr, allocator.context); + } + else + { + free(ptr); + } +} + +gearman_allocator_t gearman_default_allocator() +{ + static gearman_allocator_t _defaults= { 0, 0, 0, 0, 0 }; + return _defaults; +} + +gearman_return_t gearman_set_memory_allocator(gearman_allocator_t& allocator, + gearman_malloc_fn *malloc_fn, + gearman_free_fn *free_fn, + gearman_realloc_fn *realloc_fn, + gearman_calloc_fn *calloc_fn, + void *context) +{ + /* All should be set, or none should be set */ + if (malloc_fn == NULL and free_fn == NULL and realloc_fn == NULL and calloc_fn == NULL) + { + allocator= gearman_default_allocator(); + } + else if (malloc_fn == NULL or free_fn == NULL or realloc_fn == NULL or calloc_fn == NULL) + { + return GEARMAN_FATAL; + } + else + { + allocator.malloc= malloc_fn; + allocator.free= free_fn; + allocator.realloc= realloc_fn; + allocator.calloc= calloc_fn; + allocator.context= context; + } + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman/allocator.h gearmand-0.23/libgearman/allocator.h --- gearmand-0.14/libgearman/allocator.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/allocator.h 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,45 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearman library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +struct gearman_allocator_t { + gearman_calloc_fn *calloc; + gearman_free_fn *free; + gearman_malloc_fn *malloc; + gearman_realloc_fn *realloc; + void *context; +}; diff -Nru gearmand-0.14/libgearman/allocator.hpp gearmand-0.23/libgearman/allocator.hpp --- gearmand-0.14/libgearman/allocator.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/allocator.hpp 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,72 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearman library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +GEARMAN_LOCAL +void *gearman_real_malloc(gearman_allocator_t& allocator, size_t size, const char *func, const char *file, int line); + +#define gearman_malloc(__gearman_universal_st, __size) gearman_real_malloc(((__gearman_universal_st).allocator), (__size), __func__, __FILE__, __LINE__) + +GEARMAN_LOCAL +void *gearman_real_calloc(gearman_allocator_t& allocator, size_t nelem, size_t size, const char *func, const char *file, int line); + +#define gearman_calloc(__gearman_universal_st, __nelem, __size) gearman_real_calloc(((__gearman_universal_st).allocator), (__nelem), (__size), __func__, __FILE__, __LINE__) + +GEARMAN_LOCAL +void *gearman_real_realloc(gearman_allocator_t&, void *ptr, size_t size, const char *func, const char *file, int line); + +#define gearman_realloc(__gearman_universal_st, __ptr, __size) gearman_real_realloc(((__gearman_universal_st).allocator), (__ptr), (__size), __func__, __FILE__, __LINE__) + +GEARMAN_LOCAL +void gearman_real_free(gearman_allocator_t& allocator, void *ptr, const char *func, const char *file, int line); + +#define gearman_free(__gearman_universal_st, __ptr) gearman_real_free(((__gearman_universal_st).allocator), (__ptr), __func__, __FILE__, __LINE__) + +#define gearman_has_allocator(__gearman_universal_st) bool(__gearman_universal_st.allocator.malloc) + +GEARMAN_LOCAL +gearman_return_t gearman_set_memory_allocator(gearman_allocator_t& allocator, + gearman_malloc_fn *malloc_fn, + gearman_free_fn *free_fn, + gearman_realloc_fn *realloc_fn, + gearman_calloc_fn *calloc_fn, + void *context); + + +GEARMAN_LOCAL +gearman_allocator_t gearman_default_allocator(); + diff -Nru gearmand-0.14/libgearman/argument.cc gearmand-0.23/libgearman/argument.cc --- gearmand-0.14/libgearman/argument.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/argument.cc 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,47 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +gearman_argument_t gearman_argument_make(const char *name, const size_t name_length, const char *value, const size_t value_size) +{ + (void)name; + (void)name_length; + gearman_argument_t arg= { {0, 0}, { value, value_size }}; + + return arg; +} diff -Nru gearmand-0.14/libgearman/argument.h gearmand-0.23/libgearman/argument.h --- gearmand-0.14/libgearman/argument.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/argument.h 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,58 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include +#include + +struct gearman_argument_t { + gearman_string_t name; + gearman_string_t value; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_API +gearman_argument_t gearman_argument_make(const char *name, const size_t name_length, const char *value, const size_t value_size); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/assert.hpp gearmand-0.23/libgearman/assert.hpp --- gearmand-0.14/libgearman/assert.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/assert.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,58 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include + +#ifdef NDEBUG +#define assert(__expr, __mesg) ((void)0) +#else + +#define assert_msg(__expr, __mesg) \ +do \ +{ \ + if (not (__expr)) \ + { \ + fprintf(stderr, "\nAssertion \"%s\" failed for function \"%s\" likely for %s, at %s:%d\n", #__expr, __func__, (#__mesg), __FILE__, __LINE__);\ + abort(); \ + } \ +} while (0) + +#endif diff -Nru gearmand-0.14/libgearman/byteorder.c gearmand-0.23/libgearman/byteorder.c --- gearmand-0.14/libgearman/byteorder.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/byteorder.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,46 +0,0 @@ -/* - Taken from libmemcached. - */ - -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - * - * Summary: - * - */ - -#include "common.h" - -/* Byte swap a 64-bit number. */ -static inline uint64_t swap64(uint64_t in) -{ -#ifndef WORDS_BIGENDIAN - /* Little endian, flip the bytes around until someone makes a faster/better - * way to do this. */ - uint64_t rv= 0; - uint8_t x= 0; - for(x= 0; x < 8; x++) - { - rv= (rv << 8) | (in & 0xff); - in >>= 8; - } - return rv; -#else - /* big-endian machines don't need byte swapping */ - return in; -#endif -} - -uint64_t ntohll(uint64_t value) -{ - return swap64(value); -} - -uint64_t htonll(uint64_t value) -{ - return swap64(value); -} diff -Nru gearmand-0.14/libgearman/byteorder.cc gearmand-0.23/libgearman/byteorder.cc --- gearmand-0.14/libgearman/byteorder.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/byteorder.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,75 @@ +/* + Taken from libmemcached. + */ + +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifndef swap64 +/* Byte swap a 64-bit number. */ +static inline uint64_t swap64(uint64_t in) +{ + #ifndef WORDS_BIGENDIAN + /* Little endian, flip the bytes around until someone makes a faster/better + * way to do this. */ + uint64_t rv= 0; + uint8_t x= 0; + for(x= 0; x < 8; x++) + { + rv= (rv << 8) | (in & 0xff); + in >>= 8; + } + return rv; + #else + /* big-endian machines don't need byte swapping */ + return in; + #endif +} +#endif + +uint64_t ntohll(uint64_t value) +{ + return swap64(value); +} + +uint64_t htonll(uint64_t value) +{ + return swap64(value); +} diff -Nru gearmand-0.14/libgearman/byteorder.h gearmand-0.23/libgearman/byteorder.h --- gearmand-0.14/libgearman/byteorder.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/byteorder.h 2011-06-03 04:13:30.000000000 +0200 @@ -13,8 +13,7 @@ * */ -#ifndef GEARMAN_BYTEORDER_H -#define GEARMAN_BYTEORDER_H +#pragma once #ifndef HAVE_HTONLL @@ -37,5 +36,3 @@ #undef htons #undef htonl #endif - -#endif /* GEARMAN_BYTEORDER_H */ diff -Nru gearmand-0.14/libgearman/client.c gearmand-0.23/libgearman/client.c --- gearmand-0.14/libgearman/client.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/client.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1434 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Client Definitions - */ - -#include "common.h" - -/** - * @addtogroup gearman_client_static Static Client Declarations - * @ingroup gearman_client - * @{ - */ - -/** - * Allocate a client structure. - */ -static gearman_client_st *_client_allocate(gearman_client_st *client, bool is_clone); - -/** - * Callback function used when parsing server lists. - */ -static gearman_return_t _client_add_server(const char *host, in_port_t port, - void *context); - -/** - * Add a task. - */ -static gearman_task_st *_client_add_task(gearman_client_st *client, - gearman_task_st *task, - void *context, - gearman_command_t command, - const char *function_name, - size_t function_name_length, - const char *unique, - size_t unique_name_length, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr); - -/** - * Task state machine. - */ -static gearman_return_t _client_run_task(gearman_client_st *client, - gearman_task_st *task); - -/** - * Real do function. - */ -static void *_client_do(gearman_client_st *client, gearman_command_t command, - const char *function_name, size_t functiona_name_length, - const char *unique, size_t unique_length, - const void *workload, size_t workload_size, - size_t *result_size, gearman_return_t *ret_ptr); - -/** - * Real background do function. - */ -static gearman_return_t _client_do_background(gearman_client_st *client, - gearman_command_t command, - const char *function_name, - size_t functiona_name_length, - const char *unique, - size_t unique_length, - const void *workload, - size_t workload_size, - char *job_handle); - -/** - * Data and complete function for gearman_client_do* functions. - */ -static gearman_return_t _client_do_data(gearman_task_st *task); - -/** - * Status function for gearman_client_do* functions. - */ -static gearman_return_t _client_do_status(gearman_task_st *task); - -/** - * Fail function for gearman_client_do* functions. - */ -static gearman_return_t _client_do_fail(gearman_task_st *task); - -/** @} */ - -/* - * Public Definitions - */ - -gearman_client_st *gearman_client_create(gearman_client_st *client) -{ - return _client_allocate(client, false); -} - -gearman_client_st *gearman_client_clone(gearman_client_st *client, - const gearman_client_st *from) -{ - gearman_universal_st *check; - - if (! from) - { - return _client_allocate(client, false); - } - - client= _client_allocate(client, true); - - if (client == NULL) - { - return client; - } - - client->options.non_blocking= from->options.non_blocking; - client->options.task_in_use= from->options.task_in_use; - client->options.unbuffered_result= from->options.unbuffered_result; - client->options.no_new= from->options.no_new; - client->options.free_tasks= from->options.free_tasks; - - check= gearman_universal_clone((&client->universal), &(from->universal)); - if (! check) - { - gearman_client_free(client); - return NULL; - } - - return client; -} - -void gearman_client_free(gearman_client_st *client) -{ - if (client->options.task_in_use) - gearman_task_free(&(client->do_task)); - - gearman_client_task_free_all(client); - - gearman_universal_free(&client->universal); - - if (client->options.allocated) - free(client); -} - -const char *gearman_client_error(const gearman_client_st *client) -{ - return gearman_universal_error(&client->universal); -} - -int gearman_client_errno(const gearman_client_st *client) -{ - return gearman_universal_errno(&client->universal); -} - -gearman_client_options_t gearman_client_options(const gearman_client_st *client) -{ - gearman_client_options_t options; - memset(&options, 0, sizeof(gearman_client_options_t)); - - if (client->options.allocated) - options|= GEARMAN_CLIENT_ALLOCATED; - if (client->options.non_blocking) - options|= GEARMAN_CLIENT_NON_BLOCKING; - if (client->options.task_in_use) - options|= GEARMAN_CLIENT_TASK_IN_USE; - if (client->options.unbuffered_result) - options|= GEARMAN_CLIENT_UNBUFFERED_RESULT; - if (client->options.no_new) - options|= GEARMAN_CLIENT_NO_NEW; - if (client->options.free_tasks) - options|= GEARMAN_CLIENT_FREE_TASKS; - - return options; -} - -void gearman_client_set_options(gearman_client_st *client, - gearman_client_options_t options) -{ - gearman_client_options_t usable_options[]= { - GEARMAN_CLIENT_NON_BLOCKING, - GEARMAN_CLIENT_UNBUFFERED_RESULT, - GEARMAN_CLIENT_FREE_TASKS, - GEARMAN_CLIENT_MAX - }; - - gearman_client_options_t *ptr; - - - for (ptr= usable_options; *ptr != GEARMAN_CLIENT_MAX ; ptr++) - { - if (options & *ptr) - { - gearman_client_add_options(client, *ptr); - } - else - { - gearman_client_remove_options(client, *ptr); - } - } -} - -void gearman_client_add_options(gearman_client_st *client, - gearman_client_options_t options) -{ - if (options & GEARMAN_CLIENT_NON_BLOCKING) - { - gearman_universal_add_options(&client->universal, GEARMAN_NON_BLOCKING); - client->options.non_blocking= true; - } - - if (options & GEARMAN_CLIENT_UNBUFFERED_RESULT) - { - client->options.unbuffered_result= true; - } - - if (options & GEARMAN_CLIENT_FREE_TASKS) - { - client->options.free_tasks= true; - } -} - -void gearman_client_remove_options(gearman_client_st *client, - gearman_client_options_t options) -{ - if (options & GEARMAN_CLIENT_NON_BLOCKING) - { - gearman_universal_remove_options(&client->universal, GEARMAN_NON_BLOCKING); - client->options.non_blocking= false; - } - - if (options & GEARMAN_CLIENT_UNBUFFERED_RESULT) - { - client->options.unbuffered_result= false; - } - - if (options & GEARMAN_CLIENT_FREE_TASKS) - { - client->options.free_tasks= false; - } -} - -int gearman_client_timeout(gearman_client_st *client) -{ - return gearman_universal_timeout(&client->universal); -} - -void gearman_client_set_timeout(gearman_client_st *client, int timeout) -{ - gearman_universal_set_timeout(&client->universal, timeout); -} - -void *gearman_client_context(const gearman_client_st *client) -{ - return (void *)(client->context); -} - -void gearman_client_set_context(gearman_client_st *client, void *context) -{ - client->context= context; -} - -void gearman_client_set_log_fn(gearman_client_st *client, - gearman_log_fn *function, void *context, - gearman_verbose_t verbose) -{ - gearman_set_log_fn(&client->universal, function, context, verbose); -} - -void gearman_client_set_workload_malloc_fn(gearman_client_st *client, - gearman_malloc_fn *function, - void *context) -{ - gearman_set_workload_malloc_fn(&client->universal, function, context); -} - -void gearman_client_set_workload_free_fn(gearman_client_st *client, - gearman_free_fn *function, - void *context) -{ - gearman_set_workload_free_fn(&client->universal, function, context); -} - -gearman_return_t gearman_client_add_server(gearman_client_st *client, - const char *host, in_port_t port) -{ - if (gearman_connection_create_args(&client->universal, NULL, host, port) == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_client_add_servers(gearman_client_st *client, - const char *servers) -{ - return gearman_parse_servers(servers, _client_add_server, client); -} - -void gearman_client_remove_servers(gearman_client_st *client) -{ - gearman_free_all_cons(&client->universal); -} - -gearman_return_t gearman_client_wait(gearman_client_st *client) -{ - return gearman_wait(&client->universal); -} - -void *gearman_client_do(gearman_client_st *client, const char *function_name, - const char *unique, const void *workload, - size_t workload_size, size_t *result_size, - gearman_return_t *ret_ptr) -{ - return _client_do(client, GEARMAN_COMMAND_SUBMIT_JOB, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, result_size, ret_ptr); -} - -void *gearman_client_do_high(gearman_client_st *client, - const char *function_name, const char *unique, - const void *workload, size_t workload_size, - size_t *result_size, gearman_return_t *ret_ptr) -{ - return _client_do(client, GEARMAN_COMMAND_SUBMIT_JOB_HIGH, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, result_size, ret_ptr); -} - -void *gearman_client_do_low(gearman_client_st *client, - const char *function_name, const char *unique, - const void *workload, size_t workload_size, - size_t *result_size, gearman_return_t *ret_ptr) -{ - return _client_do(client, GEARMAN_COMMAND_SUBMIT_JOB_LOW, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, result_size, ret_ptr); -} - -const char *gearman_client_do_job_handle(const gearman_client_st *client) -{ - return client->do_task.job_handle; -} - -void gearman_client_do_status(gearman_client_st *client, uint32_t *numerator, - uint32_t *denominator) -{ - if (numerator != NULL) - *numerator= client->do_task.numerator; - - if (denominator != NULL) - *denominator= client->do_task.denominator; -} - -gearman_return_t gearman_client_do_background(gearman_client_st *client, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - char *job_handle) -{ - return _client_do_background(client, GEARMAN_COMMAND_SUBMIT_JOB_BG, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, - job_handle); -} - -gearman_return_t gearman_client_do_high_background(gearman_client_st *client, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - char *job_handle) -{ - return _client_do_background(client, GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, - job_handle); -} - -gearman_return_t gearman_client_do_low_background(gearman_client_st *client, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - char *job_handle) -{ - return _client_do_background(client, GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, - job_handle); -} - -gearman_return_t gearman_client_job_status(gearman_client_st *client, - const char *job_handle, - bool *is_known, bool *is_running, - uint32_t *numerator, - uint32_t *denominator) -{ - gearman_return_t ret; - - if (! (client->options.task_in_use)) - { - (void)gearman_client_add_task_status(client, &(client->do_task), client, - job_handle, &ret); - if (ret != GEARMAN_SUCCESS) - return ret; - - client->options.task_in_use= true; - } - - gearman_client_clear_fn(client); - - ret= gearman_client_run_tasks(client); - if (ret != GEARMAN_IO_WAIT) - { - if (is_known != NULL) - *is_known= client->do_task.options.is_known; - if (is_running != NULL) - *is_running= client->do_task.options.is_running; - if (numerator != NULL) - *numerator= client->do_task.numerator; - if (denominator != NULL) - *denominator= client->do_task.denominator; - - gearman_task_free(&(client->do_task)); - client->options.task_in_use= false; - } - - return ret; -} - -gearman_return_t gearman_client_echo(gearman_client_st *client, - const void *workload, - size_t workload_size) -{ - return gearman_echo(&client->universal, workload, workload_size); -} - -void gearman_client_task_free_all(gearman_client_st *client) -{ - while (client->task_list != NULL) - gearman_task_free(client->task_list); -} - -void gearman_client_set_task_context_free_fn(gearman_client_st *client, - gearman_task_context_free_fn *function) -{ - client->task_context_free_fn= function; -} - -gearman_task_st *gearman_client_add_task(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return _client_add_task(client, task, context, GEARMAN_COMMAND_SUBMIT_JOB, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, - ret_ptr); -} - -gearman_task_st *gearman_client_add_task_high(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return _client_add_task(client, task, context, - GEARMAN_COMMAND_SUBMIT_JOB_HIGH, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, ret_ptr); -} - -gearman_task_st *gearman_client_add_task_low(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return _client_add_task(client, task, context, GEARMAN_COMMAND_SUBMIT_JOB_LOW, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, - ret_ptr); -} - -gearman_task_st *gearman_client_add_task_background(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return _client_add_task(client, task, context, GEARMAN_COMMAND_SUBMIT_JOB_BG, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, - ret_ptr); -} - -gearman_task_st * -gearman_client_add_task_high_background(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return _client_add_task(client, task, context, - GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, ret_ptr); -} - -gearman_task_st * -gearman_client_add_task_low_background(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *function_name, - const char *unique, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return _client_add_task(client, task, context, - GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, - function_name, strlen(function_name), - unique, unique ? strlen(unique) : 0, - workload, workload_size, ret_ptr); -} - -gearman_task_st *gearman_client_add_task_status(gearman_client_st *client, - gearman_task_st *task, - void *context, - const char *job_handle, - gearman_return_t *ret_ptr) -{ - const void *args[1]; - size_t args_size[1]; - - task= gearman_task_create(client, task); - if (task == NULL) - { - *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - task->context= context; - snprintf(task->job_handle, GEARMAN_JOB_HANDLE_SIZE, "%s", job_handle); - - args[0]= job_handle; - args_size[0]= strlen(job_handle); - *ret_ptr= gearman_packet_create_args(&client->universal, &(task->send), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_GET_STATUS, - args, args_size, 1); - if (*ret_ptr == GEARMAN_SUCCESS) - { - client->new_tasks++; - client->running_tasks++; - task->options.send_in_use= true; - } - - return task; -} - -void gearman_client_set_workload_fn(gearman_client_st *client, - gearman_workload_fn *function) -{ - client->workload_fn= function; -} - -void gearman_client_set_created_fn(gearman_client_st *client, - gearman_created_fn *function) -{ - client->created_fn= function; -} - -void gearman_client_set_data_fn(gearman_client_st *client, - gearman_data_fn *function) -{ - client->data_fn= function; -} - -void gearman_client_set_warning_fn(gearman_client_st *client, - gearman_warning_fn *function) -{ - client->warning_fn= function; -} - -void gearman_client_set_status_fn(gearman_client_st *client, - gearman_universal_status_fn *function) -{ - client->status_fn= function; -} - -void gearman_client_set_complete_fn(gearman_client_st *client, - gearman_complete_fn *function) -{ - client->complete_fn= function; -} - -void gearman_client_set_exception_fn(gearman_client_st *client, - gearman_exception_fn *function) -{ - client->exception_fn= function; -} - -void gearman_client_set_fail_fn(gearman_client_st *client, - gearman_fail_fn *function) -{ - client->fail_fn= function; -} - -void gearman_client_clear_fn(gearman_client_st *client) -{ - client->workload_fn= NULL; - client->created_fn= NULL; - client->data_fn= NULL; - client->warning_fn= NULL; - client->status_fn= NULL; - client->complete_fn= NULL; - client->exception_fn= NULL; - client->fail_fn= NULL; -} - -static inline void _push_non_blocking(gearman_client_st *client) -{ - client->universal.options.stored_non_blocking= client->universal.options.non_blocking; - client->universal.options.non_blocking= true; -} - -static inline void _pop_non_blocking(gearman_client_st *client) -{ - client->universal.options.non_blocking= client->options.non_blocking; - assert(client->universal.options.stored_non_blocking == client->options.non_blocking); -} - -static inline gearman_return_t _client_run_tasks(gearman_client_st *client) -{ - gearman_return_t ret; - - switch(client->state) - { - case GEARMAN_CLIENT_STATE_IDLE: - while (1) - { - /* Start any new tasks. */ - if (client->new_tasks > 0 && ! (client->options.no_new)) - { - for (client->task= client->task_list; client->task != NULL; - client->task= client->task->next) - { - if (client->task->state != GEARMAN_TASK_STATE_NEW) - continue; - - case GEARMAN_CLIENT_STATE_NEW: - ret= _client_run_task(client, client->task); - if (ret != GEARMAN_SUCCESS && ret != GEARMAN_IO_WAIT) - { - client->state= GEARMAN_CLIENT_STATE_NEW; - - return ret; - } - } - - if (client->new_tasks == 0) - { - ret= gearman_flush_all(&client->universal); - if (ret != GEARMAN_SUCCESS) - { - return ret; - } - } - } - - /* See if there are any connections ready for I/O. */ - while ((client->con= gearman_ready(&client->universal)) != NULL) - { - if (client->con->revents & (POLLOUT | POLLERR | POLLHUP | POLLNVAL)) - { - /* Socket is ready for writing, continue submitting jobs. */ - for (client->task= client->task_list; client->task != NULL; - client->task= client->task->next) - { - if (client->task->con != client->con || - (client->task->state != GEARMAN_TASK_STATE_SUBMIT && - client->task->state != GEARMAN_TASK_STATE_WORKLOAD)) - { - continue; - } - - case GEARMAN_CLIENT_STATE_SUBMIT: - ret= _client_run_task(client, client->task); - if (ret != GEARMAN_SUCCESS && ret != GEARMAN_IO_WAIT) - { - client->state= GEARMAN_CLIENT_STATE_SUBMIT; - return ret; - } - } - } - - if (! (client->con->revents & POLLIN)) - continue; - - /* Socket is ready for reading. */ - while (1) - { - /* Read packet on connection and find which task it belongs to. */ - if (client->options.unbuffered_result) - { - /* If client is handling the data read, make sure it's complete. */ - if (client->con->recv_state == GEARMAN_CON_RECV_STATE_READ_DATA) - { - for (client->task= client->task_list; client->task != NULL; - client->task= client->task->next) - { - if (client->task->con == client->con && - (client->task->state == GEARMAN_TASK_STATE_DATA || - client->task->state == GEARMAN_TASK_STATE_COMPLETE)) - { - break; - } - } - - assert(client->task != NULL); - } - else - { - /* Read the next packet, without buffering the data part. */ - client->task= NULL; - (void)gearman_connection_recv(client->con, &(client->con->packet), &ret, - false); - } - } - else - { - /* Read the next packet, buffering the data part. */ - client->task= NULL; - (void)gearman_connection_recv(client->con, &(client->con->packet), &ret, true); - } - - if (client->task == NULL) - { - /* Check the return of the gearman_connection_recv() calls above. */ - if (ret != GEARMAN_SUCCESS) - { - if (ret == GEARMAN_IO_WAIT) - break; - - client->state= GEARMAN_CLIENT_STATE_IDLE; - return ret; - } - - client->con->options.packet_in_use= true; - - /* We have a packet, see which task it belongs to. */ - for (client->task= client->task_list; client->task != NULL; - client->task= client->task->next) - { - if (client->task->con != client->con) - continue; - - if (client->con->packet.command == GEARMAN_COMMAND_JOB_CREATED) - { - if (client->task->created_id != client->con->created_id) - continue; - - /* New job created, drop through below and notify task. */ - client->con->created_id++; - } - else if (client->con->packet.command == GEARMAN_COMMAND_ERROR) - { - gearman_universal_set_error(&client->universal, "gearman_client_run_tasks", - "%s:%.*s", - (char *)(client->con->packet.arg[0]), - (int)(client->con->packet.arg_size[1]), - (char *)(client->con->packet.arg[1])); - - return GEARMAN_SERVER_ERROR; - } - else if (strncmp(client->task->job_handle, - (char *)(client->con->packet.arg[0]), - client->con->packet.arg_size[0]) || - (client->con->packet.command != GEARMAN_COMMAND_WORK_FAIL && - strlen(client->task->job_handle) != client->con->packet.arg_size[0] - 1) || - (client->con->packet.command == GEARMAN_COMMAND_WORK_FAIL && - strlen(client->task->job_handle) != client->con->packet.arg_size[0])) - { - continue; - } - - /* Else, we have a matching result packet of some kind. */ - - break; - } - - if (client->task == NULL) - { - /* The client has stopped waiting for the response, ignore it. */ - gearman_packet_free(&(client->con->packet)); - client->con->options.packet_in_use= false; - continue; - } - - client->task->recv= &(client->con->packet); - } - - case GEARMAN_CLIENT_STATE_PACKET: - /* Let task process job created or result packet. */ - ret= _client_run_task(client, client->task); - if (ret == GEARMAN_IO_WAIT) - break; - if (ret != GEARMAN_SUCCESS) - { - client->state= GEARMAN_CLIENT_STATE_PACKET; - return ret; - } - - /* Clean up the packet. */ - gearman_packet_free(&(client->con->packet)); - client->con->options.packet_in_use= false; - - /* If all tasks are done, return. */ - if (client->running_tasks == 0) - break; - } - } - - /* If all tasks are done, return. */ - if (client->running_tasks == 0) - break; - - if (client->new_tasks > 0 && ! (client->options.no_new)) - continue; - - if (client->options.non_blocking) - { - /* Let the caller wait for activity. */ - client->state= GEARMAN_CLIENT_STATE_IDLE; - - return GEARMAN_IO_WAIT; - } - - /* Wait for activity on one of the connections. */ - ret= gearman_wait(&client->universal); - if (ret != GEARMAN_SUCCESS && ret != GEARMAN_IO_WAIT) - { - client->state= GEARMAN_CLIENT_STATE_IDLE; - - return ret; - } - } - - break; - - default: - gearman_universal_set_error(&client->universal, "gearman_client_run_tasks", - "unknown state: %u", client->state); - - return GEARMAN_UNKNOWN_STATE; - } - - client->state= GEARMAN_CLIENT_STATE_IDLE; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_client_run_tasks(gearman_client_st *client) -{ - gearman_return_t rc; - - _push_non_blocking(client); - - rc= _client_run_tasks(client); - - _pop_non_blocking(client); - - return rc; -} - -/* - * Static Definitions - */ - -static gearman_client_st *_client_allocate(gearman_client_st *client, bool is_clone) -{ - if (client == NULL) - { - client= malloc(sizeof(gearman_client_st)); - if (client == NULL) - return NULL; - - client->options.allocated= true; - } - else - { - client->options.allocated= false; - } - - client->options.non_blocking= false; - client->options.task_in_use= false; - client->options.unbuffered_result= false; - client->options.no_new= false; - client->options.free_tasks= false; - - client->state= 0; - client->do_ret= 0; - client->new_tasks= 0; - client->running_tasks= 0; - client->task_count= 0; - client->do_data_size= 0; - client->context= NULL; - client->con= NULL; - client->task= NULL; - client->task_list= NULL; - client->task_context_free_fn= NULL; - client->do_data= NULL; - client->workload_fn= NULL; - client->created_fn= NULL; - client->data_fn= NULL; - client->warning_fn= NULL; - client->status_fn= NULL; - client->complete_fn= NULL; - client->exception_fn= NULL; - client->fail_fn= NULL; - - if (! is_clone) - { - gearman_universal_st *check; - - check= gearman_universal_create(&client->universal, NULL); - if (check == NULL) - { - gearman_client_free(client); - return NULL; - } - } - - return client; -} - -static gearman_return_t _client_add_server(const char *host, in_port_t port, - void *context) -{ - return gearman_client_add_server((gearman_client_st *)context, host, port); -} - -static gearman_task_st *_client_add_task(gearman_client_st *client, - gearman_task_st *task, - void *context, - gearman_command_t command, - const char *function_name, - size_t function_name_length, - const char *unique, - size_t unique_length, - const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - uuid_t uuid; - char uuid_string[37]; - const void *args[3]; - size_t args_size[3]; - - task= gearman_task_create(client, task); - if (task == NULL) - { - *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - task->context= context; - - if (unique == NULL) - { - uuid_generate(uuid); - uuid_unparse(uuid, uuid_string); - uuid_string[36]= 0; - unique= uuid_string; - unique_length= 36; // @note This comes from uuid/uuid.h (which does not define a number) - } - - /** - @todo fix it so that NULL is done by default by the API not by happenstance. - */ - - args[0]= function_name; - args_size[0]= function_name_length + 1; - args[1]= unique; - args_size[1]= unique_length + 1; - args[2]= workload; - args_size[2]= workload_size; - - *ret_ptr= gearman_packet_create_args(&client->universal, &(task->send), - GEARMAN_MAGIC_REQUEST, command, - args, args_size, 3); - if (*ret_ptr == GEARMAN_SUCCESS) - { - client->new_tasks++; - client->running_tasks++; - task->options.send_in_use= true; - } - - return task; -} - -static gearman_return_t _client_run_task(gearman_client_st *client, - gearman_task_st *task) -{ - gearman_return_t ret; - char status_buffer[11]; /* Max string size to hold a uint32_t. */ - uint8_t x; - - switch(task->state) - { - case GEARMAN_TASK_STATE_NEW: - if (task->client->universal.con_list == NULL) - { - client->new_tasks--; - client->running_tasks--; - gearman_universal_set_error(&client->universal, "_client_run_task", - "no servers added"); - return GEARMAN_NO_SERVERS; - } - - for (task->con= task->client->universal.con_list; task->con != NULL; - task->con= task->con->next) - { - if (task->con->send_state == GEARMAN_CON_SEND_STATE_NONE) - break; - } - - if (task->con == NULL) - { - client->options.no_new= true; - return GEARMAN_IO_WAIT; - } - - client->new_tasks--; - - if (task->send.command != GEARMAN_COMMAND_GET_STATUS) - { - task->created_id= task->con->created_id_next; - task->con->created_id_next++; - } - - case GEARMAN_TASK_STATE_SUBMIT: - while (1) - { - ret= gearman_connection_send(task->con, &(task->send), - client->new_tasks == 0 ? true : false); - if (ret == GEARMAN_SUCCESS) - break; - else if (ret == GEARMAN_IO_WAIT) - { - task->state= GEARMAN_TASK_STATE_SUBMIT; - return GEARMAN_IO_WAIT; - } - else if (ret != GEARMAN_SUCCESS) - { - /* Increment this since the job submission failed. */ - task->con->created_id++; - - if (ret == GEARMAN_COULD_NOT_CONNECT) - { - for (task->con= task->con->next; task->con != NULL; - task->con= task->con->next) - { - if (task->con->send_state == GEARMAN_CON_SEND_STATE_NONE) - break; - } - } - else - task->con= NULL; - - if (task->con == NULL) - { - client->running_tasks--; - return ret; - } - - if (task->send.command != GEARMAN_COMMAND_GET_STATUS) - { - task->created_id= task->con->created_id_next; - task->con->created_id_next++; - } - } - } - - if (task->send.data_size > 0 && task->send.data == NULL) - { - if (client->workload_fn == NULL) - { - gearman_universal_set_error(&client->universal, "_client_run_task", - "workload size > 0, but no data pointer or workload_fn was given"); - return GEARMAN_NEED_WORKLOAD_FN; - } - - case GEARMAN_TASK_STATE_WORKLOAD: - ret= client->workload_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_WORKLOAD; - return ret; - } - } - - client->options.no_new= false; - task->state= GEARMAN_TASK_STATE_WORK; - return gearman_connection_set_events(task->con, POLLIN); - - case GEARMAN_TASK_STATE_WORK: - if (task->recv->command == GEARMAN_COMMAND_JOB_CREATED) - { - snprintf(task->job_handle, GEARMAN_JOB_HANDLE_SIZE, "%.*s", - (uint32_t)(task->recv->arg_size[0]), - (char *)(task->recv->arg[0])); - - case GEARMAN_TASK_STATE_CREATED: - if (client->created_fn != NULL) - { - ret= client->created_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_CREATED; - return ret; - } - } - - if (task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_BG || - task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG || - task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG) - { - break; - } - } - else if (task->recv->command == GEARMAN_COMMAND_WORK_DATA) - { - case GEARMAN_TASK_STATE_DATA: - if (client->data_fn != NULL) - { - ret= client->data_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_DATA; - return ret; - } - } - } - else if (task->recv->command == GEARMAN_COMMAND_WORK_WARNING) - { - case GEARMAN_TASK_STATE_WARNING: - if (client->warning_fn != NULL) - { - ret= client->warning_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_WARNING; - return ret; - } - } - } - else if (task->recv->command == GEARMAN_COMMAND_WORK_STATUS || - task->recv->command == GEARMAN_COMMAND_STATUS_RES) - { - if (task->recv->command == GEARMAN_COMMAND_STATUS_RES) - { - if (atoi((char *)task->recv->arg[1]) == 0) - task->options.is_known= false; - else - task->options.is_known= true; - - if (atoi((char *)task->recv->arg[2]) == 0) - task->options.is_running= false; - else - task->options.is_running= true; - - x= 3; - } - else - x= 1; - - task->numerator= (uint32_t)atoi((char *)task->recv->arg[x]); - snprintf(status_buffer, 11, "%.*s", - (uint32_t)(task->recv->arg_size[x + 1]), - (char *)(task->recv->arg[x + 1])); - task->denominator= (uint32_t)atoi(status_buffer); - - case GEARMAN_TASK_STATE_STATUS: - if (client->status_fn != NULL) - { - ret= client->status_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_STATUS; - return ret; - } - } - - if (task->send.command == GEARMAN_COMMAND_GET_STATUS) - break; - } - else if (task->recv->command == GEARMAN_COMMAND_WORK_COMPLETE) - { - case GEARMAN_TASK_STATE_COMPLETE: - if (client->complete_fn != NULL) - { - ret= client->complete_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_COMPLETE; - return ret; - } - } - - break; - } - else if (task->recv->command == GEARMAN_COMMAND_WORK_EXCEPTION) - { - case GEARMAN_TASK_STATE_EXCEPTION: - if (client->exception_fn != NULL) - { - ret= client->exception_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_EXCEPTION; - return ret; - } - } - } - else if (task->recv->command == GEARMAN_COMMAND_WORK_FAIL) - { - case GEARMAN_TASK_STATE_FAIL: - if (client->fail_fn != NULL) - { - ret= client->fail_fn(task); - if (ret != GEARMAN_SUCCESS) - { - task->state= GEARMAN_TASK_STATE_FAIL; - return ret; - } - } - - break; - } - - task->state= GEARMAN_TASK_STATE_WORK; - return GEARMAN_SUCCESS; - - case GEARMAN_TASK_STATE_FINISHED: - break; - - default: - gearman_universal_set_error(&client->universal, "_client_run_task", "unknown state: %u", - task->state); - return GEARMAN_UNKNOWN_STATE; - } - - client->running_tasks--; - task->state= GEARMAN_TASK_STATE_FINISHED; - - if (client->options.free_tasks) - gearman_task_free(task); - - return GEARMAN_SUCCESS; -} - -static void *_client_do(gearman_client_st *client, gearman_command_t command, - const char *function_name, size_t function_name_length, - const char *unique, size_t unique_length, - const void *workload, size_t workload_size, - size_t *result_size, gearman_return_t *ret_ptr) -{ - if (! client->options.task_in_use) - { - (void)_client_add_task(client, &(client->do_task), client, command, - function_name, function_name_length, - unique, unique_length, - workload, workload_size, - ret_ptr); - if (*ret_ptr != GEARMAN_SUCCESS) - return NULL; - - client->options.task_in_use= true; - } - - client->workload_fn= NULL; - client->created_fn= NULL; - client->data_fn= _client_do_data; - client->warning_fn= _client_do_data; - client->status_fn= _client_do_status; - client->complete_fn= _client_do_data; - client->exception_fn= _client_do_data; - client->fail_fn= _client_do_fail; - - *ret_ptr= gearman_client_run_tasks(client); - if (*ret_ptr != GEARMAN_IO_WAIT && (*ret_ptr != GEARMAN_PAUSE || - client->do_ret == GEARMAN_WORK_FAIL)) - { - gearman_task_free(&(client->do_task)); - client->options.task_in_use= false; - client->new_tasks= 0; - client->running_tasks= 0; - } - - workload= NULL; - - if (*ret_ptr == GEARMAN_SUCCESS || *ret_ptr == GEARMAN_PAUSE) - { - *ret_ptr= client->do_ret; - workload= client->do_data; - *result_size= client->do_data_size; - client->do_data= NULL; - client->do_data_size= 0; - } - - return (void *)workload; -} - -static gearman_return_t _client_do_background(gearman_client_st *client, - gearman_command_t command, - const char *function_name, - size_t function_name_length, - const char *unique, - size_t unique_length, - const void *workload, - size_t workload_size, - char *job_handle) -{ - gearman_return_t ret; - - if (! client->options.task_in_use) - { - (void)_client_add_task(client, &(client->do_task), client, command, - function_name, function_name_length, - unique, unique_length, - workload, workload_size, - &ret); - if (ret != GEARMAN_SUCCESS) - return ret; - - client->options.task_in_use= true; - } - - gearman_client_clear_fn(client); - - ret= gearman_client_run_tasks(client); - if (ret != GEARMAN_IO_WAIT) - { - if (job_handle) - { - strncpy(job_handle, client->do_task.job_handle, GEARMAN_JOB_HANDLE_SIZE); - } - - gearman_task_free(&(client->do_task)); - client->options.task_in_use= false; - client->new_tasks= 0; - client->running_tasks= 0; - } - - return ret; -} - -static gearman_return_t _client_do_data(gearman_task_st *task) -{ - gearman_client_st *client= (gearman_client_st *)gearman_task_context(task); - - if (client->do_ret != GEARMAN_SUCCESS) - { - client->do_ret= GEARMAN_SUCCESS; - return GEARMAN_SUCCESS; - } - - client->do_data= gearman_task_take_data(task, &(client->do_data_size)); - - if (task->recv->command == GEARMAN_COMMAND_WORK_DATA) - client->do_ret= GEARMAN_WORK_DATA; - else if (task->recv->command == GEARMAN_COMMAND_WORK_WARNING) - client->do_ret= GEARMAN_WORK_WARNING; - else if (task->recv->command == GEARMAN_COMMAND_WORK_EXCEPTION) - client->do_ret= GEARMAN_WORK_EXCEPTION; - else - return GEARMAN_SUCCESS; - - return GEARMAN_PAUSE; -} - -static gearman_return_t _client_do_status(gearman_task_st *task) -{ - gearman_client_st *client= (gearman_client_st *)gearman_task_context(task); - - if (client->do_ret != GEARMAN_SUCCESS) - { - client->do_ret= GEARMAN_SUCCESS; - return GEARMAN_SUCCESS; - } - - client->do_ret= GEARMAN_WORK_STATUS; - return GEARMAN_PAUSE; -} - -static gearman_return_t _client_do_fail(gearman_task_st *task) -{ - gearman_client_st *client= (gearman_client_st *)gearman_task_context(task); - - client->do_ret= GEARMAN_WORK_FAIL; - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman/client_callbacks.h gearmand-0.23/libgearman/client_callbacks.h --- gearmand-0.14/libgearman/client_callbacks.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/client_callbacks.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,59 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +// Client callbacks +typedef gearman_return_t (gearman_workload_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_created_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_data_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_warning_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_universal_status_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_complete_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_exception_fn)(gearman_task_st *task); +typedef gearman_return_t (gearman_fail_fn)(gearman_task_st *task); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/client.cc gearmand-0.23/libgearman/client.cc --- gearmand-0.14/libgearman/client.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/client.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,1474 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** Allocate a client structure. + */ +static gearman_client_st *_client_allocate(gearman_client_st *client, bool is_clone); + +/** + * Callback function used when parsing server lists. + */ +static gearman_return_t _client_add_server(const char *host, in_port_t port, + void *context); + +/** + * Real do function. + */ +static void *_client_do(gearman_client_st *client, gearman_command_t command, + const char *function_name, + const char *unique, + const void *workload, size_t workload_size, + size_t *result_size, gearman_return_t *ret_ptr); + +/** + * Real background do function. + */ +static gearman_return_t _client_do_background(gearman_client_st *client, + gearman_command_t command, + gearman_string_t &function, + gearman_unique_t &unique, + gearman_string_t &workload, + gearman_job_handle_t job_handle); + + +/* + * Public Definitions + */ + +gearman_client_st *gearman_client_create(gearman_client_st *client) +{ + return _client_allocate(client, false); +} + +gearman_client_st *gearman_client_clone(gearman_client_st *client, + const gearman_client_st *from) +{ + if (not from) + { + return _client_allocate(client, false); + } + + client= _client_allocate(client, true); + + if (not client) + { + return client; + } + + client->options.non_blocking= from->options.non_blocking; + client->options.unbuffered_result= from->options.unbuffered_result; + client->options.no_new= from->options.no_new; + client->options.free_tasks= from->options.free_tasks; + client->actions= from->actions; + client->_do_handle[0]= 0; + + gearman_universal_clone(client->universal, from->universal); + + return client; +} + +void gearman_client_free(gearman_client_st *client) +{ + if (not client) + return; + + gearman_client_task_free_all(client); + + gearman_universal_free(client->universal); + + if (client->options.allocated) + delete client; +} + +const char *gearman_client_error(const gearman_client_st *client) +{ + if (not client) + return NULL; + + return gearman_universal_error(client->universal); +} + +int gearman_client_errno(const gearman_client_st *client) +{ + if (not client) + return 0; + + return gearman_universal_errno(client->universal); +} + +gearman_client_options_t gearman_client_options(const gearman_client_st *client) +{ + int32_t options; + memset(&options, 0, sizeof(int32_t)); + + if (client->options.allocated) + options|= int(GEARMAN_CLIENT_ALLOCATED); + + if (client->options.non_blocking) + options|= int(GEARMAN_CLIENT_NON_BLOCKING); + + if (client->options.unbuffered_result) + options|= int(GEARMAN_CLIENT_UNBUFFERED_RESULT); + + if (client->options.no_new) + options|= int(GEARMAN_CLIENT_NO_NEW); + + if (client->options.free_tasks) + options|= int(GEARMAN_CLIENT_FREE_TASKS); + + return gearman_client_options_t(options); +} + +bool gearman_client_has_option(gearman_client_st *client, + gearman_client_options_t option) +{ + if (not client) + return false; + + switch (option) + { + case GEARMAN_CLIENT_ALLOCATED: + return client->options.allocated; + + case GEARMAN_CLIENT_NON_BLOCKING: + return client->options.non_blocking; + + case GEARMAN_CLIENT_UNBUFFERED_RESULT: + return client->options.unbuffered_result; + + case GEARMAN_CLIENT_NO_NEW: + return client->options.no_new; + + case GEARMAN_CLIENT_FREE_TASKS: + return client->options.free_tasks; + + default: + case GEARMAN_CLIENT_TASK_IN_USE: + case GEARMAN_CLIENT_MAX: + return false; + } +} + +void gearman_client_set_options(gearman_client_st *client, + gearman_client_options_t options) +{ + if (not client) + return; + + gearman_client_options_t usable_options[]= { + GEARMAN_CLIENT_NON_BLOCKING, + GEARMAN_CLIENT_UNBUFFERED_RESULT, + GEARMAN_CLIENT_FREE_TASKS, + GEARMAN_CLIENT_MAX + }; + + gearman_client_options_t *ptr; + + + for (ptr= usable_options; *ptr != GEARMAN_CLIENT_MAX ; ptr++) + { + if (options & *ptr) + { + gearman_client_add_options(client, *ptr); + } + else + { + gearman_client_remove_options(client, *ptr); + } + } +} + +void gearman_client_add_options(gearman_client_st *client, + gearman_client_options_t options) +{ + if (not client) + return; + + if (options & GEARMAN_CLIENT_NON_BLOCKING) + { + gearman_universal_add_options(client->universal, GEARMAN_NON_BLOCKING); + client->options.non_blocking= true; + } + + if (options & GEARMAN_CLIENT_UNBUFFERED_RESULT) + { + client->options.unbuffered_result= true; + } + + if (options & GEARMAN_CLIENT_FREE_TASKS) + { + client->options.free_tasks= true; + } +} + +void gearman_client_remove_options(gearman_client_st *client, + gearman_client_options_t options) +{ + if (not client) + return; + + if (options & GEARMAN_CLIENT_NON_BLOCKING) + { + gearman_universal_remove_options(client->universal, GEARMAN_NON_BLOCKING); + client->options.non_blocking= false; + } + + if (options & GEARMAN_CLIENT_UNBUFFERED_RESULT) + { + client->options.unbuffered_result= false; + } + + if (options & GEARMAN_CLIENT_FREE_TASKS) + { + client->options.free_tasks= false; + } +} + +int gearman_client_timeout(gearman_client_st *client) +{ + return gearman_universal_timeout(client->universal); +} + +void gearman_client_set_timeout(gearman_client_st *client, int timeout) +{ + if (not client) + return; + + gearman_universal_set_timeout(client->universal, timeout); +} + +void *gearman_client_context(const gearman_client_st *client) +{ + if (not client) + return NULL; + + return const_cast(client->context); +} + +void gearman_client_set_context(gearman_client_st *client, void *context) +{ + if (not client) + return; + + client->context= context; +} + +void gearman_client_set_log_fn(gearman_client_st *client, + gearman_log_fn *function, void *context, + gearman_verbose_t verbose) +{ + if (not client) + return; + + gearman_set_log_fn(client->universal, function, context, verbose); +} + +void gearman_client_set_workload_malloc_fn(gearman_client_st *client, + gearman_malloc_fn *function, + void *context) +{ + if (not client) + return; + + gearman_set_workload_malloc_fn(client->universal, function, context); +} + +void gearman_client_set_workload_free_fn(gearman_client_st *client, gearman_free_fn *function, void *context) +{ + if (not client) + return; + + gearman_set_workload_free_fn(client->universal, function, context); +} + +gearman_return_t gearman_client_add_server(gearman_client_st *client, + const char *host, in_port_t port) +{ + if (not client) + { + return GEARMAN_INVALID_ARGUMENT; + } + + if (not gearman_connection_create_args(client->universal, host, port)) + { + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_client_add_servers(gearman_client_st *client, + const char *servers) +{ + return gearman_parse_servers(servers, _client_add_server, client); +} + +void gearman_client_remove_servers(gearman_client_st *client) +{ + if (not client) + return; + + gearman_free_all_cons(client->universal); +} + +gearman_return_t gearman_client_wait(gearman_client_st *client) +{ + if (not client) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_wait(client->universal); +} + +void *gearman_client_do(gearman_client_st *client, + const char *function, + const char *unique, + const void *workload, + size_t workload_size, size_t *result_size, + gearman_return_t *ret_ptr) +{ + return _client_do(client, GEARMAN_COMMAND_SUBMIT_JOB, + function, + unique, + workload, workload_size, + result_size, ret_ptr); +} + +void *gearman_client_do_high(gearman_client_st *client, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + size_t *result_size, gearman_return_t *ret_ptr) +{ + return _client_do(client, GEARMAN_COMMAND_SUBMIT_JOB_HIGH, + function, + unique, + workload, workload_size, + result_size, ret_ptr); +} + +void *gearman_client_do_low(gearman_client_st *client, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + size_t *result_size, gearman_return_t *ret_ptr) +{ + return _client_do(client, GEARMAN_COMMAND_SUBMIT_JOB_LOW, + function, + unique, + workload, workload_size, + result_size, ret_ptr); +} + +size_t gearman_client_count_tasks(gearman_client_st *client) +{ + if (not client) + return 0; + + size_t count= 1; + gearman_task_st *search= client->task_list; + + while ((search= search->next)) + { + count++; + } + + return count; +} + +#if 0 +static bool _active_tasks(gearman_client_st *client) +{ + assert(client); + gearman_task_st *search= client->task_list; + + if (not search) + return false; + + do + { + if (gearman_task_is_active(search)) + { + return true; + } + } while ((search= search->next)); + + return false; +} +#endif + +const char *gearman_client_do_job_handle(gearman_client_st *self) +{ + if (not self) + { + errno= EINVAL; + return NULL; + } + + return self->_do_handle; +} + +void gearman_client_do_status(gearman_client_st *, uint32_t *numerator, uint32_t *denominator) +{ + if (numerator) + *numerator= 0; + + if (denominator) + *denominator= 0; +} + +gearman_return_t gearman_client_do_background(gearman_client_st *client, + const char *function_name, + const char *unique, + const void *workload_str, + size_t workload_size, + gearman_job_handle_t job_handle) +{ + gearman_string_t function= { gearman_string_param_cstr(function_name) }; + gearman_unique_t local_unique= gearman_unique_make(unique, unique ? strlen(unique) : 0); + gearman_string_t workload= { static_cast(workload_str), workload_size }; + + return _client_do_background(client, GEARMAN_COMMAND_SUBMIT_JOB_BG, + function, + local_unique, + workload, + job_handle); +} + +gearman_return_t gearman_client_do_high_background(gearman_client_st *client, + const char *function_name, + const char *unique, + const void *workload_str, + size_t workload_size, + gearman_job_handle_t job_handle) +{ + gearman_string_t function= { gearman_string_param_cstr(function_name) }; + gearman_unique_t local_unique= gearman_unique_make(unique, unique ? strlen(unique) : 0); + gearman_string_t workload= { static_cast(workload_str), workload_size }; + + return _client_do_background(client, GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, + function, + local_unique, + workload, + job_handle); +} + +gearman_return_t gearman_client_do_low_background(gearman_client_st *client, + const char *function_name, + const char *unique, + const void *workload_str, + size_t workload_size, + gearman_job_handle_t job_handle) +{ + gearman_string_t function= { gearman_string_param_cstr(function_name) }; + gearman_unique_t local_unique= gearman_unique_make(unique, unique ? strlen(unique) : 0); + gearman_string_t workload= { static_cast(workload_str), workload_size }; + + return _client_do_background(client, GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, + function, + local_unique, + workload, + job_handle); +} + +gearman_return_t gearman_client_job_status(gearman_client_st *client, + const gearman_job_handle_t job_handle, + bool *is_known, bool *is_running, + uint32_t *numerator, + uint32_t *denominator) +{ + gearman_return_t ret; + + if (not client) + return GEARMAN_INVALID_ARGUMENT; + + gearman_task_st do_task; + gearman_task_st *do_task_ptr= gearman_client_add_task_status(client, &do_task, client, + job_handle, &ret); + if (gearman_failed(ret)) + { + return ret; + } + assert(do_task_ptr); + do_task_ptr->type= GEARMAN_TASK_KIND_DO; + + gearman_task_clear_fn(do_task_ptr); + + do { + ret= gearman_client_run_tasks(client); + + // If either of the following is ever true, we will end up in an + // infinite loop + assert(ret != GEARMAN_IN_PROGRESS and ret != GEARMAN_JOB_EXISTS); + + } while (gearman_continue(ret)); + + // @note we don't know if our task was run or not, we just know something + // happened. + + if (gearman_success(ret)) + { + if (is_known) + *is_known= do_task.options.is_known; + + if (is_running) + *is_running= do_task.options.is_running; + + if (numerator) + *numerator= do_task.numerator; + + if (denominator) + *denominator= do_task.denominator; + + if (not is_known and not is_running) + { + if (do_task.options.is_running) + { + ret= GEARMAN_IN_PROGRESS; + } + else if (do_task.options.is_known) + { + ret= GEARMAN_JOB_EXISTS; + } + } + } + else + { + if (is_known) + *is_known= false; + + if (is_running) + *is_running= false; + + if (numerator) + *numerator= 0; + + if (denominator) + *denominator= 0; + } + gearman_task_free(do_task_ptr); + + return ret; +} + +gearman_return_t gearman_client_echo(gearman_client_st *client, + const void *workload, + size_t workload_size) +{ + if (not client) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_echo(client->universal, workload, workload_size); +} + +void gearman_client_task_free_all(gearman_client_st *client) +{ + if (not client) + return; + + while (client->task_list) + { + gearman_task_free(client->task_list); + } +} + +void gearman_client_set_task_context_free_fn(gearman_client_st *client, + gearman_task_context_free_fn *function) +{ + if (not client) + return; + + client->task_context_free_fn= function; + +} + +gearman_return_t gearman_client_set_memory_allocators(gearman_client_st *client, + gearman_malloc_fn *malloc_fn, + gearman_free_fn *free_fn, + gearman_realloc_fn *realloc_fn, + gearman_calloc_fn *calloc_fn, + void *context) +{ + if (not client) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_set_memory_allocator(client->universal.allocator, malloc_fn, free_fn, realloc_fn, calloc_fn, context); +} + + + +gearman_task_st *gearman_client_add_task(gearman_client_st *client, + gearman_task_st *task, + void *context, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + gearman_return_t *ret_ptr) +{ + return add_task(client, task, + context, GEARMAN_COMMAND_SUBMIT_JOB, + function, + unique, + workload, workload_size, + time_t(0), + ret_ptr, + client->actions); +} + +gearman_task_st *gearman_client_add_task_high(gearman_client_st *client, + gearman_task_st *task, + void *context, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + gearman_return_t *ret_ptr) +{ + return add_task(client, task, context, + GEARMAN_COMMAND_SUBMIT_JOB_HIGH, + function, + unique, + workload, workload_size, + time_t(0), + ret_ptr, + client->actions); +} + +gearman_task_st *gearman_client_add_task_low(gearman_client_st *client, + gearman_task_st *task, + void *context, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + gearman_return_t *ret_ptr) +{ + return add_task(client, task, context, GEARMAN_COMMAND_SUBMIT_JOB_LOW, + function, + unique, + workload, workload_size, + time_t(0), + ret_ptr, + client->actions); +} + +gearman_task_st *gearman_client_add_task_background(gearman_client_st *client, + gearman_task_st *task, + void *context, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + gearman_return_t *ret_ptr) +{ + return add_task(client, task, context, GEARMAN_COMMAND_SUBMIT_JOB_BG, + function, + unique, + workload, workload_size, + time_t(0), + ret_ptr, + client->actions); +} + +gearman_task_st * +gearman_client_add_task_high_background(gearman_client_st *client, + gearman_task_st *task, + void *context, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + gearman_return_t *ret_ptr) +{ + return add_task(client, task, context, + GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, + function, + unique, + workload, workload_size, + time_t(0), + ret_ptr, + client->actions); +} + +gearman_task_st * +gearman_client_add_task_low_background(gearman_client_st *client, + gearman_task_st *task, + void *context, + const char *function, + const char *unique, + const void *workload, size_t workload_size, + gearman_return_t *ret_ptr) +{ + return add_task(client, task, context, + GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, + function, + unique, + workload, workload_size, + time_t(0), + ret_ptr, + client->actions); + +} + +gearman_task_st *gearman_client_add_task_status(gearman_client_st *client, + gearman_task_st *task, + void *context, + const gearman_job_handle_t job_handle, + gearman_return_t *ret_ptr) +{ + const void *args[1]; + size_t args_size[1]; + gearman_return_t unused; + + if (not ret_ptr) + ret_ptr= &unused; + + if (not (task= gearman_task_internal_create(client, task))) + { + *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + task->context= context; + snprintf(task->job_handle, GEARMAN_JOB_HANDLE_SIZE, "%s", job_handle); + + args[0]= job_handle; + args_size[0]= strlen(job_handle); + gearman_return_t rc= gearman_packet_create_args(client->universal, task->send, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_GET_STATUS, + args, args_size, 1); + if (gearman_success(rc)) + { + client->new_tasks++; + client->running_tasks++; + task->options.send_in_use= true; + } + *ret_ptr= rc; + + return task; +} + +void gearman_client_set_workload_fn(gearman_client_st *client, + gearman_workload_fn *function) +{ + if (not client) + return; + + client->actions.workload_fn= function; +} + +void gearman_client_set_created_fn(gearman_client_st *client, + gearman_created_fn *function) +{ + if (not client) + return; + + client->actions.created_fn= function; +} + +void gearman_client_set_data_fn(gearman_client_st *client, + gearman_data_fn *function) +{ + if (not client) + return; + + client->actions.data_fn= function; +} + +void gearman_client_set_warning_fn(gearman_client_st *client, + gearman_warning_fn *function) +{ + if (not client) + return; + + client->actions.warning_fn= function; +} + +void gearman_client_set_status_fn(gearman_client_st *client, + gearman_universal_status_fn *function) +{ + if (not client) + return; + + client->actions.status_fn= function; +} + +void gearman_client_set_complete_fn(gearman_client_st *client, + gearman_complete_fn *function) +{ + if (not client) + return; + + client->actions.complete_fn= function; +} + +void gearman_client_set_exception_fn(gearman_client_st *client, + gearman_exception_fn *function) +{ + if (not client) + return; + + client->actions.exception_fn= function; +} + +void gearman_client_set_fail_fn(gearman_client_st *client, + gearman_fail_fn *function) +{ + if (not client) + return; + + client->actions.fail_fn= function; +} + +void gearman_client_clear_fn(gearman_client_st *client) +{ + if (not client) + return; + + client->actions= gearman_actions_default(); +} + +static inline void _push_non_blocking(gearman_client_st *client) +{ + client->universal.options.stored_non_blocking= client->universal.options.non_blocking; + client->universal.options.non_blocking= true; +} + +static inline void _pop_non_blocking(gearman_client_st *client) +{ + client->universal.options.non_blocking= client->options.non_blocking; + assert(client->universal.options.stored_non_blocking == client->options.non_blocking); +} + +static inline void _push_blocking(gearman_client_st *client) +{ + client->universal.options.stored_non_blocking= client->universal.options.non_blocking; + client->universal.options.non_blocking= false; +} + +static inline void _pop_blocking(gearman_client_st *client) +{ + client->universal.options.non_blocking= client->options.non_blocking; + assert(client->universal.options.stored_non_blocking == client->options.non_blocking); +} + +static inline gearman_return_t _client_run_tasks(gearman_client_st *client) +{ + gearman_return_t ret= GEARMAN_MAX_RETURN; + + switch(client->state) + { + case GEARMAN_CLIENT_STATE_IDLE: + while (1) + { + /* Start any new tasks. */ + if (client->new_tasks > 0 && ! (client->options.no_new)) + { + for (client->task= client->task_list; client->task; + client->task= client->task->next) + { + if (client->task->state != GEARMAN_TASK_STATE_NEW) + { + continue; + } + + case GEARMAN_CLIENT_STATE_NEW: + gearman_return_t local_ret= _client_run_task(client, client->task); + if (gearman_failed(local_ret) and local_ret != GEARMAN_IO_WAIT) + { + client->state= GEARMAN_CLIENT_STATE_NEW; + + return local_ret; + } + } + + if (client->new_tasks == 0) + { + gearman_return_t local_ret= gearman_flush_all(client->universal); + if (gearman_failed(local_ret)) + { + return local_ret; + } + } + } + + /* See if there are any connections ready for I/O. */ + while ((client->con= gearman_ready(client->universal))) + { + if (client->con->revents & (POLLOUT | POLLERR | POLLHUP | POLLNVAL)) + { + /* Socket is ready for writing, continue submitting jobs. */ + for (client->task= client->task_list; client->task; + client->task= client->task->next) + { + if (client->task->con != client->con or + (client->task->state != GEARMAN_TASK_STATE_SUBMIT and + client->task->state != GEARMAN_TASK_STATE_WORKLOAD)) + { + continue; + } + + case GEARMAN_CLIENT_STATE_SUBMIT: + gearman_return_t local_ret= _client_run_task(client, client->task); + if (local_ret == GEARMAN_COULD_NOT_CONNECT) + { + client->state= GEARMAN_CLIENT_STATE_IDLE; + return local_ret; + } + else if (gearman_failed(local_ret) and local_ret != GEARMAN_IO_WAIT) + { + client->state= GEARMAN_CLIENT_STATE_SUBMIT; + return local_ret; + } + } + } + + if (not (client->con->revents & POLLIN)) + continue; + + /* Socket is ready for reading. */ + while (1) + { + /* Read packet on connection and find which task it belongs to. */ + if (client->options.unbuffered_result) + { + /* If client is handling the data read, make sure it's complete. */ + if (client->con->recv_state == GEARMAN_CON_RECV_STATE_READ_DATA) + { + for (client->task= client->task_list; client->task; + client->task= client->task->next) + { + if (client->task->con == client->con && + (client->task->state == GEARMAN_TASK_STATE_DATA or + client->task->state == GEARMAN_TASK_STATE_COMPLETE)) + { + break; + } + } + + /* + Someone has set GEARMAN_CLIENT_UNBUFFERED_RESULT but hasn't setup the client to fetch data correctly. + Fatal error :( + */ + return gearman_universal_set_error(client->universal, GEARMAN_INVALID_ARGUMENT, AT, + "client created with GEARMAN_CLIENT_UNBUFFERED_RESULT, but was not setup to use it. %s", __func__); + } + else + { + /* Read the next packet, without buffering the data part. */ + client->task= NULL; + (void)client->con->receiving(client->con->_packet, ret, false); + } + } + else + { + /* Read the next packet, buffering the data part. */ + client->task= NULL; + (void)client->con->receiving(client->con->_packet, ret, true); + } + + if (client->task == NULL) + { + assert(ret != GEARMAN_MAX_RETURN); + + /* Check the return of the gearman_connection_recv() calls above. */ + if (gearman_failed(ret)) + { + if (ret == GEARMAN_IO_WAIT) + break; + + client->state= GEARMAN_CLIENT_STATE_IDLE; + return ret; + } + + client->con->options.packet_in_use= true; + + /* We have a packet, see which task it belongs to. */ + for (client->task= client->task_list; client->task; + client->task= client->task->next) + { + if (client->task->con != client->con) + continue; + + if (client->con->_packet.command == GEARMAN_COMMAND_JOB_CREATED) + { + if (client->task->created_id != client->con->created_id) + continue; + + /* New job created, drop through below and notify task. */ + client->con->created_id++; + } + else if (client->con->_packet.command == GEARMAN_COMMAND_ERROR) + { + gearman_universal_set_error(client->universal, GEARMAN_SERVER_ERROR, AT, + "%s:%.*s", + static_cast(client->con->_packet.arg[0]), + int(client->con->_packet.arg_size[1]), + static_cast(client->con->_packet.arg[1])); + + return GEARMAN_SERVER_ERROR; + } + else if (strncmp(client->task->job_handle, + static_cast(client->con->_packet.arg[0]), + client->con->_packet.arg_size[0]) || + (client->con->_packet.command != GEARMAN_COMMAND_WORK_FAIL && + strlen(client->task->job_handle) != client->con->_packet.arg_size[0] - 1) || + (client->con->_packet.command == GEARMAN_COMMAND_WORK_FAIL && + strlen(client->task->job_handle) != client->con->_packet.arg_size[0])) + { + continue; + } + + /* Else, we have a matching result packet of some kind. */ + + break; + } + + if (not client->task) + { + /* The client has stopped waiting for the response, ignore it. */ + gearman_packet_free(&(client->con->_packet)); + client->con->options.packet_in_use= false; + continue; + } + + client->task->recv= &(client->con->_packet); + } + + case GEARMAN_CLIENT_STATE_PACKET: + /* Let task process job created or result packet. */ + gearman_return_t local_ret= _client_run_task(client, client->task); + + if (local_ret == GEARMAN_IO_WAIT) + break; + + if (gearman_failed(local_ret)) + { + client->state= GEARMAN_CLIENT_STATE_PACKET; + return local_ret; + } + + /* Clean up the packet. */ + gearman_packet_free(&(client->con->_packet)); + client->con->options.packet_in_use= false; + + /* If all tasks are done, return. */ + if (client->running_tasks == 0) + break; + } + } + + /* If all tasks are done, return. */ + if (client->running_tasks == 0) + { + break; + } + + if (client->new_tasks > 0 && ! (client->options.no_new)) + continue; + + if (client->options.non_blocking) + { + /* Let the caller wait for activity. */ + client->state= GEARMAN_CLIENT_STATE_IDLE; + gearman_gerror(client->universal, GEARMAN_IO_WAIT); + + return GEARMAN_IO_WAIT; + } + + /* Wait for activity on one of the connections. */ + gearman_return_t local_ret= gearman_wait(client->universal); + if (gearman_failed(local_ret) and local_ret != GEARMAN_IO_WAIT) + { + client->state= GEARMAN_CLIENT_STATE_IDLE; + + return local_ret; + } + } + + break; + } + + client->state= GEARMAN_CLIENT_STATE_IDLE; + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_client_run_tasks(gearman_client_st *client) +{ + if (not client) + { + return GEARMAN_INVALID_ARGUMENT; + } + + if (not client->task_list) // We are immediatly successful if all tasks are completed + { + return GEARMAN_SUCCESS; + } + + + _push_non_blocking(client); + + gearman_return_t rc= _client_run_tasks(client); + + _pop_non_blocking(client); + + if (rc == GEARMAN_COULD_NOT_CONNECT) + { + gearman_reset(client->universal); + } + + return rc; +} + +gearman_return_t gearman_client_run_block_tasks(gearman_client_st *client) +{ + if (not client) + { + return GEARMAN_INVALID_ARGUMENT; + } + + if (not client->task_list) // We are immediatly successful if all tasks are completed + { + return GEARMAN_SUCCESS; + } + + + _push_blocking(client); + + gearman_return_t rc= _client_run_tasks(client); + + _pop_blocking(client); + + if (gearman_failed(rc)) + { + if (rc == GEARMAN_COULD_NOT_CONNECT) + { + gearman_reset(client->universal); + } + + assert(gearman_universal_error_code(client->universal) == rc); + } + + return rc; +} + +/* + * Static Definitions + */ + +static gearman_client_st *_client_allocate(gearman_client_st *client, bool is_clone) +{ + if (client) + { + client->options.allocated= false; + } + else + { + client= new (std::nothrow) gearman_client_st; + if (not client) + return NULL; + + client->options.allocated= true; + } + + client->options.non_blocking= false; + client->options.unbuffered_result= false; + client->options.no_new= false; + client->options.free_tasks= false; + + client->state= GEARMAN_CLIENT_STATE_IDLE; + client->new_tasks= 0; + client->running_tasks= 0; + client->task_count= 0; + client->context= NULL; + client->con= NULL; + client->task= NULL; + client->task_list= NULL; + client->task_context_free_fn= NULL; + gearman_client_clear_fn(client); + + if (not is_clone) + { + gearman_universal_initialize(client->universal); + } + + return client; +} + +static gearman_return_t _client_add_server(const char *host, in_port_t port, + void *context) +{ + return gearman_client_add_server(static_cast(context), host, port); +} + +static void *_client_do(gearman_client_st *client, gearman_command_t command, + const char *function_name, + const char *unique, + const void *workload_str, size_t workload_size, + size_t *result_size, gearman_return_t *ret_ptr) +{ + gearman_string_t function= { gearman_string_param_cstr(function_name) }; + gearman_unique_t local_unique= gearman_unique_make(unique, unique ? strlen(unique) : 0); + gearman_string_t workload= { static_cast(workload_str), workload_size }; + + gearman_return_t unused; + if (not ret_ptr) + ret_ptr= &unused; + + size_t unused_size; + if (not result_size) + result_size= &unused_size; + + if (not client) + { + *ret_ptr= GEARMAN_INVALID_ARGUMENT; + errno= EINVAL; + return NULL; + } + + if (not function_name) + { + *ret_ptr= GEARMAN_INVALID_ARGUMENT; + return NULL; + } + + gearman_task_st do_task; + gearman_task_st *do_task_ptr= add_task(client, &do_task, NULL, command, + function, + local_unique, + workload, + time_t(0), + gearman_actions_do_default()); + if (not do_task_ptr) + { + *ret_ptr= gearman_universal_error_code(client->universal); + return NULL; + } + do_task_ptr->type= GEARMAN_TASK_KIND_DO; + + gearman_return_t ret; + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + + // gearman_client_run_tasks failed + assert(client->task_list); // Programmer error, we should always have the task that we used for do + + char *returnable= NULL; + if (gearman_failed(ret)) + { + if (ret == GEARMAN_COULD_NOT_CONNECT) + { } + else + { + gearman_error(client->universal, ret, "occured during gearman_client_run_tasks()"); + } + + *ret_ptr= ret; + *result_size= 0; + } + else if (gearman_success(ret) and do_task_ptr->result_rc == GEARMAN_SUCCESS) + { + *ret_ptr= do_task_ptr->result_rc; + if (do_task_ptr->result_ptr) + { + if (gearman_has_allocator(client->universal)) + { + gearman_string_t result= gearman_result_string(do_task_ptr->result_ptr); + returnable= static_cast(gearman_malloc(client->universal, gearman_size(result) +1)); + if (not returnable) + { + gearman_error(client->universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "custom workload_fn failed to allocate memory"); + *result_size= 0; + } + else // NULL terminate + { + memcpy(returnable, gearman_c_str(result), gearman_size(result)); + returnable[gearman_size(result)]= 0; + *result_size= gearman_size(result); + } + } + else + { + gearman_string_t result= gearman_result_take_string(do_task_ptr->result_ptr); + *result_size= gearman_size(result); + returnable= const_cast(gearman_c_str(result)); + } + } + else // NULL job + { + *result_size= 0; + } + } + else // gearman_client_run_tasks() was successful, but the task was not + { + gearman_error(client->universal, do_task_ptr->result_rc, "occured during gearman_client_run_tasks()"); + + *ret_ptr= do_task_ptr->result_rc; + *result_size= 0; + } + + gearman_task_free(&do_task); + client->new_tasks= 0; + client->running_tasks= 0; + + return returnable; +} + +static gearman_return_t _client_do_background(gearman_client_st *client, + gearman_command_t command, + gearman_string_t &function, + gearman_unique_t &unique, + gearman_string_t &workload, + gearman_job_handle_t job_handle) +{ + if (not client) + { + errno= EINVAL; + return GEARMAN_INVALID_ARGUMENT; + } + + if (gearman_size(function) == 0) + { + return gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function arguement was empty"); + } + + client->_do_handle[0]= 0; // Reset the job_handle we store in client + + gearman_task_st do_task, *do_task_ptr; + do_task_ptr= add_task(client, &do_task, + client, + command, + function, + unique, + workload, + time_t(0), + gearman_actions_do_default()); + if (not do_task_ptr) + { + return gearman_universal_error_code(client->universal); + } + do_task_ptr->type= GEARMAN_TASK_KIND_DO; + + gearman_return_t ret; + do { + ret= gearman_client_run_tasks(client); + + // If either of the following is ever true, we will end up in an + // infinite loop + assert(ret != GEARMAN_IN_PROGRESS and ret != GEARMAN_JOB_EXISTS); + + } while (gearman_continue(ret)); + + if (job_handle) + { + strncpy(job_handle, do_task.job_handle, GEARMAN_JOB_HANDLE_SIZE); + } + strncpy(client->_do_handle, do_task.job_handle, GEARMAN_JOB_HANDLE_SIZE); + client->new_tasks= 0; + client->running_tasks= 0; + gearman_task_free(&do_task); + + return ret; +} + +bool gearman_client_compare(const gearman_client_st *first, const gearman_client_st *second) +{ + if (not first || not second) + return false; + + if (strcmp(first->universal.con_list->host, second->universal.con_list->host)) + return false; + + if (first->universal.con_list->port != second->universal.con_list->port) + return false; + + return true; +} + +bool gearman_client_set_server_option(gearman_client_st *self, const char *option_arg, size_t option_arg_size) +{ + if (not self) + return false; + + gearman_string_t option= { option_arg, option_arg_size }; + + return gearman_request_option(self->universal, option); +} + +void gearman_client_set_namespace(gearman_client_st *self, const char *namespace_key, size_t namespace_key_size) +{ + if (not self) + return; + + gearman_universal_set_namespace(self->universal, namespace_key, namespace_key_size); +} diff -Nru gearmand-0.14/libgearman/client.h gearmand-0.23/libgearman/client.h --- gearmand-0.14/libgearman/client.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/client.h 2011-06-22 17:48:39.000000000 +0200 @@ -1,9 +1,39 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ /** @@ -11,15 +41,9 @@ * @brief Client Declarations */ -#ifndef __GEARMAN_CLIENT_H__ -#define __GEARMAN_CLIENT_H__ +#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_client Client Declarations +/** @addtogroup gearman_client Client Declarations * * This is the interface gearman clients should use. You can run tasks one at a * time or concurrently. @@ -28,6 +52,12 @@ * @{ */ +enum gearman_client_t { + GEARMAN_CLIENT_STATE_IDLE, + GEARMAN_CLIENT_STATE_NEW, + GEARMAN_CLIENT_STATE_SUBMIT, + GEARMAN_CLIENT_STATE_PACKET +}; /** * @ingroup gearman_client @@ -35,42 +65,30 @@ struct gearman_client_st { struct { - bool allocated LIBGEARMAN_BITFIELD; - bool non_blocking LIBGEARMAN_BITFIELD; - bool task_in_use LIBGEARMAN_BITFIELD; - bool unbuffered_result LIBGEARMAN_BITFIELD; - bool no_new LIBGEARMAN_BITFIELD; - bool free_tasks LIBGEARMAN_BITFIELD; + bool allocated; + bool non_blocking; + bool unbuffered_result; + bool no_new; + bool free_tasks; } options; - enum { - GEARMAN_CLIENT_STATE_IDLE, - GEARMAN_CLIENT_STATE_NEW, - GEARMAN_CLIENT_STATE_SUBMIT, - GEARMAN_CLIENT_STATE_PACKET - } state; - gearman_return_t do_ret; + enum gearman_client_t state; uint32_t new_tasks; uint32_t running_tasks; uint32_t task_count; - size_t do_data_size; void *context; gearman_connection_st *con; gearman_task_st *task; gearman_task_st *task_list; gearman_task_context_free_fn *task_context_free_fn; - void *do_data; - gearman_workload_fn *workload_fn; - gearman_created_fn *created_fn; - gearman_data_fn *data_fn; - gearman_warning_fn *warning_fn; - gearman_universal_status_fn *status_fn; - gearman_complete_fn *complete_fn; - gearman_exception_fn *exception_fn; - gearman_fail_fn *fail_fn; - gearman_universal_st universal; - gearman_task_st do_task; + struct gearman_universal_st universal; + struct gearman_actions_t actions; + gearman_job_handle_t _do_handle; // Backwards compatible }; +#ifdef __cplusplus +extern "C" { +#endif + /** * Initialize a client structure. Always check the return value even if passing * in a pre-allocated structure. Some other initialization may have failed. It @@ -147,6 +165,10 @@ void gearman_client_add_options(gearman_client_st *client, gearman_client_options_t options); +GEARMAN_API + bool gearman_client_has_option(gearman_client_st *client, + gearman_client_options_t option); + /** * Remove options for a client structure. * @@ -214,6 +236,15 @@ gearman_free_fn *function, void *context); + +GEARMAN_API + gearman_return_t gearman_client_set_memory_allocators(gearman_client_st *, + gearman_malloc_fn *malloc_fn, + gearman_free_fn *free_fn, + gearman_realloc_fn *realloc_fn, + gearman_calloc_fn *calloc_fn, + void *context); + /** * Add a job server to a client. This goes into a list of servers that can be * used to run tasks. No socket I/O happens here, it is just added to a list. @@ -233,7 +264,7 @@ * SERVER[:PORT][,SERVER[:PORT]]... * Some examples are: * 10.0.0.1,10.0.0.2,10.0.0.3 - * localhost LIBGEARMAN_BITFIELD234,jobserver2.domain.com:7003,10.0.0.3 + * localhost234,jobserver2.domain.com:7003,10.0.0.3 * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). @@ -332,17 +363,9 @@ * handle. */ GEARMAN_API -const char *gearman_client_do_job_handle(const gearman_client_st *client); +const char *gearman_client_do_job_handle(gearman_client_st *client); -/** - * Get the status for the running task. This should be used between - * repeated gearman_client_do() (and related) calls to get information. - * - * @param[in] client Structure previously initialized with - * gearman_client_create() or gearman_client_clone(). - * @param[out] numerator Optional parameter to store the numerator in. - * @param[out] denominator Optional parameter to store the denominator in. - */ +// Deprecatd GEARMAN_API void gearman_client_do_status(gearman_client_st *client, uint32_t *numerator, uint32_t *denominator); @@ -366,7 +389,7 @@ const char *unique, const void *workload, size_t workload_size, - char *job_handle); + gearman_job_handle_t job_handle); /** * Run a high priority task in the background. See @@ -378,7 +401,7 @@ const char *unique, const void *workload, size_t workload_size, - char *job_handle); + gearman_job_handle_t job_handle); /** * Run a low priority task in the background. See @@ -390,7 +413,7 @@ const char *unique, const void *workload, size_t workload_size, - char *job_handle); + gearman_job_handle_t job_handle); /** * Get the status for a backgound job. @@ -406,7 +429,7 @@ */ GEARMAN_API gearman_return_t gearman_client_job_status(gearman_client_st *client, - const char *job_handle, + const gearman_job_handle_t job_handle, bool *is_known, bool *is_running, uint32_t *numerator, uint32_t *denominator); @@ -458,6 +481,7 @@ void gearman_client_set_task_context_free_fn(gearman_client_st *client, gearman_task_context_free_fn *function); + /** * Add a task to be run in parallel. * @@ -681,10 +705,23 @@ GEARMAN_API gearman_return_t gearman_client_run_tasks(gearman_client_st *client); +GEARMAN_LOCAL +gearman_return_t gearman_client_run_block_tasks(gearman_client_st *client); + +GEARMAN_API +bool gearman_client_compare(const gearman_client_st *first, const gearman_client_st *second); + +GEARMAN_API +bool gearman_client_set_server_option(gearman_client_st *self, const char *option_arg, size_t option_arg_size); + +GEARMAN_LOCAL +size_t gearman_client_count_tasks(gearman_client_st *client); + +GEARMAN_API +void gearman_client_set_namespace(gearman_client_st *self, const char *namespace_key, size_t namespace_key_size); + /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_CLIENT_H__ */ diff -Nru gearmand-0.14/libgearman/command.cc gearmand-0.23/libgearman/command.cc --- gearmand-0.14/libgearman/command.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/command.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,96 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +/** + * Command info. Update GEARMAN_MAX_COMMAND_ARGS to the largest number in the + * args column. + */ +gearman_command_info_st gearmand_command_info_list[GEARMAN_COMMAND_MAX]= +{ + { "TEXT", 3, false }, + { "CAN_DO", 1, false }, + { "CANT_DO", 1, false }, + { "RESET_ABILITIES", 0, false }, + { "PRE_SLEEP", 0, false }, + { "UNUSED", 0, false }, + { "NOOP", 0, false }, + { "SUBMIT_JOB", 2, true }, + { "JOB_CREATED", 1, false }, + { "GRAB_JOB", 0, false }, + { "NO_JOB", 0, false }, + { "JOB_ASSIGN", 2, true }, + { "WORK_STATUS", 3, false }, + { "WORK_COMPLETE", 1, true }, + { "WORK_FAIL", 1, false }, + { "GET_STATUS", 1, false }, + { "ECHO_REQ", 0, true }, + { "ECHO_RES", 0, true }, + { "SUBMIT_JOB_BG", 2, true }, + { "ERROR", 2, false }, + { "STATUS_RES", 5, false }, + { "SUBMIT_JOB_HIGH", 2, true }, + { "SET_CLIENT_ID", 1, false }, + { "CAN_DO_TIMEOUT", 2, false }, + { "ALL_YOURS", 0, false }, + { "WORK_EXCEPTION", 1, true }, + { "OPTION_REQ", 1, false }, + { "OPTION_RES", 1, false }, + { "WORK_DATA", 1, true }, + { "WORK_WARNING", 1, true }, + { "GRAB_JOB_UNIQ", 0, false }, + { "JOB_ASSIGN_UNIQ", 3, true }, + { "SUBMIT_JOB_HIGH_BG", 2, true }, + { "SUBMIT_JOB_LOW", 2, true }, + { "SUBMIT_JOB_LOW_BG", 2, true }, + { "SUBMIT_JOB_SCHED", 7, true }, + { "SUBMIT_JOB_EPOCH", 3, true }, + { "GEARMAN_COMMAND_SUBMIT_REDUCE_JOB", 4, true }, + { "GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND", 4, true }, + { "GEARMAN_COMMAND_GRAB_JOB_ALL", 0, false }, + { "GEARMAN_COMMAND_JOB_ASSIGN_ALL", 4, true } +}; + +gearman_command_info_st *gearman_command_info(gearman_command_t command) +{ + return &gearmand_command_info_list[command]; +} diff -Nru gearmand-0.14/libgearman/command.h gearmand-0.23/libgearman/command.h --- gearmand-0.14/libgearman/command.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/command.h 2011-06-29 22:18:02.000000000 +0200 @@ -1,37 +1,60 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Definition for gearman_command_info_st - */ -#ifndef __GEARMAN_COMMAND_H__ -#define __GEARMAN_COMMAND_H__ +#pragma once -#ifdef __cplusplus -extern "C" { -#endif +#include -#ifdef GEARMAN_CORE -/** - * @ingroup gearman_packet - */ struct gearman_command_info_st { const char *name; const uint8_t argc; // Number of arguments to commands. const bool data; }; -#endif /* GEARMAN_CORE */ #ifdef __cplusplus -} +extern "C" { #endif -#endif /* __GEARMAN_COMMAND_H__ */ +GEARMAN_LOCAL + struct gearman_command_info_st *gearman_command_info(gearman_command_t command); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/common.h gearmand-0.23/libgearman/common.h --- gearmand-0.14/libgearman/common.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/common.h 2011-06-29 22:18:02.000000000 +0200 @@ -1,90 +1,60 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief System Include Files */ -#ifndef __GEARMAN_COMMON_H__ -#define __GEARMAN_COMMON_H__ -#include "config.h" +#pragma once -#ifdef HAVE_ASSERT_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_GETOPT_H -#include -#endif -#ifdef HAVE_PTHREAD -#include -#endif -#ifdef HAVE_STDARG_H -#include -#endif -#ifdef HAVE_STDDEF_H -#include -#endif -#ifdef HAVE_STDIO_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif -#ifdef HAVE_SYS_UTSNAME_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_NETINET_TCP_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_UUID_UUID_H -#include -#endif - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif +#include -#include -#include +#include +#include -#define BUILDING_LIBGEARMAN -#define GEARMAN_CORE +#include +#include -#include "gearman.h" +#include /* These are private not to be installed headers */ -#include "libgearman/byteorder.h" - -#endif /* __GEARMAN_COMMON_H__ */ +#include +#include +#include +#include +#include +#include +#include +#include diff -Nru gearmand-0.14/libgearman/configure.h gearmand-0.23/libgearman/configure.h --- gearmand-0.14/libgearman/configure.h 2010-06-30 20:31:42.000000000 +0200 +++ gearmand-0.23/libgearman/configure.h 2011-04-28 19:44:27.000000000 +0200 @@ -1,34 +1,41 @@ -/* Gearman - * Copyright (C) 2010 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. * - * Summary: Autogenerated file for configure bits. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __GEARMAN_CONFIGURE_H__ -#define __GEARMAN_CONFIGURE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define LIBGEARMAN_OPTIMIZE_BITFIELD 1 - -#if LIBGEARMAN_OPTIMIZE_BITFIELD == 1 -#define LIBGEARMAN_BITFIELD :1 -#else -#define LIBGEARMAN_BITFIELD -#endif - -#define LIBGEARMAN_VERSION_STRING "0.14" -#define LIBGEARMAN_VERSION_HEX 0x00014000 - -#ifdef __cplusplus -} -#endif +#pragma once -#endif /* __GEARMAN_CONFIGURE_H__ */ +#include diff -Nru gearmand-0.14/libgearman/configure.h.in gearmand-0.23/libgearman/configure.h.in --- gearmand-0.14/libgearman/configure.h.in 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/configure.h.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,34 +0,0 @@ -/* Gearman - * Copyright (C) 2010 Brian Aker - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - * - * Summary: Autogenerated file for configure bits. - * - */ - -#ifndef __GEARMAN_CONFIGURE_H__ -#define __GEARMAN_CONFIGURE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define LIBGEARMAN_OPTIMIZE_BITFIELD @PANDORA_OPTIMIZE_BITFIELD@ - -#if LIBGEARMAN_OPTIMIZE_BITFIELD == 1 -#define LIBGEARMAN_BITFIELD :1 -#else -#define LIBGEARMAN_BITFIELD -#endif - -#define LIBGEARMAN_VERSION_STRING "@VERSION@" -#define LIBGEARMAN_VERSION_HEX @PANDORA_HEX_VERSION@ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_CONFIGURE_H__ */ diff -Nru gearmand-0.14/libgearman/connection.c gearmand-0.23/libgearman/connection.c --- gearmand-0.14/libgearman/connection.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/connection.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1072 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Connection Definitions - */ - -#include "common.h" - -static void gearman_connection_reset_addrinfo(gearman_connection_st *connection); - - -/** - * @addtogroup gearman_connection_static Static Connection Declarations - * @ingroup gearman_connection - * @{ - */ - - -gearman_connection_st *gearman_connection_create(gearman_universal_st *gearman, - gearman_connection_st *connection, - gearman_connection_options_t *options) -{ - if (connection == NULL) - { - connection= malloc(sizeof(gearman_connection_st)); - if (connection == NULL) - { - gearman_universal_set_error(gearman, "gearman_connection_create", "malloc"); - return NULL; - } - - connection->options.allocated= true; - } - else - { - connection->options.allocated= false; - } - - connection->options.ready= false; - connection->options.packet_in_use= false; - connection->options.external_fd= false; - connection->options.ignore_lost_connection= false; - connection->options.close_after_flush= false; - - if (options) - { - while (*options != GEARMAN_CON_MAX) - { - gearman_connection_set_option(connection, *options, true); - options++; - } - } - - - connection->state= 0; - connection->send_state= 0; - connection->recv_state= 0; - connection->port= 0; - connection->events= 0; - connection->revents= 0; - connection->fd= -1; - connection->created_id= 0; - connection->created_id_next= 0; - connection->send_buffer_size= 0; - connection->send_data_size= 0; - connection->send_data_offset= 0; - connection->recv_buffer_size= 0; - connection->recv_data_size= 0; - connection->recv_data_offset= 0; - connection->universal= gearman; - - if (gearman->con_list != NULL) - gearman->con_list->prev= connection; - connection->next= gearman->con_list; - connection->prev= NULL; - gearman->con_list= connection; - gearman->con_count++; - - connection->context= NULL; - connection->addrinfo= NULL; - connection->addrinfo_next= NULL; - connection->send_buffer_ptr= connection->send_buffer; - connection->recv_packet= NULL; - connection->recv_buffer_ptr= connection->recv_buffer; - connection->protocol_context= NULL; - connection->protocol_context_free_fn= NULL; - connection->packet_pack_fn= gearman_packet_pack; - connection->packet_unpack_fn= gearman_packet_unpack; - connection->host[0]= 0; - - return connection; -} - -gearman_connection_st *gearman_connection_create_args(gearman_universal_st *gearman, gearman_connection_st *connection, - const char *host, in_port_t port) -{ - connection= gearman_connection_create(gearman, connection, NULL); - if (connection == NULL) - return NULL; - - gearman_connection_set_host(connection, host, port); - - return connection; -} - -gearman_connection_st *gearman_connection_clone(gearman_universal_st *gearman, gearman_connection_st *connection, - const gearman_connection_st *from) -{ - connection= gearman_connection_create(gearman, connection, NULL); - - if (from == NULL || connection == NULL) - return connection; - - connection->options.ready= from->options.ready; - connection->options.packet_in_use= from->options.packet_in_use; - connection->options.external_fd= from->options.external_fd; - connection->options.ignore_lost_connection= from->options.ignore_lost_connection; - connection->options.close_after_flush= from->options.close_after_flush; - - strcpy(connection->host, from->host); - connection->port= from->port; - - return connection; -} - -void gearman_connection_free(gearman_connection_st *connection) -{ - if (connection->fd != -1) - gearman_connection_close(connection); - - gearman_connection_reset_addrinfo(connection); - - if (connection->protocol_context != NULL && connection->protocol_context_free_fn != NULL) - connection->protocol_context_free_fn(connection, (void *)connection->protocol_context); - - if (connection->universal->con_list == connection) - connection->universal->con_list= connection->next; - if (connection->prev != NULL) - connection->prev->next= connection->next; - if (connection->next != NULL) - connection->next->prev= connection->prev; - connection->universal->con_count--; - - if (connection->options.packet_in_use) - gearman_packet_free(&(connection->packet)); - - if (connection->options.allocated) - free(connection); -} - -gearman_return_t gearman_connection_set_option(gearman_connection_st *connection, - gearman_connection_options_t options, - bool value) -{ - switch (options) - { - case GEARMAN_CON_READY: - connection->options.ready= value; - break; - case GEARMAN_CON_PACKET_IN_USE: - connection->options.packet_in_use= value; - break; - case GEARMAN_CON_EXTERNAL_FD: - connection->options.external_fd= value; - break; - case GEARMAN_CON_IGNORE_LOST_CONNECTION: - connection->options.ignore_lost_connection= value; - break; - case GEARMAN_CON_CLOSE_AFTER_FLUSH: - connection->options.close_after_flush= value; - break; - case GEARMAN_CON_MAX: - default: - return GEARMAN_INVALID_COMMAND; - } - - return GEARMAN_SUCCESS; -} - -/** - * Set socket options for a connection. - */ -static gearman_return_t _con_setsockopt(gearman_connection_st *connection); - -/** @} */ - -/* - * Public Definitions - */ - -void gearman_connection_set_host(gearman_connection_st *connection, - const char *host, - in_port_t port) -{ - gearman_connection_reset_addrinfo(connection); - - strncpy(connection->host, host == NULL ? GEARMAN_DEFAULT_TCP_HOST : host, - NI_MAXHOST); - connection->host[NI_MAXHOST - 1]= 0; - - connection->port= (in_port_t)(port == 0 ? GEARMAN_DEFAULT_TCP_PORT : port); -} - -gearman_return_t gearman_connection_set_fd(gearman_connection_st *connection, int fd) -{ - gearman_return_t ret; - - connection->options.external_fd= true; - connection->fd= fd; - connection->state= GEARMAN_CON_UNIVERSAL_CONNECTED; - - ret= _con_setsockopt(connection); - if (ret != GEARMAN_SUCCESS) - { - connection->universal->last_errno= errno; - return ret; - } - - return GEARMAN_SUCCESS; -} - -void *gearman_connection_context(const gearman_connection_st *connection) -{ - return connection->context; -} - -void gearman_connection_set_context(gearman_connection_st *connection, void *context) -{ - connection->context= context; -} - -gearman_return_t gearman_connection_connect(gearman_connection_st *connection) -{ - return gearman_connection_flush(connection); -} - -void gearman_connection_close(gearman_connection_st *connection) -{ - if (connection->fd == -1) - return; - - if (connection->options.external_fd) - connection->options.external_fd= false; - else - (void)close(connection->fd); - - connection->state= GEARMAN_CON_UNIVERSAL_ADDRINFO; - connection->fd= -1; - connection->events= 0; - connection->revents= 0; - - connection->send_state= GEARMAN_CON_SEND_STATE_NONE; - connection->send_buffer_ptr= connection->send_buffer; - connection->send_buffer_size= 0; - connection->send_data_size= 0; - connection->send_data_offset= 0; - - connection->recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; - if (connection->recv_packet != NULL) - { - gearman_packet_free(connection->recv_packet); - connection->recv_packet= NULL; - } - - connection->recv_buffer_ptr= connection->recv_buffer; - connection->recv_buffer_size= 0; -} - -void gearman_connection_reset_addrinfo(gearman_connection_st *connection) -{ - if (connection->addrinfo != NULL) - { - freeaddrinfo(connection->addrinfo); - connection->addrinfo= NULL; - } - - connection->addrinfo_next= NULL; -} - -gearman_return_t gearman_connection_send(gearman_connection_st *connection, - const gearman_packet_st *packet, bool flush) -{ - gearman_return_t ret; - size_t send_size; - - switch (connection->send_state) - { - case GEARMAN_CON_SEND_STATE_NONE: - if (! (packet->options.complete)) - { - gearman_universal_set_error(connection->universal, "gearman_connection_send", - "packet not complete"); - return GEARMAN_INVALID_PACKET; - } - - /* Pack first part of packet, which is everything but the payload. */ - while (1) - { - send_size= connection->packet_pack_fn(packet, connection, - connection->send_buffer + connection->send_buffer_size, - GEARMAN_SEND_BUFFER_SIZE - - connection->send_buffer_size, &ret); - if (ret == GEARMAN_SUCCESS) - { - connection->send_buffer_size+= send_size; - break; - } - else if (ret == GEARMAN_IGNORE_PACKET) - return GEARMAN_SUCCESS; - else if (ret != GEARMAN_FLUSH_DATA) - return ret; - - /* We were asked to flush when the buffer is already flushed! */ - if (connection->send_buffer_size == 0) - { - gearman_universal_set_error(connection->universal, "gearman_connection_send", - "send buffer too small (%u)", - GEARMAN_SEND_BUFFER_SIZE); - return GEARMAN_SEND_BUFFER_TOO_SMALL; - } - - /* Flush buffer now if first part of packet won't fit in. */ - connection->send_state= GEARMAN_CON_SEND_UNIVERSAL_PRE_FLUSH; - - case GEARMAN_CON_SEND_UNIVERSAL_PRE_FLUSH: - ret= gearman_connection_flush(connection); - if (ret != GEARMAN_SUCCESS) - return ret; - } - - /* Return here if we have no data to send. */ - if (packet->data_size == 0) - break; - - /* If there is any room in the buffer, copy in data. */ - if (packet->data != NULL && - (GEARMAN_SEND_BUFFER_SIZE - connection->send_buffer_size) > 0) - { - connection->send_data_offset= GEARMAN_SEND_BUFFER_SIZE - connection->send_buffer_size; - if (connection->send_data_offset > packet->data_size) - connection->send_data_offset= packet->data_size; - - memcpy(connection->send_buffer + connection->send_buffer_size, packet->data, - connection->send_data_offset); - connection->send_buffer_size+= connection->send_data_offset; - - /* Return if all data fit in the send buffer. */ - if (connection->send_data_offset == packet->data_size) - { - connection->send_data_offset= 0; - break; - } - } - - /* Flush buffer now so we can start writing directly from data buffer. */ - connection->send_state= GEARMAN_CON_SEND_UNIVERSAL_FORCE_FLUSH; - - case GEARMAN_CON_SEND_UNIVERSAL_FORCE_FLUSH: - ret= gearman_connection_flush(connection); - if (ret != GEARMAN_SUCCESS) - return ret; - - connection->send_data_size= packet->data_size; - - /* If this is NULL, then gearman_connection_send_data function will be used. */ - if (packet->data == NULL) - { - connection->send_state= GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA; - return GEARMAN_SUCCESS; - } - - /* Copy into the buffer if it fits, otherwise flush from packet buffer. */ - connection->send_buffer_size= packet->data_size - connection->send_data_offset; - if (connection->send_buffer_size < GEARMAN_SEND_BUFFER_SIZE) - { - memcpy(connection->send_buffer, - (char *)packet->data + connection->send_data_offset, - connection->send_buffer_size); - connection->send_data_size= 0; - connection->send_data_offset= 0; - break; - } - - connection->send_buffer_ptr= (char *)packet->data + connection->send_data_offset; - connection->send_state= GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA; - - case GEARMAN_CON_SEND_UNIVERSAL_FLUSH: - case GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA: - ret= gearman_connection_flush(connection); - if (ret == GEARMAN_SUCCESS && connection->options.close_after_flush) - { - gearman_connection_close(connection); - ret= GEARMAN_LOST_CONNECTION; - } - return ret; - - default: - gearman_universal_set_error(connection->universal, "gearman_connection_send", "unknown state: %u", - connection->send_state); - return GEARMAN_UNKNOWN_STATE; - } - - if (flush) - { - connection->send_state= GEARMAN_CON_SEND_UNIVERSAL_FLUSH; - ret= gearman_connection_flush(connection); - if (ret == GEARMAN_SUCCESS && connection->options.close_after_flush) - { - gearman_connection_close(connection); - ret= GEARMAN_LOST_CONNECTION; - } - return ret; - } - - connection->send_state= GEARMAN_CON_SEND_STATE_NONE; - return GEARMAN_SUCCESS; -} - -size_t gearman_connection_send_data(gearman_connection_st *connection, const void *data, - size_t data_size, gearman_return_t *ret_ptr) -{ - if (connection->send_state != GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA) - { - gearman_universal_set_error(connection->universal, "gearman_connection_send_data", "not flushing"); - return GEARMAN_NOT_FLUSHING; - } - - if (data_size > (connection->send_data_size - connection->send_data_offset)) - { - gearman_universal_set_error(connection->universal, "gearman_connection_send_data", "data too large"); - return GEARMAN_DATA_TOO_LARGE; - } - - connection->send_buffer_ptr= (char *)data; - connection->send_buffer_size= data_size; - - *ret_ptr= gearman_connection_flush(connection); - - return data_size - connection->send_buffer_size; -} - -gearman_return_t gearman_connection_flush(gearman_connection_st *connection) -{ - char port_str[NI_MAXSERV]; - struct addrinfo ai; - int ret; - ssize_t write_size; - gearman_return_t gret; - - while (1) - { - switch (connection->state) - { - case GEARMAN_CON_UNIVERSAL_ADDRINFO: - if (connection->addrinfo != NULL) - { - freeaddrinfo(connection->addrinfo); - connection->addrinfo= NULL; - } - - snprintf(port_str, NI_MAXSERV, "%hu", (uint16_t)connection->port); - - memset(&ai, 0, sizeof(struct addrinfo)); - ai.ai_socktype= SOCK_STREAM; - ai.ai_protocol= IPPROTO_TCP; - - ret= getaddrinfo(connection->host, port_str, &ai, &(connection->addrinfo)); - if (ret != 0) - { - gearman_universal_set_error(connection->universal, "gearman_connection_flush", "getaddrinfo:%s", - gai_strerror(ret)); - return GEARMAN_GETADDRINFO; - } - - connection->addrinfo_next= connection->addrinfo; - - case GEARMAN_CON_UNIVERSAL_CONNECT: - if (connection->fd != -1) - gearman_connection_close(connection); - - if (connection->addrinfo_next == NULL) - { - connection->state= GEARMAN_CON_UNIVERSAL_ADDRINFO; - gearman_universal_set_error(connection->universal, "gearman_connection_flush", - "could not connect"); - return GEARMAN_COULD_NOT_CONNECT; - } - - connection->fd= socket(connection->addrinfo_next->ai_family, - connection->addrinfo_next->ai_socktype, - connection->addrinfo_next->ai_protocol); - if (connection->fd == -1) - { - connection->state= GEARMAN_CON_UNIVERSAL_ADDRINFO; - gearman_universal_set_error(connection->universal, "gearman_connection_flush", "socket:%d", - errno); - connection->universal->last_errno= errno; - return GEARMAN_ERRNO; - } - - gret= _con_setsockopt(connection); - if (gret != GEARMAN_SUCCESS) - { - connection->universal->last_errno= errno; - gearman_connection_close(connection); - return gret; - } - - while (1) - { - ret= connect(connection->fd, connection->addrinfo_next->ai_addr, - connection->addrinfo_next->ai_addrlen); - if (ret == 0) - { - connection->state= GEARMAN_CON_UNIVERSAL_CONNECTED; - connection->addrinfo_next= NULL; - break; - } - - if (errno == EAGAIN || errno == EINTR) - continue; - - if (errno == EINPROGRESS) - { - connection->state= GEARMAN_CON_UNIVERSAL_CONNECTING; - break; - } - - if (errno == ECONNREFUSED || errno == ENETUNREACH || errno == ETIMEDOUT) - { - connection->state= GEARMAN_CON_UNIVERSAL_CONNECT; - connection->addrinfo_next= connection->addrinfo_next->ai_next; - break; - } - - gearman_universal_set_error(connection->universal, "gearman_connection_flush", "connect:%d", - errno); - connection->universal->last_errno= errno; - gearman_connection_close(connection); - return GEARMAN_ERRNO; - } - - if (connection->state != GEARMAN_CON_UNIVERSAL_CONNECTING) - break; - - case GEARMAN_CON_UNIVERSAL_CONNECTING: - while (1) - { - if (connection->revents & POLLOUT) - { - connection->state= GEARMAN_CON_UNIVERSAL_CONNECTED; - break; - } - else if (connection->revents & (POLLERR | POLLHUP | POLLNVAL)) - { - connection->state= GEARMAN_CON_UNIVERSAL_CONNECT; - connection->addrinfo_next= connection->addrinfo_next->ai_next; - break; - } - - gret= gearman_connection_set_events(connection, POLLOUT); - if (gret != GEARMAN_SUCCESS) - return gret; - - if (gearman_universal_is_non_blocking(connection->universal)) - { - connection->state= GEARMAN_CON_UNIVERSAL_CONNECTING; - return GEARMAN_IO_WAIT; - } - - gret= gearman_wait(connection->universal); - if (gret != GEARMAN_SUCCESS) - return gret; - } - - if (connection->state != GEARMAN_CON_UNIVERSAL_CONNECTED) - break; - - case GEARMAN_CON_UNIVERSAL_CONNECTED: - while (connection->send_buffer_size != 0) - { - write_size= write(connection->fd, connection->send_buffer_ptr, connection->send_buffer_size); - if (write_size == 0) - { - if (! (connection->options.ignore_lost_connection)) - { - gearman_universal_set_error(connection->universal, "gearman_connection_flush", - "lost connection to server (EOF)"); - } - gearman_connection_close(connection); - return GEARMAN_LOST_CONNECTION; - } - else if (write_size == -1) - { - if (errno == EAGAIN) - { - gret= gearman_connection_set_events(connection, POLLOUT); - if (gret != GEARMAN_SUCCESS) - return gret; - - if (gearman_universal_is_non_blocking(connection->universal)) - return GEARMAN_IO_WAIT; - - gret= gearman_wait(connection->universal); - if (gret != GEARMAN_SUCCESS) - return gret; - - continue; - } - else if (errno == EINTR) - continue; - else if (errno == EPIPE || errno == ECONNRESET || errno == EHOSTDOWN) - { - if (! (connection->options.ignore_lost_connection)) - { - gearman_universal_set_error(connection->universal, "gearman_connection_flush", - "lost connection to server (%d)", errno); - } - gearman_connection_close(connection); - return GEARMAN_LOST_CONNECTION; - } - - gearman_universal_set_error(connection->universal, "gearman_connection_flush", "write:%d", - errno); - connection->universal->last_errno= errno; - gearman_connection_close(connection); - return GEARMAN_ERRNO; - } - - connection->send_buffer_size-= (size_t)write_size; - if (connection->send_state == GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA) - { - connection->send_data_offset+= (size_t)write_size; - if (connection->send_data_offset == connection->send_data_size) - { - connection->send_data_size= 0; - connection->send_data_offset= 0; - break; - } - - if (connection->send_buffer_size == 0) - return GEARMAN_SUCCESS; - } - else if (connection->send_buffer_size == 0) - break; - - connection->send_buffer_ptr+= write_size; - } - - connection->send_state= GEARMAN_CON_SEND_STATE_NONE; - connection->send_buffer_ptr= connection->send_buffer; - return GEARMAN_SUCCESS; - - default: - gearman_universal_set_error(connection->universal, "gearman_connection_flush", "unknown state: %u", - connection->state); - - return GEARMAN_UNKNOWN_STATE; - } - } -} - -gearman_packet_st *gearman_connection_recv(gearman_connection_st *connection, - gearman_packet_st *packet, - gearman_return_t *ret_ptr, bool recv_data) -{ - size_t recv_size; - - switch (connection->recv_state) - { - case GEARMAN_CON_RECV_UNIVERSAL_NONE: - if (connection->state != GEARMAN_CON_UNIVERSAL_CONNECTED) - { - gearman_universal_set_error(connection->universal, "gearman_connection_recv", "not connected"); - *ret_ptr= GEARMAN_NOT_CONNECTED; - return NULL; - } - - connection->recv_packet= gearman_packet_create(connection->universal, packet); - if (connection->recv_packet == NULL) - { - *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - connection->recv_state= GEARMAN_CON_RECV_UNIVERSAL_READ; - - case GEARMAN_CON_RECV_UNIVERSAL_READ: - while (1) - { - if (connection->recv_buffer_size > 0) - { - recv_size= connection->packet_unpack_fn(connection->recv_packet, connection, - connection->recv_buffer_ptr, - connection->recv_buffer_size, ret_ptr); - connection->recv_buffer_ptr+= recv_size; - connection->recv_buffer_size-= recv_size; - if (*ret_ptr == GEARMAN_SUCCESS) - break; - else if (*ret_ptr != GEARMAN_IO_WAIT) - { - gearman_connection_close(connection); - return NULL; - } - } - - /* Shift buffer contents if needed. */ - if (connection->recv_buffer_size > 0) - memmove(connection->recv_buffer, connection->recv_buffer_ptr, connection->recv_buffer_size); - connection->recv_buffer_ptr= connection->recv_buffer; - - recv_size= gearman_connection_read(connection, connection->recv_buffer + connection->recv_buffer_size, - GEARMAN_RECV_BUFFER_SIZE - connection->recv_buffer_size, - ret_ptr); - if (*ret_ptr != GEARMAN_SUCCESS) - return NULL; - - connection->recv_buffer_size+= recv_size; - } - - if (packet->data_size == 0) - { - connection->recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; - break; - } - - connection->recv_data_size= packet->data_size; - - if (!recv_data) - { - connection->recv_state= GEARMAN_CON_RECV_STATE_READ_DATA; - break; - } - - if (packet->universal->workload_malloc_fn == NULL) - { - packet->data= malloc(packet->data_size); - } - else - { - packet->data= packet->universal->workload_malloc_fn(packet->data_size, - (void *)packet->universal->workload_malloc_context); - } - if (packet->data == NULL) - { - *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; - gearman_connection_close(connection); - return NULL; - } - - packet->options.free_data= true; - connection->recv_state= GEARMAN_CON_RECV_STATE_READ_DATA; - - case GEARMAN_CON_RECV_STATE_READ_DATA: - while (connection->recv_data_size != 0) - { - (void)gearman_connection_recv_data(connection, - ((uint8_t *)(packet->data)) + - connection->recv_data_offset, - packet->data_size - - connection->recv_data_offset, ret_ptr); - if (*ret_ptr != GEARMAN_SUCCESS) - return NULL; - } - - connection->recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; - break; - - default: - gearman_universal_set_error(connection->universal, "gearman_connection_recv", "unknown state: %u", - connection->recv_state); - *ret_ptr= GEARMAN_UNKNOWN_STATE; - return NULL; - } - - packet= connection->recv_packet; - connection->recv_packet= NULL; - - return packet; -} - -size_t gearman_connection_recv_data(gearman_connection_st *connection, void *data, size_t data_size, - gearman_return_t *ret_ptr) -{ - size_t recv_size= 0; - - if (connection->recv_data_size == 0) - { - *ret_ptr= GEARMAN_SUCCESS; - return 0; - } - - if ((connection->recv_data_size - connection->recv_data_offset) < data_size) - data_size= connection->recv_data_size - connection->recv_data_offset; - - if (connection->recv_buffer_size > 0) - { - if (connection->recv_buffer_size < data_size) - recv_size= connection->recv_buffer_size; - else - recv_size= data_size; - - memcpy(data, connection->recv_buffer_ptr, recv_size); - connection->recv_buffer_ptr+= recv_size; - connection->recv_buffer_size-= recv_size; - } - - if (data_size != recv_size) - { - recv_size+= gearman_connection_read(connection, ((uint8_t *)data) + recv_size, - data_size - recv_size, ret_ptr); - connection->recv_data_offset+= recv_size; - } - else - { - connection->recv_data_offset+= recv_size; - *ret_ptr= GEARMAN_SUCCESS; - } - - if (connection->recv_data_size == connection->recv_data_offset) - { - connection->recv_data_size= 0; - connection->recv_data_offset= 0; - connection->recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; - } - - return recv_size; -} - -size_t gearman_connection_read(gearman_connection_st *connection, void *data, size_t data_size, - gearman_return_t *ret_ptr) -{ - ssize_t read_size; - - while (1) - { - read_size= read(connection->fd, data, data_size); - if (read_size == 0) - { - if (! (connection->options.ignore_lost_connection)) - { - gearman_universal_set_error(connection->universal, "gearman_connection_read", - "lost connection to server (EOF)"); - } - gearman_connection_close(connection); - *ret_ptr= GEARMAN_LOST_CONNECTION; - return 0; - } - else if (read_size == -1) - { - if (errno == EAGAIN) - { - *ret_ptr= gearman_connection_set_events(connection, POLLIN); - if (*ret_ptr != GEARMAN_SUCCESS) - return 0; - - if (gearman_universal_is_non_blocking(connection->universal)) - { - *ret_ptr= GEARMAN_IO_WAIT; - return 0; - } - - *ret_ptr= gearman_wait(connection->universal); - if (*ret_ptr != GEARMAN_SUCCESS) - return 0; - - continue; - } - else if (errno == EINTR) - continue; - else if (errno == EPIPE || errno == ECONNRESET || errno == EHOSTDOWN) - { - if (! (connection->options.ignore_lost_connection)) - { - gearman_universal_set_error(connection->universal, "gearman_connection_read", - "lost connection to server (%d)", errno); - } - *ret_ptr= GEARMAN_LOST_CONNECTION; - } - else - { - gearman_universal_set_error(connection->universal, "gearman_connection_read", "read:%d", errno); - connection->universal->last_errno= errno; - *ret_ptr= GEARMAN_ERRNO; - } - - gearman_connection_close(connection); - return 0; - } - - break; - } - - *ret_ptr= GEARMAN_SUCCESS; - return (size_t)read_size; -} - -gearman_return_t gearman_connection_set_events(gearman_connection_st *connection, short events) -{ - gearman_return_t ret; - - if ((connection->events | events) == connection->events) - return GEARMAN_SUCCESS; - - connection->events|= events; - - if (connection->universal->event_watch_fn != NULL) - { - ret= connection->universal->event_watch_fn(connection, connection->events, - (void *)connection->universal->event_watch_context); - if (ret != GEARMAN_SUCCESS) - { - gearman_connection_close(connection); - return ret; - } - } - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_connection_set_revents(gearman_connection_st *connection, short revents) -{ - gearman_return_t ret; - - if (revents != 0) - connection->options.ready= true; - - connection->revents= revents; - - /* Remove external POLLOUT watch if we didn't ask for it. Otherwise we spin - forever until another POLLIN state change. This is much more efficient - than removing POLLOUT on every state change since some external polling - mechanisms need to use a system call to change flags (like Linux epoll). */ - if (revents & POLLOUT && !(connection->events & POLLOUT) && - connection->universal->event_watch_fn != NULL) - { - ret= connection->universal->event_watch_fn(connection, connection->events, - (void *)connection->universal->event_watch_context); - if (ret != GEARMAN_SUCCESS) - { - gearman_connection_close(connection); - return ret; - } - } - - connection->events&= (short)~revents; - - return GEARMAN_SUCCESS; -} - -void *gearman_connection_protocol_context(const gearman_connection_st *connection) -{ - return connection->protocol_context; -} - -void gearman_connection_set_protocol_context(gearman_connection_st *connection, void *context) -{ - connection->protocol_context= context; -} - -void gearman_connection_set_protocol_context_free_fn(gearman_connection_st *connection, - gearman_connection_protocol_context_free_fn *function) -{ - connection->protocol_context_free_fn= function; -} - -void gearman_connection_set_packet_pack_fn(gearman_connection_st *connection, - gearman_packet_pack_fn *function) -{ - connection->packet_pack_fn= function; -} - -void gearman_connection_set_packet_unpack_fn(gearman_connection_st *connection, - gearman_packet_unpack_fn *function) -{ - connection->packet_unpack_fn= function; -} - -/* - * Static Definitions - */ - -static gearman_return_t _con_setsockopt(gearman_connection_st *connection) -{ - int ret; - struct linger linger; - struct timeval waittime; - - ret= 1; - ret= setsockopt(connection->fd, IPPROTO_TCP, TCP_NODELAY, &ret, - (socklen_t)sizeof(int)); - if (ret == -1 && errno != EOPNOTSUPP) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", - "setsockopt:TCP_NODELAY:%d", errno); - return GEARMAN_ERRNO; - } - - linger.l_onoff= 1; - linger.l_linger= GEARMAN_DEFAULT_SOCKET_TIMEOUT; - ret= setsockopt(connection->fd, SOL_SOCKET, SO_LINGER, &linger, - (socklen_t)sizeof(struct linger)); - if (ret == -1) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", - "setsockopt:SO_LINGER:%d", errno); - return GEARMAN_ERRNO; - } - - waittime.tv_sec= GEARMAN_DEFAULT_SOCKET_TIMEOUT; - waittime.tv_usec= 0; - ret= setsockopt(connection->fd, SOL_SOCKET, SO_SNDTIMEO, &waittime, - (socklen_t)sizeof(struct timeval)); - if (ret == -1 && errno != ENOPROTOOPT) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", - "setsockopt:SO_SNDTIMEO:%d", errno); - return GEARMAN_ERRNO; - } - - ret= setsockopt(connection->fd, SOL_SOCKET, SO_RCVTIMEO, &waittime, - (socklen_t)sizeof(struct timeval)); - if (ret == -1 && errno != ENOPROTOOPT) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", - "setsockopt:SO_RCVTIMEO:%d", errno); - return GEARMAN_ERRNO; - } - - ret= GEARMAN_DEFAULT_SOCKET_SEND_SIZE; - ret= setsockopt(connection->fd, SOL_SOCKET, SO_SNDBUF, &ret, (socklen_t)sizeof(int)); - if (ret == -1) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", - "setsockopt:SO_SNDBUF:%d", errno); - return GEARMAN_ERRNO; - } - - ret= GEARMAN_DEFAULT_SOCKET_RECV_SIZE; - ret= setsockopt(connection->fd, SOL_SOCKET, SO_RCVBUF, &ret, (socklen_t)sizeof(int)); - if (ret == -1) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", - "setsockopt:SO_RCVBUF:%d", errno); - return GEARMAN_ERRNO; - } - - ret= fcntl(connection->fd, F_GETFL, 0); - if (ret == -1) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", "fcntl:F_GETFL:%d", - errno); - return GEARMAN_ERRNO; - } - - ret= fcntl(connection->fd, F_SETFL, ret | O_NONBLOCK); - if (ret == -1) - { - gearman_universal_set_error(connection->universal, "_con_setsockopt", "fcntl:F_SETFL:%d", - errno); - return GEARMAN_ERRNO; - } - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman/connection.cc gearmand-0.23/libgearman/connection.cc --- gearmand-0.14/libgearman/connection.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/connection.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,967 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief Connection Definitions + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#if HAVE_NETINET_TCP_H +#include /* for TCP_NODELAY */ +#endif +#ifdef HAVE_FCNTL_H +#include +#endif + +static gearman_return_t gearman_connection_set_option(gearman_connection_st *connection, + gearman_connection_options_t options, + bool value); + + + + +/** + * @addtogroup gearman_connection_static Static Connection Declarations + * @ingroup gearman_connection + * @{ + */ + +gearman_connection_st::gearman_connection_st(gearman_universal_st &universal_arg, + gearman_connection_options_t *options_args) : + state(GEARMAN_CON_UNIVERSAL_ADDRINFO), + send_state(GEARMAN_CON_SEND_STATE_NONE), + recv_state(GEARMAN_CON_RECV_UNIVERSAL_NONE), + port(0), + events(0), + revents(0), + fd(-1), + cached_errno(0), + created_id(0), + created_id_next(0), + send_buffer_size(0), + send_data_size(0), + send_data_offset(0), + recv_buffer_size(0), + recv_data_size(0), + recv_data_offset(0), + universal(universal_arg) +{ + options.ready= false; + options.packet_in_use= false; + + if (options_args) + { + while (*options_args != GEARMAN_CON_MAX) + { + gearman_connection_set_option(this, *options_args, true); + options_args++; + } + } + + if (universal.con_list) + universal.con_list->prev= this; + next= universal.con_list; + prev= NULL; + universal.con_list= this; + universal.con_count++; + + context= NULL; + addrinfo= NULL; + addrinfo_next= NULL; + send_buffer_ptr= send_buffer; + recv_packet= NULL; + recv_buffer_ptr= recv_buffer; + host[0]= 0; +} + +gearman_connection_st *gearman_connection_create(gearman_universal_st &universal, + gearman_connection_options_t *options) +{ + gearman_connection_st *connection= new (std::nothrow) gearman_connection_st(universal, options); + if (not connection) + { + gearman_perror(universal, "gearman_connection_st new"); + return NULL; + } + + return connection; +} + +gearman_connection_st *gearman_connection_create_args(gearman_universal_st& universal, + const char *host, in_port_t port) +{ + gearman_connection_st *connection= gearman_connection_create(universal, NULL); + if (not connection) + return NULL; + + connection->set_host(host, port); + + return connection; +} + +gearman_connection_st *gearman_connection_copy(gearman_universal_st& universal, + const gearman_connection_st& from) +{ + gearman_connection_st *connection= gearman_connection_create(universal, NULL); + + if (not connection) + return connection; + + connection->options.ready= from.options.ready; + connection->options.packet_in_use= from.options.packet_in_use; + + strcpy(connection->host, from.host); + connection->port= from.port; + + return connection; +} + +gearman_connection_st::~gearman_connection_st() +{ + if (fd != -1) + close(); + + reset_addrinfo(); + + { // Remove from universal list + if (universal.con_list == this) + universal.con_list= next; + + if (prev) + prev->next= next; + + if (next) + next->prev= prev; + + universal.con_count--; + } + + if (options.packet_in_use) + gearman_packet_free(&(_packet)); +} + +gearman_return_t gearman_connection_set_option(gearman_connection_st *connection, + gearman_connection_options_t options, + bool value) +{ + switch (options) + { + case GEARMAN_CON_READY: + connection->options.ready= value; + break; + case GEARMAN_CON_PACKET_IN_USE: + connection->options.packet_in_use= value; + break; + case GEARMAN_CON_IGNORE_LOST_CONNECTION: + break; + case GEARMAN_CON_CLOSE_AFTER_FLUSH: + break; + case GEARMAN_CON_EXTERNAL_FD: + case GEARMAN_CON_MAX: + default: + return GEARMAN_INVALID_COMMAND; + } + + return GEARMAN_SUCCESS; +} + +/** + * Set socket options for a connection. + */ +static gearman_return_t _con_setsockopt(gearman_connection_st *connection); + +/** @} */ + +/* + * Public Definitions + */ + +void gearman_connection_st::set_host(const char *host_arg, const in_port_t port_arg) +{ + reset_addrinfo(); + + strncpy(host, host_arg == NULL ? GEARMAN_DEFAULT_TCP_HOST : host_arg, NI_MAXHOST); + host[NI_MAXHOST - 1]= 0; + + port= in_port_t(port_arg == 0 ? GEARMAN_DEFAULT_TCP_PORT : port_arg); +} + +void gearman_connection_st::close() +{ + if (fd == INVALID_SOCKET) + return; + + /* in case of death shutdown to avoid blocking at close() */ + if (shutdown(fd, SHUT_RDWR) == SOCKET_ERROR && get_socket_errno() != ENOTCONN) + { + gearman_perror(universal, "shutdown"); + assert(errno != ENOTSOCK); + return; + } + + if (closesocket(fd) == SOCKET_ERROR) + { + gearman_perror(universal, "close"); + } + + state= GEARMAN_CON_UNIVERSAL_ADDRINFO; + fd= INVALID_SOCKET; + events= 0; + revents= 0; + + send_state= GEARMAN_CON_SEND_STATE_NONE; + send_buffer_ptr= send_buffer; + send_buffer_size= 0; + send_data_size= 0; + send_data_offset= 0; + + recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; + if (recv_packet) + { + gearman_packet_free(recv_packet); + recv_packet= NULL; + } + + recv_buffer_ptr= recv_buffer; + recv_buffer_size= 0; +} + +void gearman_connection_st::reset_addrinfo() +{ + if (addrinfo) + { + freeaddrinfo(addrinfo); + addrinfo= NULL; + } + + addrinfo_next= NULL; +} + +gearman_return_t gearman_connection_st::send(const gearman_packet_st& packet_arg, const bool flush_buffer) +{ + switch (send_state) + { + case GEARMAN_CON_SEND_STATE_NONE: + if (not (packet_arg.options.complete)) + { + return gearman_error(universal, GEARMAN_INVALID_PACKET, "packet not complete"); + } + + /* Pack first part of packet, which is everything but the payload. */ + while (1) + { + gearman_return_t rc; + { // Scoping to shut compiler up about switch/case jump + size_t send_size= gearman_packet_pack(packet_arg, + send_buffer + send_buffer_size, + GEARMAN_SEND_BUFFER_SIZE - + send_buffer_size, rc); + if (gearman_success(rc)) + { + send_buffer_size+= send_size; + break; + } + else if (rc == GEARMAN_IGNORE_PACKET) + { + return GEARMAN_SUCCESS; + } + else if (rc != GEARMAN_FLUSH_DATA) + { + return rc; + } + } + + /* We were asked to flush when the buffer is already flushed! */ + if (send_buffer_size == 0) + { + gearman_universal_set_error(universal, GEARMAN_SEND_BUFFER_TOO_SMALL, __func__, AT, + "send buffer too small (%u)", GEARMAN_SEND_BUFFER_SIZE); + return GEARMAN_SEND_BUFFER_TOO_SMALL; + } + + /* Flush buffer now if first part of packet won't fit in. */ + send_state= GEARMAN_CON_SEND_UNIVERSAL_PRE_FLUSH; + + case GEARMAN_CON_SEND_UNIVERSAL_PRE_FLUSH: + { + gearman_return_t ret= flush(); + if (gearman_failed(ret)) + { + return ret; + } + } + } + + /* Return here if we have no data to send. */ + if (not packet_arg.data_size) + { + break; + } + + /* If there is any room in the buffer, copy in data. */ + if (packet_arg.data and + (GEARMAN_SEND_BUFFER_SIZE - send_buffer_size) > 0) + { + send_data_offset= GEARMAN_SEND_BUFFER_SIZE - send_buffer_size; + if (send_data_offset > packet_arg.data_size) + send_data_offset= packet_arg.data_size; + + memcpy(send_buffer + send_buffer_size, packet_arg.data, send_data_offset); + send_buffer_size+= send_data_offset; + + /* Return if all data fit in the send buffer. */ + if (send_data_offset == packet_arg.data_size) + { + send_data_offset= 0; + break; + } + } + + /* Flush buffer now so we can start writing directly from data buffer. */ + send_state= GEARMAN_CON_SEND_UNIVERSAL_FORCE_FLUSH; + + case GEARMAN_CON_SEND_UNIVERSAL_FORCE_FLUSH: + { + gearman_return_t ret= flush(); + if (gearman_failed(ret)) + return ret; + } + + send_data_size= packet_arg.data_size; + + /* If this is NULL, then gearman_connection_send_data function will be used. */ + if (not packet_arg.data) + { + send_state= GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA; + return GEARMAN_SUCCESS; + } + + /* Copy into the buffer if it fits, otherwise flush from packet buffer. */ + send_buffer_size= packet_arg.data_size - send_data_offset; + if (send_buffer_size < GEARMAN_SEND_BUFFER_SIZE) + { + memcpy(send_buffer, + static_cast(const_cast(packet_arg.data)) + send_data_offset, + send_buffer_size); + send_data_size= 0; + send_data_offset= 0; + break; + } + + send_buffer_ptr= static_cast(const_cast(packet_arg.data)) + send_data_offset; + send_state= GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA; + + case GEARMAN_CON_SEND_UNIVERSAL_FLUSH: + case GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA: + return flush(); + } + + if (flush_buffer) + { + send_state= GEARMAN_CON_SEND_UNIVERSAL_FLUSH; + return flush(); + } + + send_state= GEARMAN_CON_SEND_STATE_NONE; + return GEARMAN_SUCCESS; +} + +size_t gearman_connection_st::send_and_flush(const void *data, size_t data_size, gearman_return_t *ret_ptr) +{ + if (send_state != GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA) + { + return gearman_error(universal, GEARMAN_NOT_FLUSHING, "not flushing"); + } + + if (data_size > (send_data_size - send_data_offset)) + { + return gearman_error(universal, GEARMAN_DATA_TOO_LARGE, "data too large"); + } + + send_buffer_ptr= static_cast(const_cast(data)); + send_buffer_size= data_size; + + *ret_ptr= flush(); + + return data_size -send_buffer_size; +} + +gearman_return_t gearman_connection_st::flush() +{ + while (1) + { + switch (state) + { + case GEARMAN_CON_UNIVERSAL_ADDRINFO: + { + if (addrinfo) + { + freeaddrinfo(addrinfo); + addrinfo= NULL; + } + + char port_str[NI_MAXSERV]; + snprintf(port_str, NI_MAXSERV, "%hu", uint16_t(port)); + + struct addrinfo ai; + memset(&ai, 0, sizeof(struct addrinfo)); + ai.ai_socktype= SOCK_STREAM; + ai.ai_protocol= IPPROTO_TCP; + + int ret; + if ((ret= getaddrinfo(host, port_str, &ai, &(addrinfo)))) + { + gearman_universal_set_error(universal, GEARMAN_GETADDRINFO, AT, "getaddrinfo:%s", gai_strerror(ret)); + return GEARMAN_GETADDRINFO; + } + + addrinfo_next= addrinfo; + } + + case GEARMAN_CON_UNIVERSAL_CONNECT: + if (fd != INVALID_SOCKET) + { + close(); + } + + if (addrinfo_next == NULL) + { + state= GEARMAN_CON_UNIVERSAL_ADDRINFO; + return gearman_universal_set_error(universal, GEARMAN_COULD_NOT_CONNECT, GEARMAN_AT, "%s:%hu", host, uint16_t(port)); + } + + fd= socket(addrinfo_next->ai_family, addrinfo_next->ai_socktype, addrinfo_next->ai_protocol); + if (fd == INVALID_SOCKET) + { + state= GEARMAN_CON_UNIVERSAL_ADDRINFO; + return gearman_perror(universal, "socket"); + } + + { + gearman_return_t gret= _con_setsockopt(this); + if (gearman_failed(gret)) + { + close(); + return gret; + } + } + + while (1) + { + if (not connect(fd, addrinfo_next->ai_addr, addrinfo_next->ai_addrlen)) + { + state= GEARMAN_CON_UNIVERSAL_CONNECTED; + addrinfo_next= NULL; + break; + } + + if (errno == EAGAIN || errno == EINTR) + continue; + + if (errno == EINPROGRESS) + { + state= GEARMAN_CON_UNIVERSAL_CONNECTING; + break; + } + + if (errno == ECONNREFUSED || errno == ENETUNREACH || errno == ETIMEDOUT) + { + state= GEARMAN_CON_UNIVERSAL_CONNECT; + addrinfo_next= addrinfo_next->ai_next; + break; + } + + gearman_perror(universal, "connect"); + close(); + return GEARMAN_ERRNO; + } + + if (state != GEARMAN_CON_UNIVERSAL_CONNECTING) + break; + + case GEARMAN_CON_UNIVERSAL_CONNECTING: + while (1) + { + if (revents & (POLLERR | POLLHUP | POLLNVAL)) + { + state= GEARMAN_CON_UNIVERSAL_CONNECT; + addrinfo_next= addrinfo_next->ai_next; + break; + } + else if (revents & POLLOUT) + { + state= GEARMAN_CON_UNIVERSAL_CONNECTED; + break; + } + + set_events(POLLOUT); + + if (gearman_universal_is_non_blocking(universal)) + { + state= GEARMAN_CON_UNIVERSAL_CONNECTING; + return gearman_gerror(universal, GEARMAN_IO_WAIT); + } + + gearman_return_t gret= gearman_wait(universal); + if (gearman_failed(gret)) + return gret; + } + + if (state != GEARMAN_CON_UNIVERSAL_CONNECTED) + break; + + case GEARMAN_CON_UNIVERSAL_CONNECTED: + while (send_buffer_size != 0) + { + ssize_t write_size= ::send(fd, send_buffer_ptr, send_buffer_size, + gearman_universal_is_non_blocking(universal) ? MSG_NOSIGNAL| MSG_DONTWAIT : MSG_NOSIGNAL); + + if (write_size == 0) // Zero value on send() + { } + else if (write_size == -1) + { + if (errno == EAGAIN) + { + set_events(POLLOUT); + + if (gearman_universal_is_non_blocking(universal)) + { + gearman_gerror(universal, GEARMAN_IO_WAIT); + return GEARMAN_IO_WAIT; + } + + gearman_return_t gret= gearman_wait(universal); + if (gearman_failed(gret)) + return gret; + + continue; + } + else if (errno == EINTR) + { + continue; + } + else if (errno == EPIPE || errno == ECONNRESET || errno == EHOSTDOWN) + { + gearman_perror(universal, "lost connection to server during send"); + close(); + return GEARMAN_LOST_CONNECTION; + } + + gearman_perror(universal, "send"); + close(); + return GEARMAN_ERRNO; + } + + send_buffer_size-= size_t(write_size); + if (send_state == GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA) + { + send_data_offset+= size_t(write_size); + if (send_data_offset == send_data_size) + { + send_data_size= 0; + send_data_offset= 0; + break; + } + + if (send_buffer_size == 0) + return GEARMAN_SUCCESS; + } + else if (send_buffer_size == 0) + { + break; + } + + send_buffer_ptr+= write_size; + } + + send_state= GEARMAN_CON_SEND_STATE_NONE; + send_buffer_ptr= send_buffer; + return GEARMAN_SUCCESS; + } + } +} + +gearman_packet_st *gearman_connection_st::receiving(gearman_packet_st& packet_arg, + gearman_return_t& ret, const bool recv_data) +{ + switch (recv_state) + { + case GEARMAN_CON_RECV_UNIVERSAL_NONE: + if (state != GEARMAN_CON_UNIVERSAL_CONNECTED) + { + gearman_error(universal, GEARMAN_NOT_CONNECTED, "not connected"); + ret= GEARMAN_NOT_CONNECTED; + return NULL; + } + + recv_packet= gearman_packet_create(universal, &packet_arg); + if (not recv_packet) + { + ret= GEARMAN_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + recv_state= GEARMAN_CON_RECV_UNIVERSAL_READ; + + case GEARMAN_CON_RECV_UNIVERSAL_READ: + while (1) + { + if (recv_buffer_size > 0) + { + size_t recv_size= gearman_packet_unpack(*recv_packet, + recv_buffer_ptr, + recv_buffer_size, ret); + recv_buffer_ptr+= recv_size; + recv_buffer_size-= recv_size; + + if (gearman_success(ret)) + { + break; + } + else if (ret != GEARMAN_IO_WAIT) + { + close(); + return NULL; + } + } + + /* Shift buffer contents if needed. */ + if (recv_buffer_size > 0) + { + memmove(recv_buffer, recv_buffer_ptr, recv_buffer_size); + } + recv_buffer_ptr= recv_buffer; + + size_t recv_size= recv(recv_buffer + recv_buffer_size, GEARMAN_RECV_BUFFER_SIZE - recv_buffer_size, ret); + if (gearman_failed(ret)) + { + return NULL; + } + + recv_buffer_size+= recv_size; + } + + if (packet_arg.data_size == 0) + { + recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; + break; + } + + recv_data_size= packet_arg.data_size; + + if (not recv_data) + { + recv_state= GEARMAN_CON_RECV_STATE_READ_DATA; + break; + } + + packet_arg.data= gearman_malloc((*packet_arg.universal), packet_arg.data_size); + if (not packet_arg.data) + { + ret= GEARMAN_MEMORY_ALLOCATION_FAILURE; + close(); + return NULL; + } + + packet_arg.options.free_data= true; + recv_state= GEARMAN_CON_RECV_STATE_READ_DATA; + + case GEARMAN_CON_RECV_STATE_READ_DATA: + while (recv_data_size) + { + (void)receiving(static_cast(const_cast(packet_arg.data)) + + recv_data_offset, + packet_arg.data_size -recv_data_offset, ret); + if (gearman_failed(ret)) + { + return NULL; + } + } + + recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; + break; + } + + gearman_packet_st *tmp_packet_arg= recv_packet; + recv_packet= NULL; + + return tmp_packet_arg; +} + +size_t gearman_connection_st::receiving(void *data, size_t data_size, gearman_return_t& ret) +{ + size_t recv_size= 0; + + if (recv_data_size == 0) + { + ret= GEARMAN_SUCCESS; + return 0; + } + + if ((recv_data_size - recv_data_offset) < data_size) + data_size= recv_data_size - recv_data_offset; + + if (recv_buffer_size > 0) + { + if (recv_buffer_size < data_size) + recv_size= recv_buffer_size; + else + recv_size= data_size; + + memcpy(data, recv_buffer_ptr, recv_size); + recv_buffer_ptr+= recv_size; + recv_buffer_size-= recv_size; + } + + if (data_size != recv_size) + { + recv_size+= recv(static_cast(const_cast(data)) + recv_size, data_size - recv_size, ret); + recv_data_offset+= recv_size; + } + else + { + recv_data_offset+= recv_size; + ret= GEARMAN_SUCCESS; + } + + if (recv_data_size == recv_data_offset) + { + recv_data_size= 0; + recv_data_offset= 0; + recv_state= GEARMAN_CON_RECV_UNIVERSAL_NONE; + } + + return recv_size; +} + +size_t gearman_connection_st::recv(void *data, size_t data_size, gearman_return_t& ret) +{ + ssize_t read_size; + + while (1) + { + read_size= ::recv(fd, data, data_size, 0); + if (read_size == 0) + { + gearman_error(universal, GEARMAN_LOST_CONNECTION, "lost connection to server (EOF)"); + close(); + ret= GEARMAN_LOST_CONNECTION; + return 0; + } + else if (read_size == -1) + { + if (errno == EAGAIN) + { + set_events(POLLIN); + + if (gearman_universal_is_non_blocking(universal)) + { + gearman_gerror(universal, GEARMAN_IO_WAIT); + ret= GEARMAN_IO_WAIT; + return 0; + } + + ret= gearman_wait(universal); + if (gearman_failed(ret)) + { + return 0; + } + + continue; + } + else if (errno == EINTR) + { + continue; + } + else if (errno == EPIPE || errno == ECONNRESET || errno == EHOSTDOWN) + { + gearman_perror(universal, "lost connection to server during read"); + ret= GEARMAN_LOST_CONNECTION; + } + else + { + gearman_perror(universal, "read"); + ret= GEARMAN_ERRNO; + } + + close(); + return 0; + } + + break; + } + + ret= GEARMAN_SUCCESS; + return size_t(read_size); +} + +void gearman_connection_st::set_events(short arg) +{ + if ((events | arg) == events) + return; + + events|= arg; +} + +void gearman_connection_st::set_revents(short arg) +{ + if (arg) + options.ready= true; + + revents= arg; + events&= short(~arg); +} + +/* + * Static Definitions + */ + +static gearman_return_t _con_setsockopt(gearman_connection_st *connection) +{ + int ret; + struct linger linger; + struct timeval waittime; + + ret= 1; + ret= setsockopt(connection->fd, IPPROTO_TCP, TCP_NODELAY, &ret, + socklen_t(sizeof(int))); + if (ret == -1 && errno != EOPNOTSUPP) + { + gearman_perror(connection->universal, "setsockopt(TCP_NODELAY)"); + return GEARMAN_ERRNO; + } + + linger.l_onoff= 1; + linger.l_linger= GEARMAN_DEFAULT_SOCKET_TIMEOUT; + ret= setsockopt(connection->fd, SOL_SOCKET, SO_LINGER, &linger, + socklen_t(sizeof(struct linger))); + if (ret == -1) + { + gearman_perror(connection->universal, "setsockopt(SO_LINGER)"); + return GEARMAN_ERRNO; + } + + waittime.tv_sec= GEARMAN_DEFAULT_SOCKET_TIMEOUT; + waittime.tv_usec= 0; + ret= setsockopt(connection->fd, SOL_SOCKET, SO_SNDTIMEO, &waittime, + socklen_t(sizeof(struct timeval))); + if (ret == -1 && errno != ENOPROTOOPT) + { + gearman_perror(connection->universal, "setsockopt(SO_SNDTIMEO)"); + return GEARMAN_ERRNO; + } + + { + int optval= 1; + ret= setsockopt(connection->fd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)); + if (ret == -1 && errno != ENOPROTOOPT) + { + gearman_perror(connection->universal, "setsockopt(SO_RCVTIMEO)"); + return GEARMAN_ERRNO; + } + } + + + ret= setsockopt(connection->fd, SOL_SOCKET, SO_RCVTIMEO, &waittime, + socklen_t(sizeof(struct timeval))); + if (ret == -1 && errno != ENOPROTOOPT) + { + gearman_perror(connection->universal, "setsockopt(SO_RCVTIMEO)"); + return GEARMAN_ERRNO; + } + + ret= GEARMAN_DEFAULT_SOCKET_SEND_SIZE; + ret= setsockopt(connection->fd, SOL_SOCKET, SO_SNDBUF, &ret, socklen_t(sizeof(int))); + if (ret == -1) + { + gearman_perror(connection->universal, "setsockopt(SO_SNDBUF)"); + return GEARMAN_ERRNO; + } + +#if defined(__MACH__) && defined(__APPLE__) || defined(__FreeBSD__) + { + ret= 1; + setsockopt(connection->fd, SOL_SOCKET, SO_NOSIGPIPE, static_cast(&ret), sizeof(int)); + + // This is not considered a fatal error + if (ret == -1) + { + gearman_perror(connection->universal, "setsockopt(SO_NOSIGPIPE)"); + } + } +#endif + + ret= GEARMAN_DEFAULT_SOCKET_RECV_SIZE; + ret= setsockopt(connection->fd, SOL_SOCKET, SO_RCVBUF, &ret, socklen_t(sizeof(int))); + if (ret == -1) + { + gearman_perror(connection->universal, "setsockopt(SO_RCVBUF)"); + return GEARMAN_ERRNO; + } + + ret= fcntl(connection->fd, F_GETFL, 0); + if (ret == -1) + { + gearman_perror(connection->universal, "fcntl(F_GETFL)"); + return GEARMAN_ERRNO; + } + + ret= fcntl(connection->fd, F_SETFL, ret | O_NONBLOCK); + if (ret == -1) + { + gearman_perror(connection->universal, "fcntl(F_SETFL)"); + return GEARMAN_ERRNO; + } + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman/connection.h gearmand-0.23/libgearman/connection.h --- gearmand-0.14/libgearman/connection.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/connection.h 2011-06-03 04:13:30.000000000 +0200 @@ -1,293 +1,69 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Connection Declarations - */ - -#ifndef __GEARMAN_CONNECTION_H__ -#define __GEARMAN_CONNECTION_H__ - -#ifdef __cplusplus -extern "C" { -#endif -/** - * @addtogroup gearman_con Connection Declarations - * @ingroup gearman_universal - * - * This is a low level interface for gearman connections. This is used - * internally by both client and worker interfaces, so you probably want to - * look there first. This is usually used to write lower level clients, workers, - * proxies, or your own server. - * - * @{ - */ - -/** - * @ingroup gearman_connection - */ -struct gearman_connection_st -{ - struct { - bool allocated LIBGEARMAN_BITFIELD; - bool ready LIBGEARMAN_BITFIELD; - bool packet_in_use LIBGEARMAN_BITFIELD; - bool external_fd LIBGEARMAN_BITFIELD; - bool ignore_lost_connection LIBGEARMAN_BITFIELD; - bool close_after_flush LIBGEARMAN_BITFIELD; - } options; - enum { - GEARMAN_CON_UNIVERSAL_ADDRINFO, - GEARMAN_CON_UNIVERSAL_CONNECT, - GEARMAN_CON_UNIVERSAL_CONNECTING, - GEARMAN_CON_UNIVERSAL_CONNECTED - } state; - enum { - GEARMAN_CON_SEND_STATE_NONE, - GEARMAN_CON_SEND_UNIVERSAL_PRE_FLUSH, - GEARMAN_CON_SEND_UNIVERSAL_FORCE_FLUSH, - GEARMAN_CON_SEND_UNIVERSAL_FLUSH, - GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA - } send_state; - enum { - GEARMAN_CON_RECV_UNIVERSAL_NONE, - GEARMAN_CON_RECV_UNIVERSAL_READ, - GEARMAN_CON_RECV_STATE_READ_DATA - } recv_state; - in_port_t port; - short events; - short revents; - int fd; - uint32_t created_id; - uint32_t created_id_next; - size_t send_buffer_size; - size_t send_data_size; - size_t send_data_offset; - size_t recv_buffer_size; - size_t recv_data_size; - size_t recv_data_offset; - gearman_universal_st *universal; - gearman_connection_st *next; - gearman_connection_st *prev; - void *context; - struct addrinfo *addrinfo; - struct addrinfo *addrinfo_next; - char *send_buffer_ptr; - gearman_packet_st *recv_packet; - char *recv_buffer_ptr; - void *protocol_context; - gearman_connection_protocol_context_free_fn *protocol_context_free_fn; - gearman_packet_pack_fn *packet_pack_fn; - gearman_packet_unpack_fn *packet_unpack_fn; - gearman_packet_st packet; - char host[NI_MAXHOST]; - char send_buffer[GEARMAN_SEND_BUFFER_SIZE]; - char recv_buffer[GEARMAN_RECV_BUFFER_SIZE]; +#pragma once + +#include +#include +#include + +/* + Do not define these enum in your application. There are left publically due to one client. +*/ + +enum gearman_con_recv_t { + GEARMAN_CON_RECV_UNIVERSAL_NONE, + GEARMAN_CON_RECV_UNIVERSAL_READ, + GEARMAN_CON_RECV_STATE_READ_DATA }; -#ifdef GEARMAN_CORE - -/** - * Initialize a connection structure. Always check the return value even if - * passing in a pre-allocated structure. Some other initialization may have - * failed. - * - * @param[in] gearman Structure previously initialized with gearman_create() or - * gearman_clone(). - * @param[in] connection Caller allocated structure, or NULL to allocate one. - * @return On success, a pointer to the (possibly allocated) structure. On - * failure this will be NULL. - */ -GEARMAN_INTERNAL_API -gearman_connection_st *gearman_connection_create(gearman_universal_st *gearman, - gearman_connection_st *connection, - gearman_connection_options_t *options); - -/** - * Create a connection structure with the given host and port. - * - * @param[in] gearman Structure previously initialized with gearman_create() or - * gearman_clone(). - * @param[in] connection Caller allocated structure, or NULL to allocate one. - * @param[in] host Host or IP address to connect to. - * @param[in] port Port to connect to. - * @return On success, a pointer to the (possibly allocated) structure. On - * failure this will be NULL. - */ -GEARMAN_INTERNAL_API -gearman_connection_st *gearman_connection_create_args(gearman_universal_st *gearman, - gearman_connection_st *connection, - const char *host, in_port_t port); - -/** - * Clone a connection structure. - * - * @param[in] gearman Structure previously initialized with gearman_create() or - * gearman_clone(). - * @param[in] connection Caller allocated structure, or NULL to allocate one. - * @param[in] from Structure to use as a source to clone from. - * @return On success, a pointer to the (possibly allocated) structure. On - * failure this will be NULL. - */ -GEARMAN_INTERNAL_API -gearman_connection_st *gearman_connection_clone(gearman_universal_st *gearman, gearman_connection_st *src, - const gearman_connection_st *from); - -/** - * Free a connection structure. - * - * @param[in] connection Structure previously initialized with gearman_connection_create(), - * gearman_connection_create_args(), or gearman_connection_clone(). - */ -GEARMAN_INTERNAL_API -void gearman_connection_free(gearman_connection_st *connection); - - -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_set_option(gearman_connection_st *connection, - gearman_connection_options_t options, - bool value); - - -/** - * Set host for a connection. - */ -GEARMAN_INTERNAL_API -void gearman_connection_set_host(gearman_connection_st *connection, - const char *host, - in_port_t port); - -/** - * Set connection to an already open file descriptor. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_set_fd(gearman_connection_st *connection, int fd); - -/** - * Get application context pointer. - */ -GEARMAN_INTERNAL_API -void *gearman_connection_context(const gearman_connection_st *connection); - -/** - * Set application context pointer. - */ -GEARMAN_INTERNAL_API -void gearman_connection_set_context(gearman_connection_st *connection, void *context); - -/** - * Connect to server. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_connect(gearman_connection_st *connection); - -/** - * Close a connection. - */ -GEARMAN_INTERNAL_API -void gearman_connection_close(gearman_connection_st *connection); - -/** - * Send packet to a connection. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_send(gearman_connection_st *connection, - const gearman_packet_st *packet, bool flush); - -/** - * Send packet data to a connection. - */ -GEARMAN_INTERNAL_API -size_t gearman_connection_send_data(gearman_connection_st *connection, const void *data, - size_t data_size, gearman_return_t *ret_ptr); - -/** - * Flush the send buffer. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_flush(gearman_connection_st *connection); - -/** - * Receive packet from a connection. - */ -GEARMAN_INTERNAL_API -gearman_packet_st *gearman_connection_recv(gearman_connection_st *connection, - gearman_packet_st *packet, - gearman_return_t *ret_ptr, bool recv_data); - -/** - * Receive packet data from a connection. - */ -GEARMAN_INTERNAL_API -size_t gearman_connection_recv_data(gearman_connection_st *connection, void *data, size_t data_size, - gearman_return_t *ret_ptr); - -/** - * Read data from a connection. - */ -GEARMAN_INTERNAL_API -size_t gearman_connection_read(gearman_connection_st *connection, void *data, size_t data_size, - gearman_return_t *ret_ptr); - -/** - * Set events to be watched for a connection. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_set_events(gearman_connection_st *connection, short events); - -/** - * Set events that are ready for a connection. This is used with the external - * event callbacks. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_connection_set_revents(gearman_connection_st *connection, short revents); - -/** - * Get protocol context pointer. - */ -GEARMAN_INTERNAL_API -void *gearman_connection_protocol_context(const gearman_connection_st *connection); - -/** - * Set protocol context pointer. - */ -GEARMAN_INTERNAL_API -void gearman_connection_set_protocol_context(gearman_connection_st *connection, void *context); - -/** - * Set function to call when protocol_data should be freed. - */ -GEARMAN_INTERNAL_API -void gearman_connection_set_protocol_context_free_fn(gearman_connection_st *connection, - gearman_connection_protocol_context_free_fn *function); - -/** - * Set custom packet_pack function - */ -GEARMAN_INTERNAL_API -void gearman_connection_set_packet_pack_fn(gearman_connection_st *connection, - gearman_packet_pack_fn *function); - -/** - * Set custom packet_unpack function - */ -GEARMAN_INTERNAL_API -void gearman_connection_set_packet_unpack_fn(gearman_connection_st *connection, - gearman_packet_unpack_fn *function); - -/** @} */ - -#endif /* GEARMAN_CORE */ - -#ifdef __cplusplus -} -#endif +enum gearman_con_send_t { + GEARMAN_CON_SEND_STATE_NONE, + GEARMAN_CON_SEND_UNIVERSAL_PRE_FLUSH, + GEARMAN_CON_SEND_UNIVERSAL_FORCE_FLUSH, + GEARMAN_CON_SEND_UNIVERSAL_FLUSH, + GEARMAN_CON_SEND_UNIVERSAL_FLUSH_DATA +}; -#endif /* __GEARMAN_CONNECTION_H__ */ +enum gearman_con_universal_t { + GEARMAN_CON_UNIVERSAL_ADDRINFO, + GEARMAN_CON_UNIVERSAL_CONNECT, + GEARMAN_CON_UNIVERSAL_CONNECTING, + GEARMAN_CON_UNIVERSAL_CONNECTED +}; diff -Nru gearmand-0.14/libgearman/connection.hpp gearmand-0.23/libgearman/connection.hpp --- gearmand-0.14/libgearman/connection.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/connection.hpp 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,139 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +struct gearman_connection_st +{ + struct { + bool ready; + bool packet_in_use; + } options; + enum gearman_con_universal_t state; + enum gearman_con_send_t send_state; + enum gearman_con_recv_t recv_state; + in_port_t port; + short events; + short revents; + int fd; + int cached_errno; + uint32_t created_id; + uint32_t created_id_next; + size_t send_buffer_size; + size_t send_data_size; + size_t send_data_offset; + size_t recv_buffer_size; + size_t recv_data_size; + size_t recv_data_offset; + gearman_universal_st &universal; + gearman_connection_st *next; + gearman_connection_st *prev; + void *context; + struct addrinfo *addrinfo; + struct addrinfo *addrinfo_next; + char *send_buffer_ptr; + gearman_packet_st *recv_packet; + char *recv_buffer_ptr; + gearman_packet_st _packet; + char host[NI_MAXHOST]; + char send_buffer[GEARMAN_SEND_BUFFER_SIZE]; + char recv_buffer[GEARMAN_RECV_BUFFER_SIZE]; + + gearman_connection_st(gearman_universal_st &universal_arg, + gearman_connection_options_t *options); + + ~gearman_connection_st(); + + void set_host( const char *host, const in_port_t port); + + gearman_return_t send(const gearman_packet_st&, const bool flush_buffer); + size_t send_and_flush(const void *data, size_t data_size, gearman_return_t *ret_ptr); + + gearman_return_t flush(); + void close(); + + // Receive packet from a connection. + gearman_packet_st *receiving(gearman_packet_st&, + gearman_return_t& , const bool recv_data); + + // Receive packet data from a connection. + size_t receiving(void *data, size_t data_size, gearman_return_t&); + + // Set events to be watched for a connection. + void set_events(short events); + + // Set events that are ready for a connection. This is used with the + // external event callbacks. + void set_revents(short revents); + + void reset_addrinfo(); + +private: + size_t recv(void *data, size_t data_size, gearman_return_t&); +}; + +/** + * Initialize a connection structure. Always check the return value even if + * passing in a pre-allocated structure. Some other initialization may have + * failed. + */ + +GEARMAN_LOCAL +gearman_connection_st *gearman_connection_create(gearman_universal_st &universal, + gearman_connection_options_t *options); + +GEARMAN_LOCAL +gearman_connection_st *gearman_connection_copy(gearman_universal_st& universal, + const gearman_connection_st& from); + +/** + * Create a connection structure with the given host and port. + * + * @param[in] gearman Structure previously initialized with gearman_create() or + * gearman_clone(). + * @param[in] connection Caller allocated structure, or NULL to allocate one. + * @param[in] host Host or IP address to connect to. + * @param[in] port Port to connect to. + * @return On success, a pointer to the (possibly allocated) structure. On + * failure this will be NULL. + */ +GEARMAN_LOCAL +gearman_connection_st *gearman_connection_create_args(gearman_universal_st &universal, + const char *host, in_port_t port); diff -Nru gearmand-0.14/libgearman/constants.h gearmand-0.23/libgearman/constants.h --- gearmand-0.14/libgearman/constants.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/constants.h 2011-06-27 21:20:18.000000000 +0200 @@ -1,18 +1,48 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Defines, typedefs, and enums - */ -#ifndef __GEARMAN_CONSTANTS_H__ -#define __GEARMAN_CONSTANTS_H__ + +#pragma once + +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -27,80 +57,23 @@ */ /* Defines. */ -#define GEARMAN_DEFAULT_TCP_HOST "127.0.0.1" -#define GEARMAN_DEFAULT_TCP_PORT 4730 -#define GEARMAN_DEFAULT_SOCKET_TIMEOUT 10 -#define GEARMAN_DEFAULT_SOCKET_SEND_SIZE 32768 +#define GEARMAN_ARGS_BUFFER_SIZE 128 #define GEARMAN_DEFAULT_SOCKET_RECV_SIZE 32768 -#define GEARMAN_MAX_ERROR_SIZE 1024 -#define GEARMAN_PACKET_HEADER_SIZE 12 +#define GEARMAN_DEFAULT_SOCKET_SEND_SIZE 32768 +#define GEARMAN_DEFAULT_SOCKET_TIMEOUT 10 +#define GEARMAN_DEFAULT_TCP_HOST "127.0.0.1" #define GEARMAN_JOB_HANDLE_SIZE 64 -#define GEARMAN_OPTION_SIZE 64 -#define GEARMAN_UNIQUE_SIZE 64 +#define GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH 20 #define GEARMAN_MAX_COMMAND_ARGS 8 -#define GEARMAN_ARGS_BUFFER_SIZE 128 -#define GEARMAN_SEND_BUFFER_SIZE 8192 +#define GEARMAN_MAX_ERROR_SIZE 1024 +#define GEARMAN_OPTION_SIZE 64 +#define GEARMAN_PACKET_HEADER_SIZE 12 #define GEARMAN_RECV_BUFFER_SIZE 8192 +#define GEARMAN_SEND_BUFFER_SIZE 8192 +#define GEARMAN_UNIQUE_SIZE 64 #define GEARMAN_WORKER_WAIT_TIMEOUT (10 * 1000) /* Milliseconds */ /** - * Return codes. - */ -typedef enum -{ - GEARMAN_SUCCESS, - GEARMAN_IO_WAIT, - GEARMAN_SHUTDOWN, - GEARMAN_SHUTDOWN_GRACEFUL, - GEARMAN_ERRNO, - GEARMAN_EVENT, - GEARMAN_TOO_MANY_ARGS, - GEARMAN_NO_ACTIVE_FDS, - GEARMAN_INVALID_MAGIC, - GEARMAN_INVALID_COMMAND, - GEARMAN_INVALID_PACKET, - GEARMAN_UNEXPECTED_PACKET, - GEARMAN_GETADDRINFO, - GEARMAN_NO_SERVERS, - GEARMAN_LOST_CONNECTION, - GEARMAN_MEMORY_ALLOCATION_FAILURE, - GEARMAN_JOB_EXISTS, - GEARMAN_JOB_QUEUE_FULL, - GEARMAN_SERVER_ERROR, - GEARMAN_WORK_ERROR, - GEARMAN_WORK_DATA, - GEARMAN_WORK_WARNING, - GEARMAN_WORK_STATUS, - GEARMAN_WORK_EXCEPTION, - GEARMAN_WORK_FAIL, - GEARMAN_NOT_CONNECTED, - GEARMAN_COULD_NOT_CONNECT, - GEARMAN_SEND_IN_PROGRESS, - GEARMAN_RECV_IN_PROGRESS, - GEARMAN_NOT_FLUSHING, - GEARMAN_DATA_TOO_LARGE, - GEARMAN_INVALID_FUNCTION_NAME, - GEARMAN_INVALID_WORKER_FUNCTION, - GEARMAN_NO_REGISTERED_FUNCTION, - GEARMAN_NO_REGISTERED_FUNCTIONS, - GEARMAN_NO_JOBS, - GEARMAN_ECHO_DATA_CORRUPTION, - GEARMAN_NEED_WORKLOAD_FN, - GEARMAN_PAUSE, - GEARMAN_UNKNOWN_STATE, - GEARMAN_PTHREAD, - GEARMAN_PIPE_EOF, - GEARMAN_QUEUE_ERROR, - GEARMAN_FLUSH_DATA, - GEARMAN_SEND_BUFFER_TOO_SMALL, - GEARMAN_IGNORE_PACKET, - GEARMAN_UNKNOWN_OPTION, - GEARMAN_TIMEOUT, - GEARMAN_ARGUMENT_TOO_LARGE, - GEARMAN_MAX_RETURN /* Always add new error code before */ -} gearman_return_t; - -/** * Verbosity levels. */ typedef enum @@ -142,65 +115,6 @@ } gearman_connection_options_t; /** - * @ingroup gearman_packet - * Command types. When you add a new entry, update gearman_command_info_list in - * packet.c as well. - */ -typedef enum -{ - GEARMAN_COMMAND_TEXT, - GEARMAN_COMMAND_CAN_DO, /* W->J: FUNC */ - GEARMAN_COMMAND_CANT_DO, /* W->J: FUNC */ - GEARMAN_COMMAND_RESET_ABILITIES, /* W->J: -- */ - GEARMAN_COMMAND_PRE_SLEEP, /* W->J: -- */ - GEARMAN_COMMAND_UNUSED, - GEARMAN_COMMAND_NOOP, /* J->W: -- */ - GEARMAN_COMMAND_SUBMIT_JOB, /* C->J: FUNC[0]UNIQ[0]ARGS */ - GEARMAN_COMMAND_JOB_CREATED, /* J->C: HANDLE */ - GEARMAN_COMMAND_GRAB_JOB, /* W->J: -- */ - GEARMAN_COMMAND_NO_JOB, /* J->W: -- */ - GEARMAN_COMMAND_JOB_ASSIGN, /* J->W: HANDLE[0]FUNC[0]ARG */ - GEARMAN_COMMAND_WORK_STATUS, /* W->J/C: HANDLE[0]NUMERATOR[0]DENOMINATOR */ - GEARMAN_COMMAND_WORK_COMPLETE, /* W->J/C: HANDLE[0]RES */ - GEARMAN_COMMAND_WORK_FAIL, /* W->J/C: HANDLE */ - GEARMAN_COMMAND_GET_STATUS, /* C->J: HANDLE */ - GEARMAN_COMMAND_ECHO_REQ, /* ?->J: TEXT */ - GEARMAN_COMMAND_ECHO_RES, /* J->?: TEXT */ - GEARMAN_COMMAND_SUBMIT_JOB_BG, /* C->J: FUNC[0]UNIQ[0]ARGS */ - GEARMAN_COMMAND_ERROR, /* J->?: ERRCODE[0]ERR_TEXT */ - GEARMAN_COMMAND_STATUS_RES, /* C->J: HANDLE[0]KNOWN[0]RUNNING[0]NUM[0]DENOM */ - GEARMAN_COMMAND_SUBMIT_JOB_HIGH, /* C->J: FUNC[0]UNIQ[0]ARGS */ - GEARMAN_COMMAND_SET_CLIENT_ID, /* W->J: [RANDOM_STRING_NO_WHITESPACE] */ - GEARMAN_COMMAND_CAN_DO_TIMEOUT, /* W->J: FUNC[0]TIMEOUT */ - GEARMAN_COMMAND_ALL_YOURS, - GEARMAN_COMMAND_WORK_EXCEPTION, - GEARMAN_COMMAND_OPTION_REQ, - GEARMAN_COMMAND_OPTION_RES, - GEARMAN_COMMAND_WORK_DATA, - GEARMAN_COMMAND_WORK_WARNING, - GEARMAN_COMMAND_GRAB_JOB_UNIQ, - GEARMAN_COMMAND_JOB_ASSIGN_UNIQ, - GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, - GEARMAN_COMMAND_SUBMIT_JOB_LOW, - GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, - GEARMAN_COMMAND_SUBMIT_JOB_SCHED, - GEARMAN_COMMAND_SUBMIT_JOB_EPOCH, - GEARMAN_COMMAND_MAX /* Always add new commands before this. */ -} gearman_command_t; - -/** - * @ingroup gearman_job - * Priority levels for a job. - */ -typedef enum -{ - GEARMAN_JOB_PRIORITY_HIGH, - GEARMAN_JOB_PRIORITY_NORMAL, - GEARMAN_JOB_PRIORITY_LOW, - GEARMAN_JOB_PRIORITY_MAX /* Always add new commands before this. */ -} gearman_job_priority_t; - -/** * @ingroup gearman_client * Options for gearman_client_st. */ @@ -230,76 +144,49 @@ GEARMAN_WORKER_CHANGE= (1 << 6), GEARMAN_WORKER_GRAB_UNIQ= (1 << 7), GEARMAN_WORKER_TIMEOUT_RETURN= (1 << 8), - GEARMAN_WORKER_MAX= (1 << 9) + GEARMAN_WORKER_GRAB_ALL= (1 << 9), + GEARMAN_WORKER_MAX= (1 << 10) } gearman_worker_options_t; -/** - * @addtogroup gearman_types Types - * @ingroup gearman_universal - * @ingroup gearman_client - * @ingroup gearman_worker - * @{ - */ - /* Types. */ -typedef struct gearman_universal_st gearman_universal_st; -typedef struct gearman_connection_st gearman_connection_st; typedef struct gearman_packet_st gearman_packet_st; -typedef struct gearman_command_info_st gearman_command_info_st; typedef struct gearman_task_st gearman_task_st; typedef struct gearman_client_st gearman_client_st; typedef struct gearman_job_st gearman_job_st; typedef struct gearman_worker_st gearman_worker_st; +typedef struct gearman_allocator_t gearman_allocator_t; +typedef struct gearman_task_attr_t gearman_task_attr_t; +typedef struct gearman_result_st gearman_result_st; +typedef struct gearman_string_t gearman_string_t; +typedef struct gearman_argument_t gearman_argument_t; -/* Function types. */ -typedef gearman_return_t (gearman_workload_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_created_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_data_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_warning_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_universal_status_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_complete_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_exception_fn)(gearman_task_st *task); -typedef gearman_return_t (gearman_fail_fn)(gearman_task_st *task); - -typedef gearman_return_t (gearman_parse_server_fn)(const char *host, - in_port_t port, - void *context); +// Custom allocators +typedef void* (gearman_malloc_fn)(size_t size, void *context); +typedef void* (gearman_realloc_fn)(void *ptr, size_t size, void *context); +typedef void* (gearman_calloc_fn)(size_t nelm, size_t size, void *context); +typedef void (gearman_free_fn)(void *ptr, void *context); -typedef void* (gearman_worker_fn)(gearman_job_st *job, void *context, - size_t *result_size, - gearman_return_t *ret_ptr); -/** - @todo this is only used by the server and should be made private. - */ -typedef gearman_return_t (gearman_event_watch_fn)(gearman_connection_st *con, - short events, void *context); +typedef gearman_return_t (gearman_parse_server_fn)(const char *host, in_port_t port, void *context); + +typedef void (gearman_task_context_free_fn)(gearman_task_st *task, void *context); + +typedef void (gearman_log_fn)(const char *line, gearman_verbose_t verbose, void *context); -typedef void* (gearman_malloc_fn)(size_t size, void *context); -typedef void (gearman_free_fn)(void *ptr, void *context); -typedef void (gearman_task_context_free_fn)(gearman_task_st *task, - void *context); +// Worker types -typedef void (gearman_log_fn)(const char *line, gearman_verbose_t verbose, - void *context); +typedef void* (gearman_worker_fn)(gearman_job_st *job, void *context, + size_t *result_size, + gearman_return_t *ret_ptr); -typedef void (gearman_connection_protocol_context_free_fn)(gearman_connection_st *con, - void *context); +typedef gearman_return_t (gearman_function_fn)(gearman_job_st *job, void *worker_context); -typedef size_t (gearman_packet_pack_fn)(const gearman_packet_st *packet, - gearman_connection_st *con, - void *data, size_t data_size, - gearman_return_t *ret_ptr); -typedef size_t (gearman_packet_unpack_fn)(gearman_packet_st *packet, - gearman_connection_st *con, const void *data, - size_t data_size, - gearman_return_t *ret_ptr); +typedef struct gearman_aggregator_st gearman_aggregator_st; +typedef gearman_return_t (gearman_aggregator_fn)(gearman_aggregator_st *, gearman_task_st *, gearman_result_st *); /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_CONSTANTS_H__ */ diff -Nru gearmand-0.14/libgearman/core.h gearmand-0.23/libgearman/core.h --- gearmand-0.14/libgearman/core.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/core.h 2011-06-22 17:48:39.000000000 +0200 @@ -6,27 +6,9 @@ * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Gearman Declarations - */ - -#ifndef __GEARMAN_CORE_H__ -#define __GEARMAN_CORE_H__ +#pragma once +#include #include #include #include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_CORE_H__ */ diff -Nru gearmand-0.14/libgearman/do.cc gearmand-0.23/libgearman/do.cc --- gearmand-0.14/libgearman/do.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/do.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,163 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +void *client_do(gearman_client_st *client, gearman_command_t command, + const char *function_name, + const char *unique, + const void *workload_str, size_t workload_size, + size_t *result_size, gearman_return_t *ret_ptr) +{ + gearman_task_st do_task; + gearman_string_t function= { gearman_string_param_cstr(function_name) }; + gearman_unique_t local_unique= gearman_unique_make(unique, unique ? strlen(unique) : 0); + gearman_string_t workload= { static_cast(workload_str), workload_size }; + + gearman_return_t unused; + if (not ret_ptr) + ret_ptr= &unused; + + if (not client) + { + *ret_ptr= GEARMAN_ERRNO; + errno= EINVAL; + return NULL; + } + + gearman_task_st *do_task_ptr= add_task(client, &do_task, NULL, command, + function, + local_unique, + workload, + time_t(0), + gearman_actions_do_default()); + if (not do_task_ptr) + { + *ret_ptr= gearman_universal_error_code(client->universal); + return NULL; + } + + gearman_return_t ret= gearman_client_run_block_tasks(client); + + const void *returnable= NULL; + *result_size= 0; + + // gearman_client_run_block_tasks failed + if (gearman_failed(ret)) + { + gearman_error(client->universal, ret, "occured during gearman_client_run_tasks()"); + + *ret_ptr= ret; + *result_size= 0; + } + else // Now we check the task itself + { + assert(ret == GEARMAN_SUCCESS); // Programmer mistake + if (gearman_success(do_task_ptr->result_rc)) + { + *ret_ptr= do_task_ptr->result_rc; + if (do_task_ptr->result_ptr) + { + gearman_string_t result= gearman_result_take_string(do_task_ptr->result_ptr); + *result_size= gearman_size(result); + returnable= gearman_c_str(result); + } + else // NULL SUCCESSFUL job + { } + } + else // gearman_client_run_block_tasks() was successful, but the task was not + { + gearman_error(client->universal, do_task_ptr->result_rc, "occured during gearman_client_run_tasks()"); + + *ret_ptr= do_task_ptr->result_rc; + *result_size= 0; + } + } + + assert(client->task_list); + gearman_task_free(&do_task); + client->new_tasks= 0; + client->running_tasks= 0; + + return const_cast(returnable); +} + +gearman_return_t client_do_background(gearman_client_st *client, + gearman_command_t command, + gearman_string_t &function, + gearman_unique_t &unique, + gearman_string_t &workload, + gearman_job_handle_t job_handle) +{ + gearman_task_st do_task; + gearman_task_st *do_task_ptr= add_task(client, &do_task, + client, + command, + function, + unique, + workload, + time_t(0), + gearman_actions_do_default()); + if (not do_task_ptr) + { + return gearman_universal_error_code(client->universal); + } + + gearman_task_clear_fn(do_task_ptr); + + gearman_return_t ret= gearman_client_run_block_tasks(client); + assert(ret != GEARMAN_IO_WAIT); + if (ret != GEARMAN_IO_WAIT) + { + if (job_handle) + { + strncpy(job_handle, do_task.job_handle, GEARMAN_JOB_HANDLE_SIZE); + } + client->new_tasks= 0; + client->running_tasks= 0; + } + gearman_task_free(&do_task); + + return ret; +} diff -Nru gearmand-0.14/libgearman/do.hpp gearmand-0.23/libgearman/do.hpp --- gearmand-0.14/libgearman/do.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/do.hpp 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,51 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +void *client_do(gearman_client_st *client, gearman_command_t command, + const char *function_name, + const char *unique, + const void *workload_str, size_t workload_size, + size_t *result_size, gearman_return_t *ret_ptr); + +gearman_return_t client_do_background(gearman_client_st *client, + gearman_command_t command, + gearman_string_t &function, + gearman_unique_t &unique, + gearman_string_t &workload, + char *job_handle); diff -Nru gearmand-0.14/libgearman/error.cc gearmand-0.23/libgearman/error.cc --- gearmand-0.14/libgearman/error.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/error.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,164 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include + +gearman_return_t gearman_universal_set_error(gearman_universal_st& universal, + gearman_return_t rc, + const char *function, + const char *position, + const char *format, ...) +{ + va_list args; + + universal.error.rc= rc; + if (rc != GEARMAN_ERRNO) + { + universal.error.last_errno= 0; + } + + char last_error[GEARMAN_MAX_ERROR_SIZE]; + va_start(args, format); + int length= vsnprintf(last_error, GEARMAN_MAX_ERROR_SIZE, format, args); + va_end(args); + + if (length > int(GEARMAN_MAX_ERROR_SIZE) or length < 0) + { + assert(length > int(GEARMAN_MAX_ERROR_SIZE)); + assert(length < 0); + universal.error.last_error[GEARMAN_MAX_ERROR_SIZE -1]= 0; + return GEARMAN_ARGUMENT_TOO_LARGE; + } + + length= snprintf(universal.error.last_error, GEARMAN_MAX_ERROR_SIZE, "%s(%s) %s -> %s", function, gearman_strerror(rc), last_error, position); + if (length > int(GEARMAN_MAX_ERROR_SIZE) or length < 0) + { + assert(length > int(GEARMAN_MAX_ERROR_SIZE)); + assert(length < 0); + universal.error.last_error[GEARMAN_MAX_ERROR_SIZE -1]= 0; + return GEARMAN_ARGUMENT_TOO_LARGE; + } + + if (universal.log_fn) + { + universal.log_fn(universal.error.last_error, GEARMAN_VERBOSE_FATAL, + static_cast(universal.log_context)); + } + + return rc; +} + +gearman_return_t gearman_universal_set_gerror(gearman_universal_st& universal, + gearman_return_t rc, + const char *func, + const char *position) +{ + universal.error.rc= rc; + if (rc != GEARMAN_ERRNO) + { + universal.error.last_errno= 0; + } + + int length= snprintf(universal.error.last_error, GEARMAN_MAX_ERROR_SIZE, "%s(%s) -> %s", func, gearman_strerror(rc), position); + if (length > int(GEARMAN_MAX_ERROR_SIZE) or length < 0) + { + assert(length > int(GEARMAN_MAX_ERROR_SIZE)); + assert(length < 0); + universal.error.last_error[GEARMAN_MAX_ERROR_SIZE -1]= 0; + return GEARMAN_ARGUMENT_TOO_LARGE; + } + + if (universal.log_fn) + { + universal.log_fn(universal.error.last_error, GEARMAN_VERBOSE_FATAL, + static_cast(universal.log_context)); + } + + return rc; +} + +gearman_return_t gearman_universal_set_perror(gearman_universal_st &universal, + const char *function, const char *position, + const char *message) +{ + universal.error.rc= GEARMAN_ERRNO; + universal.error.last_errno= errno; + + const char *errmsg_ptr; + char errmsg[GEARMAN_MAX_ERROR_SIZE]; + errmsg[0]= 0; + +#ifdef STRERROR_R_CHAR_P + errmsg_ptr= strerror_r(universal.error.last_errno, errmsg, sizeof(errmsg)); +#else + strerror_r(universal.error.last_errno, errmsg, sizeof(errmsg)); + errmsg_ptr= errmsg; +#endif + + int length; + if (message) + { + length= snprintf(universal.error.last_error, GEARMAN_MAX_ERROR_SIZE, "%s(%s) %s -> %s", function, errmsg_ptr, message, position); + } + else + { + length= snprintf(universal.error.last_error, GEARMAN_MAX_ERROR_SIZE, "%s(%s) -> %s", function, errmsg_ptr, position); + } + + if (length > int(GEARMAN_MAX_ERROR_SIZE) or length < 0) + { + assert(length > int(GEARMAN_MAX_ERROR_SIZE)); + assert(length < 0); + universal.error.last_error[GEARMAN_MAX_ERROR_SIZE -1]= 0; + return GEARMAN_ARGUMENT_TOO_LARGE; + } + + if (universal.log_fn) + { + universal.log_fn(universal.error.last_error, GEARMAN_VERBOSE_FATAL, + static_cast(universal.log_context)); + } + + return GEARMAN_ERRNO; +} diff -Nru gearmand-0.14/libgearman/error.hpp gearmand-0.23/libgearman/error.hpp --- gearmand-0.14/libgearman/error.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/error.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,65 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define AT __FILE__ ":" TOSTRING(__LINE__) +#define GEARMAN_AT __func__, AT + +#define gearman_perror(__universal, B) gearman_universal_set_perror((__universal), __func__, AT, (B)) +#define gearman_error(__universal, B, C) gearman_universal_set_error((__universal), (B), __func__, AT, (C)) +#define gearman_gerror(__universal, __gearman_return_t) gearman_universal_set_gerror((__universal), (__gearman_return_t), __func__, AT) + +GEARMAN_LOCAL +gearman_return_t gearman_universal_set_error(gearman_universal_st&, + gearman_return_t rc, + const char *function, + const char *position, + const char *format, ...); +GEARMAN_LOCAL +gearman_return_t gearman_universal_set_perror(gearman_universal_st&, + const char *function, const char *position, + const char *message); +GEARMAN_LOCAL +gearman_return_t gearman_universal_set_gerror(gearman_universal_st&, + gearman_return_t rc, + const char *func, + const char *position); + diff -Nru gearmand-0.14/libgearman/execute.cc gearmand-0.23/libgearman/execute.cc --- gearmand-0.14/libgearman/execute.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/execute.cc 2011-06-19 07:56:44.000000000 +0200 @@ -0,0 +1,259 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include + +#include +#include + +static inline gearman_command_t pick_command_by_priority(const gearman_job_priority_t &arg) +{ + if (arg == GEARMAN_JOB_PRIORITY_NORMAL) + return GEARMAN_COMMAND_SUBMIT_JOB; + else if (arg == GEARMAN_JOB_PRIORITY_HIGH) + return GEARMAN_COMMAND_SUBMIT_JOB_HIGH; + + return GEARMAN_COMMAND_SUBMIT_JOB_LOW; +} + +static inline gearman_command_t pick_command_by_priority_background(const gearman_job_priority_t &arg) +{ + if (arg == GEARMAN_JOB_PRIORITY_NORMAL) + return GEARMAN_COMMAND_SUBMIT_JOB_BG; + else if (arg == GEARMAN_JOB_PRIORITY_HIGH) + return GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG; + + return GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG; +} + + + +gearman_task_st *gearman_execute(gearman_client_st *client, + const char *function_name, size_t function_length, + const char *unique_str, size_t unique_length, + gearman_task_attr_t *workload, + gearman_argument_t *arguments, + void *context) +{ + if (not client) + { + errno= EINVAL; + return NULL; + } + + if (not function_name or not function_length) + { + gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function_name was NULL"); + return NULL; + } + gearman_string_t function= { function_name, function_length }; + + gearman_task_st *task= NULL; + gearman_unique_t unique= gearman_unique_make(unique_str, unique_length); + if (workload) + { + switch (workload->kind) + { + case GEARMAN_TASK_ATTR_BACKGROUND: + task= add_task(client, + context, + pick_command_by_priority_background(workload->priority), + function, + unique, + arguments->value, + time_t(0), + gearman_actions_execute_defaults()); + break; + + case GEARMAN_TASK_ATTR_EPOCH: + task= add_task(client, + context, + GEARMAN_COMMAND_SUBMIT_JOB_EPOCH, + function, + unique, + arguments->value, + gearman_task_attr_has_epoch(workload), + gearman_actions_execute_defaults()); + break; + + case GEARMAN_TASK_ATTR_FOREGROUND: + task= add_task(client, + context, + pick_command_by_priority(workload->priority), + function, + unique, + arguments->value, + time_t(0), + gearman_actions_execute_defaults()); + break; + } + } + else + { + task= add_task(client, + NULL, + GEARMAN_COMMAND_SUBMIT_JOB, + function, + unique, + arguments->value, + time_t(0), + gearman_actions_execute_defaults()); + } + + if (not task) + { + gearman_universal_error_code(client->universal); + + return NULL; + } + + task->type= GEARMAN_TASK_KIND_EXECUTE; + gearman_client_run_tasks(client); + + return task; +} + +gearman_task_st *gearman_execute_by_partition(gearman_client_st *client, + const char *partition_function, const size_t partition_function_length, + const char *function_name, const size_t function_name_length, + const char *unique_str, const size_t unique_length, + gearman_task_attr_t *workload, + gearman_argument_t *arguments, + void *context) +{ + if (not client) + { + errno= EINVAL; + return NULL; + } + + if (not partition_function or partition_function_length == 0) + { + gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function_name was NULL"); + return NULL; + } + + if (not function_name or function_name_length == 0) + { + gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function_name was NULL"); + return NULL; + } + + gearman_task_st *task= NULL; + gearman_string_t partition= { partition_function, partition_function_length }; + gearman_string_t function= { function_name, function_name_length }; + gearman_unique_t unique= gearman_unique_make(unique_str, unique_length); + + if (workload) + { + switch (workload->kind) + { + case GEARMAN_TASK_ATTR_BACKGROUND: + task= add_reducer_task(client, + GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND, + workload->priority, + partition, + function, + unique, + arguments->value, + gearman_actions_execute_defaults(), + time_t(0), + context); + break; + + case GEARMAN_TASK_ATTR_EPOCH: + gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "EPOCH is not currently supported for gearman_client_execute_reduce()"); + return NULL; +#if 0 + task= add_task(client, + GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND, + workload->priority, + partition, + function, + unique, + arguments->value, + gearman_actions_execute_defaults(), + gearman_work_epoch(workload), + context); +#endif + break; + + case GEARMAN_TASK_ATTR_FOREGROUND: + task= add_reducer_task(client, + GEARMAN_COMMAND_SUBMIT_REDUCE_JOB, + workload->priority, + partition, + function, + unique, + arguments->value, + gearman_actions_execute_defaults(), + time_t(0), + context); + break; + } + } + else + { + task= add_reducer_task(client, + GEARMAN_COMMAND_SUBMIT_REDUCE_JOB, + GEARMAN_JOB_PRIORITY_NORMAL, + partition, + function, + unique, + arguments->value, + gearman_actions_execute_defaults(), + time_t(0), + NULL); + } + + if (not task) + return NULL; + + do { + gearman_return_t rc; + if (gearman_failed(rc= gearman_client_run_tasks(client))) + { + gearman_gerror(client->universal, rc); + gearman_task_free(task); + return NULL; + } + } while (gearman_continue(gearman_task_return(task))); + + return task; +} diff -Nru gearmand-0.14/libgearman/execute.h gearmand-0.23/libgearman/execute.h --- gearmand-0.14/libgearman/execute.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/execute.h 2011-06-18 20:09:56.000000000 +0200 @@ -0,0 +1,63 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_API +gearman_task_st *gearman_execute(gearman_client_st *client, + const char *function_name, size_t function_name_length, + const char *unique, size_t unique_length, + gearman_task_attr_t *workload, + gearman_argument_t *arguments, + void *context); + +GEARMAN_API +gearman_task_st *gearman_execute_by_partition(gearman_client_st *client, + const char *partition_function, const size_t partition_function_length, + const char *function_name, const size_t function_name_length, + const char *unique_str, const size_t unique_length, + gearman_task_attr_t *workload, + gearman_argument_t *arguments, + void *context); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/function/base.hpp gearmand-0.23/libgearman/function/base.hpp --- gearmand-0.14/libgearman/function/base.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/base.hpp 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,124 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include + +enum gearman_function_error_t { + GEARMAN_FUNCTION_SUCCESS= GEARMAN_SUCCESS, + GEARMAN_FUNCTION_INVALID_ARGUMENT= GEARMAN_INVALID_ARGUMENT, + GEARMAN_FUNCTION_FATAL= GEARMAN_FATAL, + GEARMAN_FUNCTION_SHUTDOWN= GEARMAN_SHUTDOWN, + GEARMAN_FUNCTION_ERROR= GEARMAN_ERROR +}; + +struct _worker_function_st +{ + struct _options { + bool packet_in_use; + bool change; + bool remove; + + _options() : + packet_in_use(true), + change(true), + remove(false) + { } + + } options; + + struct _worker_function_st *next; + struct _worker_function_st *prev; + char *function_name; + size_t function_length; + void *context; + gearman_packet_st packet; + + _worker_function_st(void *context_arg) : + next(NULL), + prev(NULL), + function_name(NULL), + function_length(0), + context(context_arg) + { } + + virtual bool has_callback() const= 0; + + virtual gearman_function_error_t callback(gearman_job_st* job, void *context_arg)= 0; + + bool init(gearman_vector_st* namespace_arg, const char *name_arg, size_t size) + { + function_length= gearman_string_length(namespace_arg) +size; + function_name= new (std::nothrow) char[function_length +1]; + if (not function_name) + { + return false; + } + + char *ptr= function_name; + if (gearman_string_length(namespace_arg)) + { + memcpy(ptr, gearman_string_value(namespace_arg), gearman_string_length(namespace_arg)); + ptr+= gearman_string_length(namespace_arg); + } + + memcpy(ptr, name_arg, size); + function_name[function_length]= 0; + + return true; + } + + const char *name() const + { + return function_name; + } + + size_t length() const + { + return function_length; + } + + virtual ~_worker_function_st() + { + if (options.packet_in_use) + gearman_packet_free(&packet); + + delete [] function_name; + } +}; diff -Nru gearmand-0.14/libgearman/function/function_v1.hpp gearmand-0.23/libgearman/function/function_v1.hpp --- gearmand-0.14/libgearman/function/function_v1.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/function_v1.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,81 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/** + Private structure. +*/ +class FunctionV1: public _worker_function_st +{ + gearman_worker_fn *_worker_fn; + +public: + FunctionV1(gearman_worker_fn *worker_fn_arg, void *context_arg) : + _worker_function_st(context_arg), + _worker_fn(worker_fn_arg) + { } + + bool has_callback() const + { + return bool(_worker_fn); + } + + gearman_function_error_t callback(gearman_job_st* job, void *context_arg) + { + if (gearman_job_is_map(job)) + { + gearman_job_build_reducer(job, NULL); + } + + job->error_code= GEARMAN_SUCCESS; + job->worker->work_result= _worker_fn(job, context_arg, &(job->worker->work_result_size), &job->error_code); + + if (job->error_code == GEARMAN_LOST_CONNECTION) + { + return GEARMAN_FUNCTION_ERROR; + } + + if (gearman_failed(job->error_code) and job->error_code != GEARMAN_SHUTDOWN) + { + return GEARMAN_FUNCTION_FATAL; + } + + return GEARMAN_FUNCTION_SUCCESS; + } +}; + diff -Nru gearmand-0.14/libgearman/function/function_v2.cc gearmand-0.23/libgearman/function/function_v2.cc --- gearmand-0.14/libgearman/function/function_v2.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/function_v2.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,125 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +/* + FunctionV2 function +*/ +gearman_function_error_t FunctionV2::callback(gearman_job_st* job, void *context_arg) +{ + if (gearman_job_is_map(job)) + { + gearman_job_build_reducer(job, NULL); + } + + gearman_return_t error= _function(job, context_arg); + switch (error) + { + case GEARMAN_SHUTDOWN: + job->error_code= GEARMAN_SUCCESS; + return GEARMAN_FUNCTION_SHUTDOWN; + + case GEARMAN_FATAL: + job->error_code= GEARMAN_FATAL; + return GEARMAN_FUNCTION_FATAL; + + case GEARMAN_ERROR: + job->error_code= GEARMAN_ERROR; + return GEARMAN_FUNCTION_ERROR; + + case GEARMAN_SUCCESS: + job->error_code= GEARMAN_SUCCESS; + return GEARMAN_FUNCTION_SUCCESS; + + case GEARMAN_IO_WAIT: + case GEARMAN_SHUTDOWN_GRACEFUL: + case GEARMAN_ERRNO: + case GEARMAN_EVENT: + case GEARMAN_TOO_MANY_ARGS: + case GEARMAN_NO_ACTIVE_FDS: + case GEARMAN_INVALID_MAGIC: + case GEARMAN_INVALID_COMMAND: + case GEARMAN_INVALID_PACKET: + case GEARMAN_UNEXPECTED_PACKET: + case GEARMAN_GETADDRINFO: + case GEARMAN_NO_SERVERS: + case GEARMAN_LOST_CONNECTION: + case GEARMAN_MEMORY_ALLOCATION_FAILURE: + case GEARMAN_JOB_EXISTS: + case GEARMAN_JOB_QUEUE_FULL: + case GEARMAN_SERVER_ERROR: + case GEARMAN_WORK_DATA: + case GEARMAN_WORK_WARNING: + case GEARMAN_WORK_STATUS: + case GEARMAN_WORK_EXCEPTION: + case GEARMAN_NOT_CONNECTED: + case GEARMAN_COULD_NOT_CONNECT: + case GEARMAN_SEND_IN_PROGRESS: + case GEARMAN_RECV_IN_PROGRESS: + case GEARMAN_NOT_FLUSHING: + case GEARMAN_DATA_TOO_LARGE: + case GEARMAN_INVALID_FUNCTION_NAME: + case GEARMAN_INVALID_WORKER_FUNCTION: + case GEARMAN_NO_REGISTERED_FUNCTION: + case GEARMAN_NO_REGISTERED_FUNCTIONS: + case GEARMAN_NO_JOBS: + case GEARMAN_ECHO_DATA_CORRUPTION: + case GEARMAN_NEED_WORKLOAD_FN: + case GEARMAN_PAUSE: + case GEARMAN_UNKNOWN_STATE: + case GEARMAN_PTHREAD: + case GEARMAN_PIPE_EOF: + case GEARMAN_QUEUE_ERROR: + case GEARMAN_FLUSH_DATA: + case GEARMAN_SEND_BUFFER_TOO_SMALL: + case GEARMAN_IGNORE_PACKET: + case GEARMAN_UNKNOWN_OPTION: + case GEARMAN_TIMEOUT: + case GEARMAN_ARGUMENT_TOO_LARGE: + case GEARMAN_INVALID_ARGUMENT: + case GEARMAN_IN_PROGRESS: + case GEARMAN_MAX_RETURN: + break; + } + + return GEARMAN_FUNCTION_INVALID_ARGUMENT; +} diff -Nru gearmand-0.14/libgearman/function/function_v2.hpp gearmand-0.23/libgearman/function/function_v2.hpp --- gearmand-0.14/libgearman/function/function_v2.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/function_v2.hpp 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,59 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/* + FunctionV2 function +*/ +class FunctionV2: public _worker_function_st +{ + gearman_function_fn *_function; + +public: + FunctionV2(gearman_function_fn *_function_arg, void *context_arg) : + _worker_function_st(context_arg), + _function(_function_arg) + { } + + bool has_callback() const + { + return bool(_function); + } + + gearman_function_error_t callback(gearman_job_st* job, void *context_arg); +}; diff -Nru gearmand-0.14/libgearman/function/make.cc gearmand-0.23/libgearman/function/make.cc --- gearmand-0.14/libgearman/function/make.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/make.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,84 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +_worker_function_st *make(gearman_vector_st* namespace_arg, + const char *name, size_t name_length, + const gearman_function_t &function_arg, + void *context_arg) +{ + _worker_function_st *function= NULL; + + switch (function_arg.kind) + { + case GEARMAN_WORKER_FUNCTION_V1: + function= new (std::nothrow) FunctionV1(function_arg.callback.function_v1.func, context_arg); + break; + + case GEARMAN_WORKER_FUNCTION_V2: + function= new (std::nothrow) FunctionV2(function_arg.callback.function_v2.func, context_arg); + break; + + case GEARMAN_WORKER_FUNCTION_PARTITION: + function= new (std::nothrow) Partition(function_arg.callback.partitioner.func, + function_arg.callback.partitioner.aggregator, + context_arg); + break; + + case GEARMAN_WORKER_FUNCTION_NULL: + function= new (std::nothrow) Null(context_arg); + break; + } + + if (function and not function->init(namespace_arg, name, name_length)) + { + delete function; + return NULL; + } + + return function; +} diff -Nru gearmand-0.14/libgearman/function/make.hpp gearmand-0.23/libgearman/function/make.hpp --- gearmand-0.14/libgearman/function/make.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/make.hpp 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,45 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +struct _worker_function_st; + +_worker_function_st *make(gearman_vector_st* namespace_arg, + const char *name, size_t name_length, + const gearman_function_t &function_arg, + void *context_arg); diff -Nru gearmand-0.14/libgearman/function/null.hpp gearmand-0.23/libgearman/function/null.hpp --- gearmand-0.14/libgearman/function/null.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/null.hpp 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,62 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/** + Private structure. +*/ +class Null: public _worker_function_st +{ + +public: + Null(void *context_arg) : + _worker_function_st(context_arg) + { } + + bool has_callback() const + { + return false; + } + + gearman_function_error_t callback(gearman_job_st*, void *) + { + return GEARMAN_FUNCTION_FATAL; + } +}; + + diff -Nru gearmand-0.14/libgearman/function/partition.cc gearmand-0.23/libgearman/function/partition.cc --- gearmand-0.14/libgearman/function/partition.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/partition.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,125 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +/* + Partition function +*/ +gearman_function_error_t Partition::callback(gearman_job_st* job, void *context_arg) +{ + if (gearman_job_is_map(job)) + { + gearman_job_build_reducer(job, aggregator_fn); + } + + gearman_return_t error= _partition_fn(job, context_arg); + switch (error) + { + case GEARMAN_FATAL: + job->error_code= GEARMAN_FATAL; + return GEARMAN_FUNCTION_FATAL; + + case GEARMAN_SHUTDOWN: + job->error_code= GEARMAN_SUCCESS; + return GEARMAN_FUNCTION_SHUTDOWN; + + case GEARMAN_ERROR: + job->error_code= GEARMAN_ERROR; + return GEARMAN_FUNCTION_ERROR; + + case GEARMAN_SUCCESS: + job->error_code= GEARMAN_SUCCESS; + return GEARMAN_FUNCTION_SUCCESS; + + case GEARMAN_IO_WAIT: + case GEARMAN_SHUTDOWN_GRACEFUL: + case GEARMAN_ERRNO: + case GEARMAN_EVENT: + case GEARMAN_TOO_MANY_ARGS: + case GEARMAN_NO_ACTIVE_FDS: + case GEARMAN_INVALID_MAGIC: + case GEARMAN_INVALID_COMMAND: + case GEARMAN_INVALID_PACKET: + case GEARMAN_UNEXPECTED_PACKET: + case GEARMAN_GETADDRINFO: + case GEARMAN_NO_SERVERS: + case GEARMAN_LOST_CONNECTION: + case GEARMAN_MEMORY_ALLOCATION_FAILURE: + case GEARMAN_JOB_EXISTS: + case GEARMAN_JOB_QUEUE_FULL: + case GEARMAN_SERVER_ERROR: + case GEARMAN_WORK_DATA: + case GEARMAN_WORK_WARNING: + case GEARMAN_WORK_STATUS: + case GEARMAN_WORK_EXCEPTION: + case GEARMAN_NOT_CONNECTED: + case GEARMAN_COULD_NOT_CONNECT: + case GEARMAN_SEND_IN_PROGRESS: + case GEARMAN_RECV_IN_PROGRESS: + case GEARMAN_NOT_FLUSHING: + case GEARMAN_DATA_TOO_LARGE: + case GEARMAN_INVALID_FUNCTION_NAME: + case GEARMAN_INVALID_WORKER_FUNCTION: + case GEARMAN_NO_REGISTERED_FUNCTION: + case GEARMAN_NO_REGISTERED_FUNCTIONS: + case GEARMAN_NO_JOBS: + case GEARMAN_ECHO_DATA_CORRUPTION: + case GEARMAN_NEED_WORKLOAD_FN: + case GEARMAN_PAUSE: + case GEARMAN_UNKNOWN_STATE: + case GEARMAN_PTHREAD: + case GEARMAN_PIPE_EOF: + case GEARMAN_QUEUE_ERROR: + case GEARMAN_FLUSH_DATA: + case GEARMAN_SEND_BUFFER_TOO_SMALL: + case GEARMAN_IGNORE_PACKET: + case GEARMAN_UNKNOWN_OPTION: + case GEARMAN_TIMEOUT: + case GEARMAN_ARGUMENT_TOO_LARGE: + case GEARMAN_INVALID_ARGUMENT: + case GEARMAN_IN_PROGRESS: + case GEARMAN_MAX_RETURN: + break; + } + + return GEARMAN_FUNCTION_INVALID_ARGUMENT; +} diff -Nru gearmand-0.14/libgearman/function/partition.hpp gearmand-0.23/libgearman/function/partition.hpp --- gearmand-0.14/libgearman/function/partition.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function/partition.hpp 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,61 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/* + Partition function +*/ +class Partition: public _worker_function_st +{ + gearman_function_fn *_partition_fn; + gearman_aggregator_fn *aggregator_fn; + +public: + Partition(gearman_function_fn *partition_fn_arg, gearman_aggregator_fn *aggregator_fn_arg, void *context_arg) : + _worker_function_st(context_arg), + _partition_fn(partition_fn_arg), + aggregator_fn(aggregator_fn_arg) + { } + + bool has_callback() const + { + return bool(_partition_fn); + } + + gearman_function_error_t callback(gearman_job_st* job, void *context_arg); +}; diff -Nru gearmand-0.14/libgearman/function.cc gearmand-0.23/libgearman/function.cc --- gearmand-0.14/libgearman/function.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,73 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +gearman_function_t gearman_function_create_v1(gearman_worker_fn func) +{ + gearman_function_t _function= { GEARMAN_WORKER_FUNCTION_V1, { { 0 } } }; + + _function.callback.function_v1.func= func; + + return _function; +} + +gearman_function_t gearman_function_create(gearman_function_fn func) +{ + gearman_function_t _function= { GEARMAN_WORKER_FUNCTION_V2, { { 0 } } }; + + _function.callback.function_v2.func= func; + + return _function; +} + +gearman_function_t gearman_function_create_null() +{ + gearman_function_t _function= { GEARMAN_WORKER_FUNCTION_NULL, { { 0 } } }; + + return _function; +} + +gearman_function_t gearman_function_create_partition(gearman_function_fn func, + gearman_aggregator_fn aggregator) +{ + gearman_function_t _function= { GEARMAN_WORKER_FUNCTION_PARTITION, { { 0 } } }; + + _function.callback.partitioner.func= func; + _function.callback.partitioner.aggregator= aggregator; + return _function; +} diff -Nru gearmand-0.14/libgearman/function.h gearmand-0.23/libgearman/function.h --- gearmand-0.14/libgearman/function.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/function.h 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,99 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +#include +#else +#include +#endif + +enum gearman_function_kind_t { + GEARMAN_WORKER_FUNCTION_NULL, + GEARMAN_WORKER_FUNCTION_V1, + GEARMAN_WORKER_FUNCTION_V2, + GEARMAN_WORKER_FUNCTION_PARTITION +}; + +struct gearman_function_v1_t { + gearman_worker_fn *func; +}; + +struct gearman_function_v2_t { + gearman_function_fn *func; +}; + +struct gearman_function_partition_v1_t { + gearman_function_fn *func; + gearman_aggregator_fn *aggregator; +}; + +struct gearman_function_t { + const enum gearman_function_kind_t kind; + union { + char bytes[sizeof(struct gearman_function_partition_v1_t)]; // @note gearman_function_partition_v1_t is the largest structure + struct gearman_function_v1_t function_v1; + struct gearman_function_v2_t function_v2; + struct gearman_function_partition_v1_t partitioner; + } callback; +}; + +#ifndef __cplusplus +typedef struct gearman_function_t gearman_function_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_API + gearman_function_t gearman_function_create(gearman_function_fn func); + +GEARMAN_LOCAL + gearman_function_t gearman_function_create_null(void); + +GEARMAN_API + gearman_function_t gearman_function_create_partition(gearman_function_fn func, + gearman_aggregator_fn aggregator); + +GEARMAN_API + gearman_function_t gearman_function_create_v1(gearman_worker_fn func); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/gearman.c gearmand-0.23/libgearman/gearman.c --- gearmand-0.14/libgearman/gearman.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/gearman.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,115 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman State Definitions - */ - -#include "common.h" - -/** - * @addtogroup gearman_universal_static Static Gearman Declarations - * @ingroup gearman_universal - * @{ - */ - -/** - * Names of the verbose levels provided. - */ -static const char *_verbose_name[GEARMAN_VERBOSE_MAX]= -{ - "NEVER", - "FATAL", - "ERROR", - "INFO", - "DEBUG", - "CRAZY" -}; - -/** @} */ - -/* - * Public Definitions - */ - -const char *gearman_version(void) -{ - return PACKAGE_VERSION; -} - -const char *gearman_bugreport(void) -{ - return PACKAGE_BUGREPORT; -} - -const char *gearman_verbose_name(gearman_verbose_t verbose) -{ - if (verbose >= GEARMAN_VERBOSE_MAX) - return "UNKNOWN"; - - return _verbose_name[verbose]; -} - -gearman_return_t gearman_parse_servers(const char *servers, - gearman_parse_server_fn *function, - void *context) -{ - const char *ptr= servers; - size_t x; - char host[NI_MAXHOST]; - char port[NI_MAXSERV]; - gearman_return_t ret; - - if (ptr == NULL) - return (*function)(NULL, 0, (void *)context); - - while (1) - { - x= 0; - - while (*ptr != 0 && *ptr != ',' && *ptr != ':') - { - if (x < (NI_MAXHOST - 1)) - host[x++]= *ptr; - - ptr++; - } - - host[x]= 0; - - if (*ptr == ':') - { - ptr++; - x= 0; - - while (*ptr != 0 && *ptr != ',') - { - if (x < (NI_MAXSERV - 1)) - port[x++]= *ptr; - - ptr++; - } - - port[x]= 0; - } - else - port[0]= 0; - - ret= (*function)(host, (in_port_t)atoi(port), (void *)context); - if (ret != GEARMAN_SUCCESS) - return ret; - - if (*ptr == 0) - break; - - ptr++; - } - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman/gearman.cc gearmand-0.23/libgearman/gearman.cc --- gearmand-0.14/libgearman/gearman.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/gearman.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,94 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * @file + * @brief Gearman State Definitions + */ + +#include + +#include +#include +#include +#include + +/** + * @addtogroup gearman_universal_static Static Gearman Declarations + * @ingroup gearman_universal + * @{ + */ + +/** + * Names of the verbose levels provided. + */ +static const char *_verbose_name[GEARMAN_VERBOSE_MAX]= +{ + "NEVER", + "FATAL", + "ERROR", + "INFO", + "DEBUG", + "CRAZY" +}; + +/** @} */ + +/* + * Public Definitions + */ + +const char *gearman_version(void) +{ + return PACKAGE_VERSION; +} + +const char *gearman_bugreport(void) +{ + return PACKAGE_BUGREPORT; +} + +const char *gearman_verbose_name(gearman_verbose_t verbose) +{ + if (verbose >= GEARMAN_VERBOSE_MAX) + return "UNKNOWN"; + + return _verbose_name[verbose]; +} diff -Nru gearmand-0.14/libgearman/gearman.h gearmand-0.23/libgearman/gearman.h --- gearmand-0.14/libgearman/gearman.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/gearman.h 2011-06-18 19:49:08.000000000 +0200 @@ -1,45 +1,82 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ + /** * @file * @brief Gearman Declarations */ -#ifndef __GEARMAN_H__ -#define __GEARMAN_H__ +#pragma once #include #ifndef __cplusplus # include #endif -#include #include #include #include #include #include #include -#include -#include #include -#include +#include #include +#include +#include #include +#include // Everything above this line must be in the order specified. +#include +#include #include #include #include +#include +#include +#include #include #include +#include +#include #ifdef __cplusplus extern "C" { @@ -86,19 +123,6 @@ const char *gearman_verbose_name(gearman_verbose_t verbose); /** - * Utility function used for parsing server lists. - * - * @param[in] servers String containing a list of servers to parse. - * @param[in] callback Function to call for each server that is found. - * @param[in] context Argument to pass along with callback function. - * @return Standard Gearman return value. - */ -GEARMAN_API -gearman_return_t gearman_parse_servers(const char *servers, - gearman_parse_server_fn *callback, - void *context); - -/** * Get current socket I/O activity timeout value. * * @param[in] gearman_client_st or gearman_worker_st Structure previously initialized. @@ -124,4 +148,12 @@ } #endif -#endif /* __GEARMAN_H__ */ +#ifdef __cplusplus +#define gearman_literal_param(X) (X), static_cast(sizeof(X) - 1) +#define gearman_literal_param_size(X) static_cast(sizeof(X) - 1) +#else +#define gearman_literal_param(X) (X), (size_t)(sizeof(X) - 1) +#define gearman_literal_param_size(X) (size_t)(sizeof(X) - 1) +#endif + +#define gearman_c_str_param(X) (X) ? (X) : NULL, (X) ? strlen(X) : 0 diff -Nru gearmand-0.14/libgearman/include.am gearmand-0.23/libgearman/include.am --- gearmand-0.14/libgearman/include.am 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/include.am 2011-06-29 22:18:02.000000000 +0200 @@ -1,8 +1,8 @@ # vim:ft=automake # Gearman server and library -# Copyright (C) 2008 Brian Aker, Eric Day +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2009-2010 Brian Aker, Eric Day, Monty Taylor All rights -# reserved. +# Copyright (C) 2008 Brian Aker, Eric Day # # Use and distribution licensed under the BSD license. See # the COPYING file in the parent directory for full text. @@ -11,65 +11,128 @@ # All paths should be given relative to the root nobase_include_HEADERS+= \ + libgearman/actions.h \ + libgearman/aggregator.h \ + libgearman/allocator.h \ + libgearman/argument.h \ libgearman/byteorder.h \ libgearman/client.h \ + libgearman/client_callbacks.h \ libgearman/command.h \ libgearman/configure.h \ libgearman/connection.h \ libgearman/constants.h \ libgearman/core.h \ + libgearman/execute.h \ + libgearman/function.h \ libgearman/gearman.h \ libgearman/job.h \ + libgearman/job_handle.h \ libgearman/log.h \ libgearman/packet.h \ + libgearman/parse.h \ + libgearman/priority.h \ + libgearman/protocol.h \ + libgearman/result.h \ + libgearman/return.h \ libgearman/strerror.h \ + libgearman/string.h \ libgearman/task.h \ + libgearman/task_attr.h \ libgearman/universal.h \ + libgearman/version.h \ libgearman/visibility.h \ libgearman/worker.h noinst_HEADERS+= \ + libgearman/add.hpp \ + libgearman/aggregator.hpp \ + libgearman/allocator.hpp \ + libgearman/assert.hpp \ libgearman/common.h \ - libgearman/log.h + libgearman/connection.hpp \ + libgearman/do.hpp \ + libgearman/error.hpp \ + libgearman/function/base.hpp \ + libgearman/function/function_v1.hpp \ + libgearman/function/function_v2.hpp \ + libgearman/function/make.hpp \ + libgearman/function/null.hpp \ + libgearman/function/partition.hpp \ + libgearman/is.hpp \ + libgearman/log.h \ + libgearman/packet.hpp \ + libgearman/result.hpp \ + libgearman/run.hpp \ + libgearman/strcommand.h \ + libgearman/unique.h \ + libgearman/universal.hpp \ + libgearman/vector.hpp noinst_LTLIBRARIES+= libgearman/libgearmancore.la libgearman_libgearmancore_la_SOURCES= \ - libgearman/byteorder.c \ - libgearman/connection.c \ - libgearman/log.c \ - libgearman/packet.c \ - libgearman/universal.c - -libgearman_libgearmancore_la_CFLAGS= \ - ${AM_CFLAGS} - -#libgearman_libgearmancore_la_LDFLAGS= \ -# $(AM_LDFLAGS) \ -# -version-info \ -# $(GEARMAN_LIBRARY_VERSION) -# -#libgearman_libgearmancore_la_LIBADD= \ -# $(LTLIBUUID) + libgearman/allocator.cc \ + libgearman/byteorder.cc \ + libgearman/command.cc \ + libgearman/connection.cc \ + libgearman/error.cc \ + libgearman/log.cc \ + libgearman/packet.cc \ + libgearman/strcommand.cc \ + libgearman/strerror.cc \ + libgearman/universal.cc \ + libgearman/vector.cc + +libgearman_libgearmancore_la_CXXFLAGS= \ + ${AM_CXXFLAGS} \ + -DBUILDING_LIBGEARMAN lib_LTLIBRARIES+= libgearman/libgearman.la libgearman_libgearman_la_SOURCES= \ - libgearman/client.c \ - libgearman/gearman.c \ - libgearman/job.c \ - libgearman/strerror.c \ - libgearman/task.c \ - libgearman/worker.c - -libgearman_libgearman_la_DEPENDENCIES= libgearman/libgearmancore.la - -libgearman_libgearman_la_CFLAGS= \ - ${AM_CFLAGS} + libgearman/actions.cc \ + libgearman/aggregator.cc \ + libgearman/allocator.cc \ + libgearman/argument.cc \ + libgearman/add.cc \ + libgearman/byteorder.cc \ + libgearman/client.cc \ + libgearman/command.cc \ + libgearman/connection.cc \ + libgearman/do.cc \ + libgearman/error.cc \ + libgearman/execute.cc \ + libgearman/function.cc \ + libgearman/function/function_v2.cc \ + libgearman/function/make.cc \ + libgearman/function/partition.cc \ + libgearman/gearman.cc \ + libgearman/job.cc \ + libgearman/log.cc \ + libgearman/packet.cc \ + libgearman/parse.cc \ + libgearman/result.cc \ + libgearman/run.cc \ + libgearman/strcommand.cc \ + libgearman/strerror.cc \ + libgearman/string.cc \ + libgearman/task.cc \ + libgearman/task_attr.cc \ + libgearman/unique.cc \ + libgearman/universal.cc \ + libgearman/vector.cc \ + libgearman/worker.cc + +libgearman_libgearman_la_DEPENDENCIES= + +libgearman_libgearman_la_CXXFLAGS= \ + ${AM_CXXFLAGS} \ + -DBUILDING_LIBGEARMAN libgearman_libgearman_la_LDFLAGS= \ $(AM_LDFLAGS) \ -version-info $(GEARMAN_LIBRARY_VERSION) libgearman_libgearman_la_LIBADD= \ - libgearman/libgearmancore.la \ - $(LTLIBUUID) + $(LTLIBUUID) +DISTCLEANFILES+= config/top.h diff -Nru gearmand-0.14/libgearman/is.hpp gearmand-0.23/libgearman/is.hpp --- gearmand-0.14/libgearman/is.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/is.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,48 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearman + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/* These are private */ +#define gearman_is_allocated(__object) ((__object)->options.is_allocated) +#define gearman_is_initialized(__object) ((__object)->options.is_initialized) +#define gearman_is_purging(__object) ((__object)->state.is_purging) +#define gearman_is_processing_input(__object) ((__object)->state.is_processing_input) +#define gearman_set_purging(__object, __value) ((__object)->state.is_purging= (__value)) +#define gearman_set_processing_input(__object, __value) ((__object)->state.is_processing_input= (__value)) +#define gearman_set_initialized(__object, __value) ((__object)->options.is_initialized(= (__value)) +#define gearman_set_allocated(__object, __value) ((__object)->options.is_allocated= (__value)) diff -Nru gearmand-0.14/libgearman/job.c gearmand-0.23/libgearman/job.c --- gearmand-0.14/libgearman/job.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/job.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,300 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Job Definitions - */ - -#include "common.h" - -/** - * @addtogroup gearman_job_static Static Job Declarations - * @ingroup gearman_job - * @{ - */ - -/** - * Send a packet for a job. - */ -static gearman_return_t _job_send(gearman_job_st *job); - -/** @} */ - -/* - * Public Definitions - */ - -gearman_job_st *gearman_job_create(gearman_worker_st *worker, - gearman_job_st *job) -{ - if (job == NULL) - { - job= malloc(sizeof(gearman_job_st)); - if (job == NULL) - { - gearman_universal_set_error((&worker->universal), "_job_create", "malloc"); - return NULL; - } - - job->options.allocated= true; - } - else - { - job->options.allocated= false; - } - - job->options.assigned_in_use= false; - job->options.work_in_use= false; - job->options.finished= false; - - job->worker= worker; - - if (worker->job_list != NULL) - worker->job_list->prev= job; - job->next= worker->job_list; - job->prev= NULL; - worker->job_list= job; - worker->job_count++; - - job->con= NULL; - - return job; -} - - -gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, - size_t data_size) -{ - gearman_return_t ret; - const void *args[2]; - size_t args_size[2]; - - if (! (job->options.work_in_use)) - { - args[0]= job->assigned.arg[0]; - args_size[0]= job->assigned.arg_size[0]; - args[1]= data; - args_size[1]= data_size; - ret= gearman_packet_create_args(&(job->worker->universal), &(job->work), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_DATA, - args, args_size, 2); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.work_in_use= true; - } - - return _job_send(job); -} - -gearman_return_t gearman_job_send_warning(gearman_job_st *job, - const void *warning, - size_t warning_size) -{ - gearman_return_t ret; - const void *args[2]; - size_t args_size[2]; - - if (! (job->options.work_in_use)) - { - args[0]= job->assigned.arg[0]; - args_size[0]= job->assigned.arg_size[0]; - args[1]= warning; - args_size[1]= warning_size; - ret= gearman_packet_create_args(&(job->worker->universal), &(job->work), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_WARNING, - args, args_size, 2); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.work_in_use= true; - } - - return _job_send(job); -} - -gearman_return_t gearman_job_send_status(gearman_job_st *job, - uint32_t numerator, - uint32_t denominator) -{ - gearman_return_t ret; - char numerator_string[12]; - char denominator_string[12]; - const void *args[3]; - size_t args_size[3]; - - if (! (job->options.work_in_use)) - { - snprintf(numerator_string, 12, "%u", numerator); - snprintf(denominator_string, 12, "%u", denominator); - - args[0]= job->assigned.arg[0]; - args_size[0]= job->assigned.arg_size[0]; - args[1]= numerator_string; - args_size[1]= strlen(numerator_string) + 1; - args[2]= denominator_string; - args_size[2]= strlen(denominator_string); - ret= gearman_packet_create_args(&(job->worker->universal), &(job->work), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_STATUS, - args, args_size, 3); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.work_in_use= true; - } - - return _job_send(job); -} - -gearman_return_t gearman_job_send_complete(gearman_job_st *job, - const void *result, - size_t result_size) -{ - gearman_return_t ret; - const void *args[2]; - size_t args_size[2]; - - if (job->options.finished) - return GEARMAN_SUCCESS; - - if (! (job->options.work_in_use)) - { - args[0]= job->assigned.arg[0]; - args_size[0]= job->assigned.arg_size[0]; - args[1]= result; - args_size[1]= result_size; - ret= gearman_packet_create_args(&(job->worker->universal), &(job->work), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_COMPLETE, - args, args_size, 2); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.work_in_use= true; - } - - ret= _job_send(job); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.finished= true; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_job_send_exception(gearman_job_st *job, - const void *exception, - size_t exception_size) -{ - gearman_return_t ret; - const void *args[2]; - size_t args_size[2]; - - if (! (job->options.work_in_use)) - { - args[0]= job->assigned.arg[0]; - args_size[0]= job->assigned.arg_size[0]; - args[1]= exception; - args_size[1]= exception_size; - ret= gearman_packet_create_args(&(job->worker->universal), &(job->work), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_EXCEPTION, - args, args_size, 2); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.work_in_use= true; - } - - return _job_send(job); -} - -gearman_return_t gearman_job_send_fail(gearman_job_st *job) -{ - gearman_return_t ret; - const void *args[1]; - size_t args_size[1]; - - if (job->options.finished) - return GEARMAN_SUCCESS; - - if (! (job->options.work_in_use)) - { - args[0]= job->assigned.arg[0]; - args_size[0]= job->assigned.arg_size[0] - 1; - ret= gearman_packet_create_args(&(job->worker->universal), &(job->work), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_FAIL, - args, args_size, 1); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.work_in_use= true; - } - - ret= _job_send(job); - if (ret != GEARMAN_SUCCESS) - return ret; - - job->options.finished= true; - return GEARMAN_SUCCESS; -} - -const char *gearman_job_handle(const gearman_job_st *job) -{ - return (const char *)job->assigned.arg[0]; -} - -const char *gearman_job_function_name(const gearman_job_st *job) -{ - return (const char *)job->assigned.arg[1]; -} - -const char *gearman_job_unique(const gearman_job_st *job) -{ - if (job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_UNIQ) - return (const char *)job->assigned.arg[2]; - return ""; -} - -const void *gearman_job_workload(const gearman_job_st *job) -{ - return job->assigned.data; -} - -size_t gearman_job_workload_size(const gearman_job_st *job) -{ - return job->assigned.data_size; -} - -void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size) -{ - return gearman_packet_take_data(&(job->assigned), data_size); -} - -/* - * Static Definitions - */ - -static gearman_return_t _job_send(gearman_job_st *job) -{ - gearman_return_t ret; - - ret= gearman_connection_send(job->con, &(job->work), true); - if (ret != GEARMAN_SUCCESS) - return ret; - - gearman_packet_free(&(job->work)); - job->options.work_in_use= false; - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman/job.cc gearmand-0.23/libgearman/job.cc --- gearmand-0.14/libgearman/job.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/job.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,582 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct gearman_job_reducer_st { + gearman_universal_st &universal; + gearman_client_st *client; + gearman_result_st result; + gearman_vector_st *reducer_function; + gearman_aggregator_fn *aggregator_fn; + + gearman_job_reducer_st(gearman_universal_st &universal_arg, + const gearman_string_t &reducer_function_name, + gearman_aggregator_fn *aggregator_fn_arg): + universal(universal_arg), + client(NULL), + reducer_function(NULL), + aggregator_fn(aggregator_fn_arg) + { + assert_msg(gearman_size(reducer_function_name), "Trying to creat a function with zero length"); + reducer_function= gearman_string_create(NULL, gearman_size(reducer_function_name)); + gearman_string_append(reducer_function, gearman_string_param(reducer_function_name)); + } + + ~gearman_job_reducer_st() + { + gearman_client_free(client); + gearman_string_free(reducer_function); + } + + bool init() + { + client= gearman_client_create(NULL); + if (not client) + return false; + + if (universal._namespace) + { + gearman_client_set_namespace(client, + gearman_string_value(universal._namespace), + gearman_string_length(universal._namespace)); + } + + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + if (gearman_failed(gearman_client_add_server(client, con->host, con->port))) + { + return false; + } + } + + return true; + } + + bool add(gearman_argument_t &arguments) + { + gearman_string_t function= gearman_string(reducer_function); + gearman_unique_t unique= gearman_unique_make(0, 0); + gearman_task_st *task= add_task(client, + NULL, + GEARMAN_COMMAND_SUBMIT_JOB, + function, + unique, + arguments.value, + time_t(0), + gearman_actions_execute_defaults()); + if (not task) + { + gearman_universal_error_code(client->universal); + + return false; + } + + return true; + } + + gearman_return_t complete() + { + gearman_return_t rc; + if (gearman_failed(rc= gearman_client_run_tasks(client))) + { + return rc; + } + + gearman_task_st *check_task= client->task_list; + do + { + if (gearman_failed(check_task->result_rc)) + { + return check_task->result_rc; + } + } while ((check_task= gearman_next(check_task))); + + if (aggregator_fn) + { + gearman_aggregator_st aggregator(client->context); + aggregator_fn(&aggregator, client->task_list, &result); + } + + return GEARMAN_SUCCESS; + } +}; + +/** + * @addtogroup gearman_job_static Static Job Declarations + * @ingroup gearman_job + * @{ + */ + +/** + * Send a packet for a job. + */ +static gearman_return_t _job_send(gearman_job_st *job); + +/* + * Public Definitions + */ + +gearman_job_st *gearman_job_create(gearman_worker_st *worker, gearman_job_st *job) +{ + if (job) + { + job->options.allocated= false; + } + else + { + job= new (std::nothrow) gearman_job_st; + if (not job) + { + gearman_perror(worker->universal, "new"); + return NULL; + } + + job->options.allocated= true; + } + + job->options.assigned_in_use= false; + job->options.work_in_use= false; + job->options.finished= false; + + job->worker= worker; + job->reducer= NULL; + job->error_code= GEARMAN_UNKNOWN_STATE; + + if (worker->job_list) + worker->job_list->prev= job; + job->next= worker->job_list; + job->prev= NULL; + worker->job_list= job; + worker->job_count++; + + job->con= NULL; + + return job; +} + +bool gearman_job_build_reducer(gearman_job_st *job, gearman_aggregator_fn *aggregator_fn) +{ + if (job->reducer) + { + return true; + } + + gearman_string_t reducer_func= gearman_job_reducer_string(job); + + job->reducer= new (std::nothrow) gearman_job_reducer_st(job->worker->universal, reducer_func, aggregator_fn); + if (not job->reducer) + { + gearman_job_free(job); + return false; + } + + if (not job->reducer->init()) + { + gearman_job_free(job); + return false; + } + + return true; +} + + +gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size) +{ + gearman_return_t ret; + const void *args[2]; + size_t args_size[2]; + + if (job->reducer) + { + gearman_argument_t value= gearman_argument_make(NULL, 0, static_cast(data), data_size); + job->reducer->add(value); + + return GEARMAN_SUCCESS; + } + + if (not (job->options.work_in_use)) + { + args[0]= job->assigned.arg[0]; + args_size[0]= job->assigned.arg_size[0]; + args[1]= data; + args_size[1]= data_size; + ret= gearman_packet_create_args(job->worker->universal, job->work, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_DATA, + args, args_size, 2); + if (gearman_failed(ret)) + return ret; + + job->options.work_in_use= true; + } + + return _job_send(job); +} + +gearman_return_t gearman_job_send_warning(gearman_job_st *job, + const void *warning, + size_t warning_size) +{ + const void *args[2]; + size_t args_size[2]; + + if (not (job->options.work_in_use)) + { + args[0]= job->assigned.arg[0]; + args_size[0]= job->assigned.arg_size[0]; + args[1]= warning; + args_size[1]= warning_size; + + gearman_return_t ret; + ret= gearman_packet_create_args(job->worker->universal, job->work, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_WARNING, + args, args_size, 2); + if (gearman_failed(ret)) + return ret; + + job->options.work_in_use= true; + } + + return _job_send(job); +} + +gearman_return_t gearman_job_send_status(gearman_job_st *job, + uint32_t numerator, + uint32_t denominator) +{ + char numerator_string[12]; + char denominator_string[12]; + const void *args[3]; + size_t args_size[3]; + + if (not (job->options.work_in_use)) + { + snprintf(numerator_string, 12, "%u", numerator); + snprintf(denominator_string, 12, "%u", denominator); + + args[0]= job->assigned.arg[0]; + args_size[0]= job->assigned.arg_size[0]; + args[1]= numerator_string; + args_size[1]= strlen(numerator_string) + 1; + args[2]= denominator_string; + args_size[2]= strlen(denominator_string); + + gearman_return_t ret; + ret= gearman_packet_create_args(job->worker->universal, job->work, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_STATUS, + args, args_size, 3); + if (gearman_failed(ret)) + { + return ret; + } + + job->options.work_in_use= true; + } + + return _job_send(job); +} + +gearman_return_t gearman_job_send_complete(gearman_job_st *job, + const void *result, + size_t result_size) +{ + if (job->reducer) + { + return GEARMAN_INVALID_ARGUMENT; + } + + return gearman_job_send_complete_fin(job, result, result_size); +} + +gearman_return_t gearman_job_send_complete_fin(gearman_job_st *job, + const void *result, size_t result_size) +{ + if (job->options.finished) + { + return GEARMAN_SUCCESS; + } + + if (job->reducer) + { + if (result_size) + { + gearman_argument_t value= gearman_argument_make(NULL, 0, static_cast(result), result_size); + job->reducer->add(value); + } + + gearman_return_t rc= job->reducer->complete(); + if (gearman_failed(rc)) + { + return gearman_error(job->worker->universal, rc, "The reducer's complete() returned an error"); + } + + gearman_vector_st *reduced_value= job->reducer->result.string(); + if (reduced_value) + { + result= gearman_string_value(reduced_value); + result_size= gearman_string_length(reduced_value); + } + else + { + result= NULL; + result_size= 0; + } + } + + const void *args[2]; + size_t args_size[2]; + + if (not (job->options.work_in_use)) + { + args[0]= job->assigned.arg[0]; + args_size[0]= job->assigned.arg_size[0]; + + args[1]= result; + args_size[1]= result_size; + gearman_return_t ret= gearman_packet_create_args(job->worker->universal, job->work, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_COMPLETE, + args, args_size, 2); + if (gearman_failed(ret)) + { + return ret; + } + job->options.work_in_use= true; + } + + gearman_return_t ret= _job_send(job); + if (gearman_failed(ret)) + { + return ret; + } + + job->options.finished= true; + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_job_send_exception(gearman_job_st *job, + const void *exception, + size_t exception_size) +{ + const void *args[2]; + size_t args_size[2]; + + if (not (job->options.work_in_use)) + { + args[0]= job->assigned.arg[0]; + args_size[0]= job->assigned.arg_size[0]; + args[1]= exception; + args_size[1]= exception_size; + + gearman_return_t ret= gearman_packet_create_args(job->worker->universal, job->work, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_EXCEPTION, + args, args_size, 2); + if (gearman_failed(ret)) + return ret; + + job->options.work_in_use= true; + } + + return _job_send(job); +} + +gearman_return_t gearman_job_send_fail(gearman_job_st *job) +{ + if (job->reducer) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_job_send_fail_fin(job); +} + +gearman_return_t gearman_job_send_fail_fin(gearman_job_st *job) +{ + const void *args[1]; + size_t args_size[1]; + + if (job->options.finished) + return GEARMAN_SUCCESS; + + if (not (job->options.work_in_use)) + { + args[0]= job->assigned.arg[0]; + args_size[0]= job->assigned.arg_size[0] - 1; + gearman_return_t ret= gearman_packet_create_args(job->worker->universal, job->work, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_FAIL, + args, args_size, 1); + if (gearman_failed(ret)) + return ret; + + job->options.work_in_use= true; + } + + gearman_return_t ret; + ret= _job_send(job); + if (gearman_failed(ret)) + return ret; + + job->options.finished= true; + return GEARMAN_SUCCESS; +} + +const char *gearman_job_handle(const gearman_job_st *job) +{ + return static_cast(job->assigned.arg[0]); +} + +const char *gearman_job_function_name(const gearman_job_st *job) +{ + return static_cast(job->assigned.arg[1]); +} + +gearman_string_t gearman_job_function_name_string(const gearman_job_st *job) +{ + gearman_string_t temp= { job->assigned.arg[1], job->assigned.arg_size[1] }; + return temp; +} + +const char *gearman_job_unique(const gearman_job_st *job) +{ + if (job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_UNIQ or + job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL) + { + return static_cast(job->assigned.arg[2]); + } + + return ""; +} + +bool gearman_job_is_map(const gearman_job_st *job) +{ + return bool(job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL) and job->assigned.arg_size[3] > 1; +} + +gearman_string_t gearman_job_reducer_string(const gearman_job_st *job) +{ + if (job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL and job->assigned.arg_size[3] > 1) + { + gearman_string_t temp= { job->assigned.arg[3], job->assigned.arg_size[3] -1 }; + return temp; + } + + static gearman_string_t null_temp= { gearman_literal_param("") }; + + return null_temp; +} + +const char *gearman_job_reducer(const gearman_job_st *job) +{ + if (job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL) + return static_cast(job->assigned.arg[3]); + + return ""; +} + +const void *gearman_job_workload(const gearman_job_st *job) +{ + return job->assigned.data; +} + +size_t gearman_job_workload_size(const gearman_job_st *job) +{ + return job->assigned.data_size; +} + +void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size) +{ + return gearman_packet_take_data(job->assigned, data_size); +} + +void gearman_job_free(gearman_job_st *job) +{ + if (not job) + return; + + if (job->options.assigned_in_use) + gearman_packet_free(&(job->assigned)); + + if (job->options.work_in_use) + gearman_packet_free(&(job->work)); + + if (job->worker->job_list == job) + job->worker->job_list= job->next; + if (job->prev) + job->prev->next= job->next; + if (job->next) + job->next->prev= job->prev; + job->worker->job_count--; + + delete job->reducer; + job->reducer= NULL; + + if (job->options.allocated) + delete job; +} + +/* + * Static Definitions + */ + +static gearman_return_t _job_send(gearman_job_st *job) +{ + gearman_return_t ret= job->con->send(job->work, true); + if (gearman_failed(ret)) + return ret; + + gearman_packet_free(&(job->work)); + job->options.work_in_use= false; + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman/job.h gearmand-0.23/libgearman/job.h --- gearmand-0.14/libgearman/job.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/job.h 2011-06-29 22:18:02.000000000 +0200 @@ -1,9 +1,39 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ /** @@ -11,8 +41,25 @@ * @brief Job Declarations */ -#ifndef __GEARMAN_JOB_H__ -#define __GEARMAN_JOB_H__ +#pragma once + +struct gearman_job_st +{ + struct { + bool allocated; + bool assigned_in_use; + bool work_in_use; + bool finished; + } options; + gearman_worker_st *worker; + gearman_job_st *next; + gearman_job_st *prev; + gearman_connection_st *con; + gearman_packet_st assigned; + gearman_packet_st work; + struct gearman_job_reducer_st *reducer; + gearman_return_t error_code; +}; #ifdef __cplusplus extern "C" { @@ -28,26 +75,6 @@ * @{ */ - -/** - * @ingroup gearman_job - */ -struct gearman_job_st -{ - struct { - bool allocated LIBGEARMAN_BITFIELD; - bool assigned_in_use LIBGEARMAN_BITFIELD; - bool work_in_use LIBGEARMAN_BITFIELD; - bool finished LIBGEARMAN_BITFIELD; - } options; - gearman_worker_st *worker; - gearman_job_st *next; - gearman_job_st *prev; - gearman_connection_st *con; - gearman_packet_st assigned; - gearman_packet_st work; -}; - /** * Initialize a job structure. Always check the return value even if passing * in a pre-allocated structure. Some other initialization may have failed. It @@ -76,8 +103,8 @@ * Send data for a running job. */ GEARMAN_API -gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, - size_t data_size); +gearman_return_t gearman_job_send_data(gearman_job_st *job, + const void *data, size_t data_size); /** * Send warning for a running job. @@ -103,6 +130,10 @@ const void *result, size_t result_size); +GEARMAN_LOCAL +gearman_return_t gearman_job_send_complete_fin(gearman_job_st *job, + const void *result, size_t result_size); + /** * Send exception for a running job. */ @@ -117,6 +148,9 @@ GEARMAN_API gearman_return_t gearman_job_send_fail(gearman_job_st *job); +GEARMAN_LOCAL +gearman_return_t gearman_job_send_fail_fin(gearman_job_st *job); + /** * Get job handle. */ @@ -127,13 +161,28 @@ * Get the function name associated with a job. */ GEARMAN_API -const char *gearman_job_function_name(const gearman_job_st *job); + const char *gearman_job_function_name(const gearman_job_st *job); + +GEARMAN_LOCAL + gearman_string_t gearman_job_function_name_string(const gearman_job_st *); /** * Get the unique ID associated with a job. */ GEARMAN_API -const char *gearman_job_unique(const gearman_job_st *job); + const char *gearman_job_unique(const gearman_job_st *job); + +GEARMAN_LOCAL + gearman_string_t gearman_job_reducer_string(const gearman_job_st *job); + +GEARMAN_LOCAL + const char *gearman_job_reducer(const gearman_job_st *job); + +GEARMAN_LOCAL + bool gearman_job_is_map(const gearman_job_st *job); + +GEARMAN_LOCAL + bool gearman_job_build_reducer(gearman_job_st *job, gearman_aggregator_fn *aggregator_fn); /** * Get a pointer to the workload for a job. @@ -159,5 +208,3 @@ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_JOB_H__ */ diff -Nru gearmand-0.14/libgearman/job_handle.h gearmand-0.23/libgearman/job_handle.h --- gearmand-0.14/libgearman/job_handle.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/job_handle.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,40 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +typedef char gearman_job_handle_t[GEARMAN_JOB_HANDLE_SIZE]; diff -Nru gearmand-0.14/libgearman/log.c gearmand-0.23/libgearman/log.c --- gearmand-0.14/libgearman/log.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/log.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,101 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008-2009 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman State Definitions - */ - -#include "common.h" - - -void gearman_log(gearman_universal_st *state, gearman_verbose_t verbose, - const char *format, va_list args) -{ - char log_buffer[GEARMAN_MAX_ERROR_SIZE]; - - if (state->log_fn == NULL) - { - printf("%5s: ", gearman_verbose_name(verbose)); - vprintf(format, args); - printf("\n"); - } - else - { - vsnprintf(log_buffer, GEARMAN_MAX_ERROR_SIZE, format, args); - state->log_fn(log_buffer, verbose, (void *)state->log_context); - } -} - - -void gearman_log_fatal(gearman_universal_st *gearman, const char *format, - ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_FATAL) - { - va_start(args, format); - gearman_log(gearman, GEARMAN_VERBOSE_FATAL, format, args); - va_end(args); - } -} - -void gearman_log_error(gearman_universal_st *gearman, const char *format, - ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_ERROR) - { - va_start(args, format); - gearman_log(gearman, GEARMAN_VERBOSE_ERROR, format, args); - va_end(args); - } -} - -void gearman_log_info(gearman_universal_st *gearman, const char *format, - ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_INFO) - { - va_start(args, format); - gearman_log(gearman, GEARMAN_VERBOSE_INFO, format, args); - va_end(args); - } -} - -void gearman_log_debug(gearman_universal_st *gearman, const char *format, - ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_DEBUG) - { - va_start(args, format); - gearman_log(gearman, GEARMAN_VERBOSE_DEBUG, format, args); - va_end(args); - } -} - -void gearman_log_crazy(gearman_universal_st *gearman, const char *format, - ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_CRAZY) - { - va_start(args, format); - gearman_log(gearman, GEARMAN_VERBOSE_CRAZY, format, args); - va_end(args); - } -} - - diff -Nru gearmand-0.14/libgearman/log.cc gearmand-0.23/libgearman/log.cc --- gearmand-0.14/libgearman/log.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/log.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,125 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include + +#include + +#include + +#include + +void gearman_log(gearman_universal_st *state, gearman_verbose_t verbose, + const char *format, va_list args) +{ + char log_buffer[GEARMAN_MAX_ERROR_SIZE]; + + if (not state->log_fn) + { + vsnprintf(log_buffer, GEARMAN_MAX_ERROR_SIZE, format, args); + state->log_fn(log_buffer, verbose, state->log_context); + } +} + + +void gearman_log_fatal(gearman_universal_st *gearman, const char *format, + ...) +{ + va_list args; + + if (gearman->verbose >= GEARMAN_VERBOSE_FATAL) + { + va_start(args, format); + gearman_log(gearman, GEARMAN_VERBOSE_FATAL, format, args); + va_end(args); + } +} + +void gearman_log_error(gearman_universal_st *gearman, const char *format, + ...) +{ + va_list args; + + if (gearman->verbose >= GEARMAN_VERBOSE_ERROR) + { + va_start(args, format); + gearman_log(gearman, GEARMAN_VERBOSE_ERROR, format, args); + va_end(args); + } +} + +void gearman_log_info(gearman_universal_st *gearman, const char *format, + ...) +{ + va_list args; + + if (gearman->verbose >= GEARMAN_VERBOSE_INFO) + { + va_start(args, format); + gearman_log(gearman, GEARMAN_VERBOSE_INFO, format, args); + va_end(args); + } +} + +void gearman_log_debug(gearman_universal_st *gearman, const char *format, + ...) +{ + va_list args; + + if (gearman->verbose >= GEARMAN_VERBOSE_DEBUG) + { + va_start(args, format); + gearman_log(gearman, GEARMAN_VERBOSE_DEBUG, format, args); + va_end(args); + } +} + +void gearman_log_crazy(gearman_universal_st *gearman, const char *format, + ...) +{ + va_list args; + + if (gearman->verbose >= GEARMAN_VERBOSE_CRAZY) + { + va_start(args, format); + gearman_log(gearman, GEARMAN_VERBOSE_CRAZY, format, args); + va_end(args); + } +} diff -Nru gearmand-0.14/libgearman/log.h gearmand-0.23/libgearman/log.h --- gearmand-0.14/libgearman/log.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/log.h 2011-06-29 22:18:02.000000000 +0200 @@ -1,9 +1,39 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ /** @@ -11,19 +41,14 @@ * @brief Local Gearman Declarations */ -#ifndef __GEARMAN_LOG_H__ -#define __GEARMAN_LOG_H__ +#pragma once #ifdef __cplusplus extern "C" { #endif -#ifdef GEARMAN_CORE - -/** - * @addtogroup gearman_local Local Gearman Declarations - * @ingroup gearman_universal - * @{ +/** @addtogroup gearman_local Local Gearman Declarations @ingroup + * gearman_universal @{ */ /** @@ -69,12 +94,8 @@ GEARMAN_INTERNAL_API void gearman_log_crazy(gearman_universal_st *gearman, const char *format, ...); -#endif /* GEARMAN_CORE */ - /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_LOG_H__ */ diff -Nru gearmand-0.14/libgearman/packet.c gearmand-0.23/libgearman/packet.c --- gearmand-0.14/libgearman/packet.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/packet.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,519 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Packet Definitions - */ - -#include "common.h" - -/** - * @addtogroup gearman_packet_static Static Packet Declarations - * @ingroup gearman_packet - * @{ - */ - -/** - * Command info. Update GEARMAN_MAX_COMMAND_ARGS to the largest number in the - * args column. - */ -gearman_command_info_st gearman_command_info_list[GEARMAN_COMMAND_MAX]= -{ - { "TEXT", 3, false }, - { "CAN_DO", 1, false }, - { "CANT_DO", 1, false }, - { "RESET_ABILITIES", 0, false }, - { "PRE_SLEEP", 0, false }, - { "UNUSED", 0, false }, - { "NOOP", 0, false }, - { "SUBMIT_JOB", 2, true }, - { "JOB_CREATED", 1, false }, - { "GRAB_JOB", 0, false }, - { "NO_JOB", 0, false }, - { "JOB_ASSIGN", 2, true }, - { "WORK_STATUS", 3, false }, - { "WORK_COMPLETE", 1, true }, - { "WORK_FAIL", 1, false }, - { "GET_STATUS", 1, false }, - { "ECHO_REQ", 0, true }, - { "ECHO_RES", 0, true }, - { "SUBMIT_JOB_BG", 2, true }, - { "ERROR", 2, false }, - { "STATUS_RES", 5, false }, - { "SUBMIT_JOB_HIGH", 2, true }, - { "SET_CLIENT_ID", 1, false }, - { "CAN_DO_TIMEOUT", 2, false }, - { "ALL_YOURS", 0, false }, - { "WORK_EXCEPTION", 1, true }, - { "OPTION_REQ", 1, false }, - { "OPTION_RES", 1, false }, - { "WORK_DATA", 1, true }, - { "WORK_WARNING", 1, true }, - { "GRAB_JOB_UNIQ", 0, false }, - { "JOB_ASSIGN_UNIQ", 3, true }, - { "SUBMIT_JOB_HIGH_BG", 2, true }, - { "SUBMIT_JOB_LOW", 2, true }, - { "SUBMIT_JOB_LOW_BG", 2, true }, - { "SUBMIT_JOB_SCHED", 7, true }, - { "SUBMIT_JOB_EPOCH", 3, true } -}; - -inline static gearman_return_t packet_create_arg(gearman_packet_st *packet, - const void *arg, size_t arg_size) -{ - void *new_args; - size_t offset; - uint8_t x; - - if (packet->argc == gearman_command_info_list[packet->command].argc && - (! (gearman_command_info_list[packet->command].data) || - packet->data != NULL)) - { - gearman_universal_set_error(packet->universal, "gearman_packet_create_arg", - "too many arguments for command"); - return GEARMAN_TOO_MANY_ARGS; - } - - if (packet->argc == gearman_command_info_list[packet->command].argc) - { - packet->data= arg; - packet->data_size= arg_size; - return GEARMAN_SUCCESS; - } - - if (packet->args_size == 0 && packet->magic != GEARMAN_MAGIC_TEXT) - packet->args_size= GEARMAN_PACKET_HEADER_SIZE; - - if ((packet->args_size + arg_size) < GEARMAN_ARGS_BUFFER_SIZE) - { - packet->args= packet->args_buffer; - } - else - { - if (packet->args == packet->args_buffer) - packet->args= NULL; - - new_args= realloc(packet->args, packet->args_size + arg_size); - if (new_args == NULL) - { - gearman_universal_set_error(packet->universal, "gearman_packet_create_arg", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - if (packet->args_size > 0) - memcpy(new_args, packet->args_buffer, packet->args_size); - - packet->args= new_args; - } - - memcpy(packet->args + packet->args_size, arg, arg_size); - packet->args_size+= arg_size; - packet->arg_size[packet->argc]= arg_size; - packet->argc++; - - if (packet->magic == GEARMAN_MAGIC_TEXT) - { - offset= 0; - } - else - { - offset= GEARMAN_PACKET_HEADER_SIZE; - } - - for (x= 0; x < packet->argc; x++) - { - packet->arg[x]= packet->args + offset; - offset+= packet->arg_size[x]; - } - - return GEARMAN_SUCCESS; -} - -/** @} */ - -/* - * Public Definitions - */ - - -gearman_packet_st *gearman_packet_create(gearman_universal_st *gearman, - gearman_packet_st *packet) -{ - if (packet == NULL) - { - packet= malloc(sizeof(gearman_packet_st)); - if (packet == NULL) - { - gearman_universal_set_error(gearman, "gearman_packet_create", "malloc"); - return NULL; - } - - packet->options.allocated= true; - } - else - { - packet->options.allocated= false; - packet->options.complete= false; - packet->options.free_data= false; - } - - packet->magic= 0; - packet->command= 0; - packet->argc= 0; - packet->args_size= 0; - packet->data_size= 0; - packet->universal= gearman; - - if (! (gearman->options.dont_track_packets)) - { - if (gearman->packet_list != NULL) - gearman->packet_list->prev= packet; - packet->next= gearman->packet_list; - packet->prev= NULL; - gearman->packet_list= packet; - gearman->packet_count++; - } - - packet->args= NULL; - packet->data= NULL; - - return packet; -} - -gearman_return_t gearman_packet_create_arg(gearman_packet_st *packet, - const void *arg, size_t arg_size) -{ - return packet_create_arg(packet, arg, arg_size); -} - -gearman_return_t gearman_packet_create_args(gearman_universal_st *gearman, - gearman_packet_st *packet, - enum gearman_magic_t magic, - gearman_command_t command, - const void *args[], - const size_t args_size[], - size_t args_count) -{ - gearman_return_t ret; - - packet= gearman_packet_create(gearman, packet); - if (packet == NULL) - { - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - packet->magic= magic; - packet->command= command; - - for (size_t x= 0; x < args_count; x++) - { - ret= packet_create_arg(packet, args[x], args_size[x]); - if (ret != GEARMAN_SUCCESS) - { - gearman_packet_free(packet); - return ret; - } - } - - ret= gearman_packet_pack_header(packet); - - if (ret != GEARMAN_SUCCESS) - gearman_packet_free(packet); - - return ret; -} - -void gearman_packet_free(gearman_packet_st *packet) -{ - if (packet->args != packet->args_buffer && packet->args != NULL) - free(packet->args); - - if (packet->options.free_data && packet->data != NULL) - { - if (packet->universal->workload_free_fn == NULL) - { - free((void *)packet->data); //@todo fix the need for the casting. - } - else - { - packet->universal->workload_free_fn((void *)(packet->data), - (void *)packet->universal->workload_free_context); - } - } - - if (! (packet->universal->options.dont_track_packets)) - { - if (packet->universal->packet_list == packet) - packet->universal->packet_list= packet->next; - if (packet->prev != NULL) - packet->prev->next= packet->next; - if (packet->next != NULL) - packet->next->prev= packet->prev; - packet->universal->packet_count--; - } - - if (packet->options.allocated) - free(packet); -} - -gearman_return_t gearman_packet_pack_header(gearman_packet_st *packet) -{ - uint64_t length_64; - uint32_t tmp; - - if (packet->magic == GEARMAN_MAGIC_TEXT) - { - packet->options.complete= true; - return GEARMAN_SUCCESS; - } - - if (packet->args_size == 0) - { - packet->args= packet->args_buffer; - packet->args_size= GEARMAN_PACKET_HEADER_SIZE; - } - - switch (packet->magic) - { - case GEARMAN_MAGIC_TEXT: - break; - - case GEARMAN_MAGIC_REQUEST: - memcpy(packet->args, "\0REQ", 4); - break; - - case GEARMAN_MAGIC_RESPONSE: - memcpy(packet->args, "\0RES", 4); - break; - - default: - gearman_universal_set_error(packet->universal, "gearman_packet_pack_header", - "invalid magic value"); - return GEARMAN_INVALID_MAGIC; - } - - if (packet->command == GEARMAN_COMMAND_TEXT || - packet->command >= GEARMAN_COMMAND_MAX) - { - gearman_universal_set_error(packet->universal, "gearman_packet_pack_header", - "invalid command value"); - return GEARMAN_INVALID_COMMAND; - } - - tmp= packet->command; - tmp= htonl(tmp); - memcpy(packet->args + 4, &tmp, 4); - - length_64= packet->args_size + packet->data_size - GEARMAN_PACKET_HEADER_SIZE; - - // Check for overflow on 32bit(portable?). - if (length_64 >= UINT32_MAX || length_64 < packet->data_size) - { - gearman_universal_set_error(packet->universal, "gearman_packet_pack_header", - "data size too too long"); - return GEARMAN_ARGUMENT_TOO_LARGE; - } - - tmp= (uint32_t)length_64; - tmp= htonl(tmp); - memcpy(packet->args + 8, &tmp, 4); - - packet->options.complete= true; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_packet_unpack_header(gearman_packet_st *packet) -{ - uint32_t tmp; - - if (!memcmp(packet->args, "\0REQ", 4)) - packet->magic= GEARMAN_MAGIC_REQUEST; - else if (!memcmp(packet->args, "\0RES", 4)) - packet->magic= GEARMAN_MAGIC_RESPONSE; - else - { - gearman_universal_set_error(packet->universal, "gearman_packet_unpack_header", - "invalid magic value"); - return GEARMAN_INVALID_MAGIC; - } - - memcpy(&tmp, packet->args + 4, 4); - packet->command= ntohl(tmp); - - if (packet->command == GEARMAN_COMMAND_TEXT || - packet->command >= GEARMAN_COMMAND_MAX) - { - gearman_universal_set_error(packet->universal, "gearman_packet_unpack_header", - "invalid command value"); - return GEARMAN_INVALID_COMMAND; - } - - memcpy(&tmp, packet->args + 8, 4); - packet->data_size= ntohl(tmp); - - return GEARMAN_SUCCESS; -} - -size_t gearman_packet_pack(const gearman_packet_st *packet, - gearman_connection_st *con __attribute__ ((unused)), - void *data, size_t data_size, - gearman_return_t *ret_ptr) -{ - if (packet->args_size == 0) - { - *ret_ptr= GEARMAN_SUCCESS; - return 0; - } - - if (packet->args_size > data_size) - { - *ret_ptr= GEARMAN_FLUSH_DATA; - return 0; - } - - memcpy(data, packet->args, packet->args_size); - *ret_ptr= GEARMAN_SUCCESS; - return packet->args_size; -} - -size_t gearman_packet_unpack(gearman_packet_st *packet, - gearman_connection_st *con __attribute__ ((unused)), - const void *data, size_t data_size, - gearman_return_t *ret_ptr) -{ - uint8_t *ptr; - size_t used_size; - size_t arg_size; - - if (packet->args_size == 0) - { - if (data_size > 0 && ((uint8_t *)data)[0] != 0) - { - /* Try to parse a text-based command. */ - ptr= memchr(data, '\n', data_size); - if (ptr == NULL) - { - *ret_ptr= GEARMAN_IO_WAIT; - return 0; - } - - packet->magic= GEARMAN_MAGIC_TEXT; - packet->command= GEARMAN_COMMAND_TEXT; - - used_size= (size_t)(ptr - ((uint8_t *)data)) + 1; - *ptr= 0; - if (used_size > 1 && *(ptr - 1) == '\r') - *(ptr - 1)= 0; - - for (arg_size= used_size, ptr= (uint8_t *)data; ptr != NULL; data= ptr) - { - ptr= memchr(data, ' ', arg_size); - if (ptr != NULL) - { - *ptr= 0; - ptr++; - while (*ptr == ' ') - ptr++; - - arg_size-= (size_t)(ptr - ((uint8_t *)data)); - } - - *ret_ptr= packet_create_arg(packet, data, ptr == NULL ? arg_size : - (size_t)(ptr - ((uint8_t *)data))); - if (*ret_ptr != GEARMAN_SUCCESS) - return used_size; - } - - return used_size; - } - else if (data_size < GEARMAN_PACKET_HEADER_SIZE) - { - *ret_ptr= GEARMAN_IO_WAIT; - return 0; - } - - packet->args= packet->args_buffer; - packet->args_size= GEARMAN_PACKET_HEADER_SIZE; - memcpy(packet->args, data, GEARMAN_PACKET_HEADER_SIZE); - - *ret_ptr= gearman_packet_unpack_header(packet); - if (*ret_ptr != GEARMAN_SUCCESS) - return 0; - - used_size= GEARMAN_PACKET_HEADER_SIZE; - } - else - { - used_size= 0; - } - - while (packet->argc != gearman_command_info_list[packet->command].argc) - { - if (packet->argc != (gearman_command_info_list[packet->command].argc - 1) || - gearman_command_info_list[packet->command].data) - { - ptr= memchr(((uint8_t *)data) + used_size, 0, data_size - used_size); - if (ptr == NULL) - { - *ret_ptr= GEARMAN_IO_WAIT; - return used_size; - } - - arg_size= (size_t)(ptr - (((uint8_t *)data) + used_size)) + 1; - *ret_ptr= packet_create_arg(packet, ((uint8_t *)data) + used_size, arg_size); - - if (*ret_ptr != GEARMAN_SUCCESS) - return used_size; - - packet->data_size-= arg_size; - used_size+= arg_size; - } - else - { - if ((data_size - used_size) < packet->data_size) - { - *ret_ptr= GEARMAN_IO_WAIT; - return used_size; - } - - *ret_ptr= packet_create_arg(packet, ((uint8_t *)data) + used_size, - packet->data_size); - if (*ret_ptr != GEARMAN_SUCCESS) - return used_size; - - used_size+= packet->data_size; - packet->data_size= 0; - } - } - - *ret_ptr= GEARMAN_SUCCESS; - return used_size; -} - -void gearman_packet_give_data(gearman_packet_st *packet, const void *data, - size_t data_size) -{ - packet->data= data; - packet->data_size= data_size; - packet->options.free_data= true; -} - -void *gearman_packet_take_data(gearman_packet_st *packet, size_t *data_size) -{ - void *data= (void *)(packet->data); - - *data_size= packet->data_size; - - packet->data= NULL; - packet->data_size= 0; - packet->options.free_data= false; - - return data; -} diff -Nru gearmand-0.14/libgearman/packet.cc gearmand-0.23/libgearman/packet.cc --- gearmand-0.14/libgearman/packet.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/packet.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,546 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief Packet Definitions + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +/** + * @addtogroup gearman_packet_static Static Packet Declarations + * @ingroup gearman_packet + * @{ + */ + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +inline static gearman_return_t packet_create_arg(gearman_packet_st *packet, + const void *arg, size_t arg_size) +{ + if (packet->argc == gearman_command_info(packet->command)->argc and + (not (gearman_command_info(packet->command)->data) || packet->data != NULL)) + { + gearman_universal_set_error(*packet->universal, GEARMAN_TOO_MANY_ARGS, AT, "too many arguments for command (%s)", + gearman_command_info(packet->command)->name); + return GEARMAN_TOO_MANY_ARGS; + } + + if (packet->argc == gearman_command_info(packet->command)->argc) + { + packet->data= arg; + packet->data_size= arg_size; + return GEARMAN_SUCCESS; + } + + if (packet->args_size == 0 && packet->magic != GEARMAN_MAGIC_TEXT) + { + packet->args_size= GEARMAN_PACKET_HEADER_SIZE; + } + + if ((packet->args_size + arg_size) < GEARMAN_ARGS_BUFFER_SIZE) + { + packet->args= packet->args_buffer; + } + else + { + if (packet->args == packet->args_buffer) + { + packet->args= NULL; + } + + char *new_args= static_cast(realloc(packet->args, packet->args_size + arg_size +1)); + if (not new_args) + { + gearman_perror(*packet->universal, "packet realloc"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + if (packet->args_size > 0) + { + memcpy(new_args, packet->args_buffer, packet->args_size); + } + + packet->args= new_args; + } + + memcpy(packet->args + packet->args_size, arg, arg_size); + packet->args_size+= arg_size; + packet->arg_size[packet->argc]= arg_size; + packet->argc++; + + size_t offset; + if (packet->magic == GEARMAN_MAGIC_TEXT) + { + offset= 0; + } + else + { + offset= GEARMAN_PACKET_HEADER_SIZE; + } + + for (uint8_t x= 0; x < packet->argc; x++) + { + packet->arg[x]= packet->args + offset; + offset+= packet->arg_size[x]; + } + + return GEARMAN_SUCCESS; +} + +/** @} */ + +/* + * Public Definitions + */ + +gearman_packet_st *gearman_packet_create(gearman_universal_st &universal, + gearman_packet_st *packet) +{ + if (not packet) + { + packet= new (std::nothrow) gearman_packet_st; + if (packet == NULL) + { + gearman_perror(universal, "gearman_packet_st new"); + errno= ENOMEM; + return NULL; + } + + packet->options.allocated= true; + } + else + { + packet->options.allocated= false; + packet->options.complete= false; + packet->options.free_data= false; + } + + packet->magic= GEARMAN_MAGIC_TEXT; + packet->command= GEARMAN_COMMAND_TEXT; + packet->argc= 0; + packet->args_size= 0; + packet->data_size= 0; + packet->universal= &universal; + + if (not (universal.options.dont_track_packets)) + { + if (universal.packet_list != NULL) + universal.packet_list->prev= packet; + packet->next= universal.packet_list; + packet->prev= NULL; + universal.packet_list= packet; + universal.packet_count++; + } + + packet->args= NULL; + packet->data= NULL; + + return packet; +} + +gearman_return_t gearman_packet_create_arg(gearman_packet_st& self, + const void *arg, size_t arg_size) +{ + return packet_create_arg(&self, arg, arg_size); +} + +gearman_return_t gearman_packet_create_args(gearman_universal_st& universal, + gearman_packet_st& packet, + enum gearman_magic_t magic, + gearman_command_t command, + const void *args[], + const size_t args_size[], + size_t args_count) +{ + if (not gearman_packet_create(universal, &packet)) + { + gearman_perror(universal, "failed in gearman_packet_create()"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + packet.magic= magic; + packet.command= command; + + if (gearman_command_info(packet.command)->data) + { + assert_msg(args_count -1 == gearman_command_info(packet.command)->argc, + "Programmer error, number of arguments incorrect for protocol"); + } + else + { + assert_msg(args_count == gearman_command_info(packet.command)->argc, + "Programmer error, number of arguments incorrect for protocol"); + } + + for (size_t x= 0; x < args_count; x++) + { + gearman_return_t ret= packet_create_arg(&packet, args[x], args_size[x]); + if (gearman_failed(ret)) + { + gearman_packet_free(&packet); + return ret; + } + } + + gearman_return_t ret= gearman_packet_pack_header(&packet); + if (gearman_failed(ret)) + { + gearman_packet_free(&packet); + return ret; + } + + return ret; +} + +void gearman_packet_free(gearman_packet_st *packet) +{ + if (packet->args != packet->args_buffer and packet->args) + { + // Created with realloc + free(packet->args); + packet->args= NULL; + } + + assert_msg(packet->universal, + "Packet that is being freed has not been allocated, most likely this is do to freeing a gearman_task_st or other object twice"); + if (packet->options.free_data && packet->data) + { + gearman_free((*packet->universal), const_cast(packet->data)); + packet->data= NULL; + } + + if (not (packet->universal->options.dont_track_packets)) + { + if (packet->universal->packet_list == packet) + packet->universal->packet_list= packet->next; + + if (packet->prev) + packet->prev->next= packet->next; + + if (packet->next) + packet->next->prev= packet->prev; + packet->universal->packet_count--; + } + + if (packet->options.allocated) + { + delete packet; + } + else + { + memset(packet, 0, sizeof(gearman_packet_st)); + } +} + +gearman_return_t gearman_packet_pack_header(gearman_packet_st *packet) +{ + if (packet->magic == GEARMAN_MAGIC_TEXT) + { + packet->options.complete= true; + return GEARMAN_SUCCESS; + } + + if (packet->args_size == 0) + { + packet->args= packet->args_buffer; + packet->args_size= GEARMAN_PACKET_HEADER_SIZE; + } + + switch (packet->magic) + { + case GEARMAN_MAGIC_TEXT: + break; + + case GEARMAN_MAGIC_REQUEST: + memcpy(packet->args, "\0REQ", 4); + break; + + case GEARMAN_MAGIC_RESPONSE: + memcpy(packet->args, "\0RES", 4); + break; + + default: + gearman_error(*packet->universal, GEARMAN_INVALID_MAGIC, "invalid magic value"); + return GEARMAN_INVALID_MAGIC; + } + + if (packet->command == GEARMAN_COMMAND_TEXT || + packet->command >= GEARMAN_COMMAND_MAX) + { + gearman_error(*packet->universal, GEARMAN_INVALID_COMMAND, "invalid command value"); + return GEARMAN_INVALID_COMMAND; + } + + uint32_t tmp= packet->command; + tmp= htonl(tmp); + // Record the command + memcpy(packet->args + 4, &tmp, 4); + + uint64_t length_64= packet->args_size + packet->data_size - GEARMAN_PACKET_HEADER_SIZE; + + // Check for overflow on 32bit(portable?). + if (length_64 >= UINT32_MAX || length_64 < packet->data_size) + { + gearman_error(*packet->universal, GEARMAN_ARGUMENT_TOO_LARGE, "data size too too long"); + return GEARMAN_ARGUMENT_TOO_LARGE; + } + + tmp= uint32_t(length_64); + tmp= htonl(tmp); + // Record the length of the packet + memcpy(packet->args + 8, &tmp, 4); + + packet->options.complete= true; + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_packet_unpack_header(gearman_packet_st *packet) +{ + uint32_t tmp; + + if (not memcmp(packet->args, "\0REQ", 4)) + { + packet->magic= GEARMAN_MAGIC_REQUEST; + } + else if (not memcmp(packet->args, "\0RES", 4)) + { + packet->magic= GEARMAN_MAGIC_RESPONSE; + } + else + { + gearman_error(*packet->universal, GEARMAN_INVALID_MAGIC, "invalid magic value"); + return GEARMAN_INVALID_MAGIC; + } + + memcpy(&tmp, packet->args + 4, 4); + packet->command= (gearman_command_t)ntohl(tmp); + + if (packet->command == GEARMAN_COMMAND_TEXT || + packet->command >= GEARMAN_COMMAND_MAX) + { + gearman_error(*packet->universal, GEARMAN_INVALID_COMMAND, "invalid command value"); + return GEARMAN_INVALID_COMMAND; + } + + memcpy(&tmp, packet->args + 8, 4); + packet->data_size= ntohl(tmp); + + return GEARMAN_SUCCESS; +} + +size_t gearman_packet_pack(const gearman_packet_st &self, + void *data, size_t data_size, + gearman_return_t &ret) +{ + if (not self.args_size) + { + ret= GEARMAN_SUCCESS; + return 0; + } + + if (self.args_size > data_size) + { + ret= GEARMAN_FLUSH_DATA; + return 0; + } + + memcpy(data, self.args, self.args_size); + ret= GEARMAN_SUCCESS; + return self.args_size; +} + +size_t gearman_packet_unpack(gearman_packet_st& self, + const void *data, size_t data_size, + gearman_return_t &ret) +{ + size_t used_size; + size_t arg_size; + + if (self.args_size == 0) + { + if (data_size > 0 && ((uint8_t *)data)[0] != 0) + { + /* Try to parse a text-based command. */ + uint8_t *ptr= (uint8_t *)memchr(data, '\n', data_size); + if (not ptr) + { + gearman_gerror(*self.universal, GEARMAN_IO_WAIT); + ret= GEARMAN_IO_WAIT; + return 0; + } + + self.magic= GEARMAN_MAGIC_TEXT; + self.command= GEARMAN_COMMAND_TEXT; + + used_size= (size_t)(ptr - ((uint8_t *)data)) + 1; + *ptr= 0; + if (used_size > 1 && *(ptr - 1) == '\r') + *(ptr - 1)= 0; + + for (arg_size= used_size, ptr= (uint8_t *)data; ptr != NULL; data= ptr) + { + ptr= (uint8_t *)memchr(data, ' ', arg_size); + if (ptr != NULL) + { + *ptr= 0; + ptr++; + while (*ptr == ' ') + { + ptr++; + } + + arg_size-= (size_t)(ptr - ((uint8_t *)data)); + } + + ret= packet_create_arg(&self, data, + ptr == NULL ? arg_size : size_t(ptr - ((uint8_t *)data))); + if (gearman_failed(ret)) + { + return used_size; + } + } + + return used_size; + } + else if (data_size < GEARMAN_PACKET_HEADER_SIZE) + { + gearman_gerror(*self.universal, GEARMAN_IO_WAIT); + ret= GEARMAN_IO_WAIT; + return 0; + } + + self.args= self.args_buffer; + self.args_size= GEARMAN_PACKET_HEADER_SIZE; + memcpy(self.args, data, GEARMAN_PACKET_HEADER_SIZE); + + ret= gearman_packet_unpack_header(&self); + if (gearman_failed(ret)) + { + return 0; + } + + used_size= GEARMAN_PACKET_HEADER_SIZE; + } + else + { + used_size= 0; + } + + while (self.argc != gearman_command_info(self.command)->argc) + { + if (self.argc != (gearman_command_info(self.command)->argc - 1) or + gearman_command_info(self.command)->data) + { + + uint8_t *ptr= (uint8_t *)memchr((char *)data + used_size, 0, data_size - used_size); + if (not ptr) + { + gearman_gerror(*self.universal, GEARMAN_IO_WAIT); + ret= GEARMAN_IO_WAIT; + return used_size; + } + + arg_size= (size_t)(ptr - ((uint8_t *)data + used_size)) +1; + ret= packet_create_arg(&self, (uint8_t *)data + used_size, arg_size); + if (gearman_failed(ret)) + { + return used_size; + } + + self.data_size-= arg_size; + used_size+= arg_size; + } + else + { + if ((data_size - used_size) < self.data_size) + { + gearman_gerror(*self.universal, GEARMAN_IO_WAIT); + ret= GEARMAN_IO_WAIT; + return used_size; + } + + ret= packet_create_arg(&self, ((uint8_t *)data) + used_size, self.data_size); + if (gearman_failed(ret)) + { + return used_size; + } + + used_size+= self.data_size; + self.data_size= 0; + } + } + + ret= GEARMAN_SUCCESS; + return used_size; +} + +void gearman_packet_give_data(gearman_packet_st& self, + const void *data, size_t data_size) +{ + self.data= data; + self.data_size= data_size; + self.options.free_data= true; +} + +void *gearman_packet_take_data(gearman_packet_st& self, size_t *data_size) +{ + void *data= const_cast(self.data); + + *data_size= self.data_size; + + self.data= NULL; + self.data_size= 0; + self.options.free_data= false; + + return data; +} diff -Nru gearmand-0.14/libgearman/packet.h gearmand-0.23/libgearman/packet.h --- gearmand-0.14/libgearman/packet.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/packet.h 2011-06-14 12:41:27.000000000 +0200 @@ -1,34 +1,42 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Packet Declarations - */ - -#ifndef __GEARMAN_PACKET_H__ -#define __GEARMAN_PACKET_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_packet Packet Declarations - * @ingroup gearman_universal - * - * This is a low level interface for gearman packet. This is used internally - * internally by both client and worker interfaces (or more specifically, tasks - * and jobs), so you probably want to look there first. This is usually used to - * write lower level clients, workers, proxies, or your own server. - * - * @{ - */ +#pragma once enum gearman_magic_t { @@ -43,16 +51,16 @@ struct gearman_packet_st { struct { - bool allocated LIBGEARMAN_BITFIELD; - bool complete LIBGEARMAN_BITFIELD; - bool free_data LIBGEARMAN_BITFIELD; + bool allocated; + bool complete; + bool free_data; } options; enum gearman_magic_t magic; gearman_command_t command; uint8_t argc; size_t args_size; size_t data_size; - gearman_universal_st *universal; + struct gearman_universal_st *universal; gearman_packet_st *next; gearman_packet_st *prev; char *args; @@ -61,133 +69,3 @@ size_t arg_size[GEARMAN_MAX_COMMAND_ARGS]; char args_buffer[GEARMAN_ARGS_BUFFER_SIZE]; }; - -#ifdef GEARMAN_CORE -/** - * Command information array. - * @ingroup gearman_constants - */ -extern GEARMAN_INTERNAL_API -gearman_command_info_st gearman_command_info_list[GEARMAN_COMMAND_MAX]; - - -/** - * Initialize a packet structure. - * - * @param[in] gearman Structure previously initialized with gearman_create() or - * gearman_clone(). - * @param[in] packet Caller allocated structure, or NULL to allocate one. - * @return On success, a pointer to the (possibly allocated) structure. On - * failure this will be NULL. - */ -GEARMAN_INTERNAL_API -gearman_packet_st *gearman_packet_create(gearman_universal_st *gearman, - gearman_packet_st *packet); - -/** - * Free a packet structure. - * - * @param[in] packet Structure previously initialized with - * gearman_packet_create() or gearman_packet_create_args(). - */ -GEARMAN_INTERNAL_API -void gearman_packet_free(gearman_packet_st *packet); - -/** - * Initialize a packet with all arguments. For example: - * - * @code - * void *args[3]; - * size_t args_suze[3]; - * - * args[0]= function_name; - * args_size[0]= strlen(function_name) + 1; - * args[1]= unique_string; - * args_size[1]= strlen(unique_string,) + 1; - * args[2]= workload; - * args_size[2]= workload_size; - * - * ret= gearman_packet_create_args(gearman, packet, - * GEARMAN_MAGIC_REQUEST, - * GEARMAN_COMMAND_SUBMIT_JOB, - * args, args_size, 3); - * @endcode - * - * @param[in] gearman Structure previously initialized with gearman_create() or - * gearman_clone(). - * @param[in] packet Pre-allocated packet to initialize with arguments. - * @param[in] magic Magic type for packet header. - * @param[in] command Command type for packet. - * @param[in] args Array of arguments to add. - * @param[in] args_size Array of sizes of each byte array in the args array. - * @param[in] args_count Number of elements in args/args_sizes arrays. - * @return Standard gearman return value. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_packet_create_args(gearman_universal_st *gearman, - gearman_packet_st *packet, - enum gearman_magic_t magic, - gearman_command_t command, - const void *args[], - const size_t args_size[], - size_t args_count); - -/** - * Add an argument to a packet. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_packet_create_arg(gearman_packet_st *packet, - const void *arg, size_t arg_size); - -/** - * Pack header. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_packet_pack_header(gearman_packet_st *packet); - -/** - * Unpack header. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_packet_unpack_header(gearman_packet_st *packet); - -/** - * Pack packet into output buffer. - */ -GEARMAN_INTERNAL_API -size_t gearman_packet_pack(const gearman_packet_st *packet, gearman_connection_st *con, - void *data, size_t data_size, - gearman_return_t *ret_ptr); - -/** - * Unpack packet from input data. - */ -GEARMAN_INTERNAL_API -size_t gearman_packet_unpack(gearman_packet_st *packet, gearman_connection_st *con, - const void *data, size_t data_size, - gearman_return_t *ret_ptr); - -/** - * Give allocated memory to packet. After this, the library will be responsible - * for freeing the workload memory when the packet is destroyed. - */ -GEARMAN_INTERNAL_API -void gearman_packet_give_data(gearman_packet_st *packet, const void *data, - size_t data_size); - -/** - * Take allocated data from packet. After this, the caller is responsible for - * free()ing the memory. - */ -GEARMAN_INTERNAL_API -void *gearman_packet_take_data(gearman_packet_st *packet, size_t *data_size); - -#endif /* GEARMAN_CORE */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_PACKET_H__ */ diff -Nru gearmand-0.14/libgearman/packet.hpp gearmand-0.23/libgearman/packet.hpp --- gearmand-0.14/libgearman/packet.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/packet.hpp 2011-06-07 22:31:30.000000000 +0200 @@ -0,0 +1,126 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#pragma once + +#include + +GEARMAN_LOCAL +gearman_packet_st *gearman_packet_create(gearman_universal_st&, gearman_packet_st *packet); + +GEARMAN_LOCAL +void gearman_packet_free(gearman_packet_st*); + +/** + * Initialize a packet with all arguments. For example: + * + * void *args[3]; + * size_t args_suze[3]; + * + * args[0]= function_name; + * args_size[0]= strlen(function_name) + 1; + * args[1]= unique_string; + * args_size[1]= strlen(unique_string,) + 1; + * args[2]= workload; + * args_size[2]= workload_size; + * + * ret= gearman_packet_create_args(gearman, packet, + * GEARMAN_MAGIC_REQUEST, + * GEARMAN_COMMAND_SUBMIT_JOB, + * args, args_size, 3); + */ + +GEARMAN_LOCAL +gearman_return_t gearman_packet_create_args(gearman_universal_st&, + gearman_packet_st& packet, + enum gearman_magic_t magic, + gearman_command_t command, + const void *args[], + const size_t args_size[], + size_t args_count); + +/** + * Give allocated memory to packet. After this, the library will be responsible + * for freeing the workload memory when the packet is destroyed. + */ +GEARMAN_LOCAL +void gearman_packet_give_data(gearman_packet_st& packet, + const void *data, size_t data_size); + +/** + * Take allocated data from packet. After this, the caller is responsible for + * free()ing the memory. + */ +GEARMAN_LOCAL +void *gearman_packet_take_data(gearman_packet_st& packet, size_t *data_size); + +/** + * Pack packet into output buffer. + */ +GEARMAN_LOCAL +size_t gearman_packet_pack(const gearman_packet_st& packet, + void *data, size_t data_size, + gearman_return_t &ret); + +/** + * Unpack packet from input data. + */ +GEARMAN_LOCAL +size_t gearman_packet_unpack(gearman_packet_st& packet, + const void *data, size_t data_size, + gearman_return_t &ret); + +/** + * Add an argument to a packet. + */ +GEARMAN_LOCAL +gearman_return_t gearman_packet_create_arg(gearman_packet_st& packet, + const void *arg, size_t arg_size); + + +/** + * Pack header. + */ +GEARMAN_LOCAL +gearman_return_t gearman_packet_pack_header(gearman_packet_st *packet); + +/** + * Unpack header. + */ +GEARMAN_LOCAL +gearman_return_t gearman_packet_unpack_header(gearman_packet_st *packet); diff -Nru gearmand-0.14/libgearman/parse.cc gearmand-0.23/libgearman/parse.cc --- gearmand-0.14/libgearman/parse.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/parse.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,96 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +gearman_return_t gearman_parse_servers(const char *servers, + gearman_parse_server_fn *function, + void *context) +{ + const char *ptr= servers; + char host[NI_MAXHOST]; + char port[NI_MAXSERV]; + + if (not ptr) + return (*function)(NULL, 0, context); + + while (1) + { + size_t x= 0; + + while (*ptr != 0 && *ptr != ',' && *ptr != ':') + { + if (x < (NI_MAXHOST - 1)) + host[x++]= *ptr; + + ptr++; + } + + host[x]= 0; + + if (*ptr == ':') + { + ptr++; + x= 0; + + while (*ptr != 0 && *ptr != ',') + { + if (x < (NI_MAXSERV - 1)) + port[x++]= *ptr; + + ptr++; + } + + port[x]= 0; + } + else + port[0]= 0; + + gearman_return_t ret= (*function)(host, static_cast(atoi(port)), context); + if (gearman_failed(ret)) + return ret; + + if (*ptr == 0) + break; + + ptr++; + } + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman/parse.h gearmand-0.23/libgearman/parse.h --- gearmand-0.14/libgearman/parse.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/parse.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,60 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Utility function used for parsing server lists. + * + * @param[in] servers String containing a list of servers to parse. + * @param[in] callback Function to call for each server that is found. + * @param[in] context Argument to pass along with callback function. + * @return Standard Gearman return value. + */ +GEARMAN_API +gearman_return_t gearman_parse_servers(const char *servers, + gearman_parse_server_fn *callback, + void *context); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/priority.h gearmand-0.23/libgearman/priority.h --- gearmand-0.14/libgearman/priority.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/priority.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,51 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +enum gearman_job_priority_t +{ + GEARMAN_JOB_PRIORITY_HIGH, + GEARMAN_JOB_PRIORITY_NORMAL, + GEARMAN_JOB_PRIORITY_LOW, + GEARMAN_JOB_PRIORITY_MAX /* Always add new commands before this. */ +}; + +#ifndef __cplusplus +typedef enum gearman_job_priority_t gearman_job_priority_t; +#endif diff -Nru gearmand-0.14/libgearman/protocol.h gearmand-0.23/libgearman/protocol.h --- gearmand-0.14/libgearman/protocol.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/protocol.h 2011-06-28 04:20:29.000000000 +0200 @@ -0,0 +1,66 @@ +/* Gearman server and library + * Copyright (C) 2011 Data Differential + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#define GEARMAN_DEFAULT_TCP_PORT 4730 +#define GEARMAN_DEFAULT_TCP_PORT_STRING "4730" +#define GEARMAN_DEFAULT_TCP_SERVICE "gearman" + +enum gearman_command_t +{ + GEARMAN_COMMAND_TEXT, + GEARMAN_COMMAND_CAN_DO, /* W->J: FUNC */ + GEARMAN_COMMAND_CANT_DO, /* W->J: FUNC */ + GEARMAN_COMMAND_RESET_ABILITIES, /* W->J: -- */ + GEARMAN_COMMAND_PRE_SLEEP, /* W->J: -- */ + GEARMAN_COMMAND_UNUSED, + GEARMAN_COMMAND_NOOP, /* J->W: -- */ + GEARMAN_COMMAND_SUBMIT_JOB, /* C->J: FUNC[0]UNIQ[0]ARGS */ + GEARMAN_COMMAND_JOB_CREATED, /* J->C: HANDLE */ + GEARMAN_COMMAND_GRAB_JOB, /* W->J: -- */ + GEARMAN_COMMAND_NO_JOB, /* J->W: -- */ + GEARMAN_COMMAND_JOB_ASSIGN, /* J->W: HANDLE[0]FUNC[0]ARG */ + GEARMAN_COMMAND_WORK_STATUS, /* W->J/C: HANDLE[0]NUMERATOR[0]DENOMINATOR */ + GEARMAN_COMMAND_WORK_COMPLETE, /* W->J/C: HANDLE[0]RES */ + GEARMAN_COMMAND_WORK_FAIL, /* W->J/C: HANDLE */ + GEARMAN_COMMAND_GET_STATUS, /* C->J: HANDLE */ + GEARMAN_COMMAND_ECHO_REQ, /* ?->J: TEXT */ + GEARMAN_COMMAND_ECHO_RES, /* J->?: TEXT */ + GEARMAN_COMMAND_SUBMIT_JOB_BG, /* C->J: FUNC[0]UNIQ[0]ARGS */ + GEARMAN_COMMAND_ERROR, /* J->?: ERRCODE[0]ERR_TEXT */ + GEARMAN_COMMAND_STATUS_RES, /* C->J: HANDLE[0]KNOWN[0]RUNNING[0]NUM[0]DENOM */ + GEARMAN_COMMAND_SUBMIT_JOB_HIGH, /* C->J: FUNC[0]UNIQ[0]ARGS */ + GEARMAN_COMMAND_SET_CLIENT_ID, /* W->J: [RANDOM_STRING_NO_WHITESPACE] */ + GEARMAN_COMMAND_CAN_DO_TIMEOUT, /* W->J: FUNC[0]TIMEOUT */ + GEARMAN_COMMAND_ALL_YOURS, + GEARMAN_COMMAND_WORK_EXCEPTION, + GEARMAN_COMMAND_OPTION_REQ, /* ?->J: TEXT */ + GEARMAN_COMMAND_OPTION_RES, /* J->?: TEXT */ + GEARMAN_COMMAND_WORK_DATA, + GEARMAN_COMMAND_WORK_WARNING, + GEARMAN_COMMAND_GRAB_JOB_UNIQ, /* W->J: -- */ + GEARMAN_COMMAND_JOB_ASSIGN_UNIQ, /* J->W: */ + GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, + GEARMAN_COMMAND_SUBMIT_JOB_LOW, + GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, + GEARMAN_COMMAND_SUBMIT_JOB_SCHED, + GEARMAN_COMMAND_SUBMIT_JOB_EPOCH, + GEARMAN_COMMAND_SUBMIT_REDUCE_JOB, // C->J: FUNC[0]UNIQ[0]REDUCER[0]UNUSED[0]ARGS + GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND, // C->J: FUNC[0]UNIQ[0]REDUCER[0]UNUSED[0]ARGS + GEARMAN_COMMAND_GRAB_JOB_ALL, /* W->J -- */ + GEARMAN_COMMAND_JOB_ASSIGN_ALL, /* J->W: HANDLE[0]FUNC[0]UNIQ[0]REDUCER[0]ARGS */ + GEARMAN_COMMAND_MAX /* Always add new commands before this. */ +}; + +#ifndef __cplusplus + +typedef enum gearman_command_t gearman_command_t; + +#endif diff -Nru gearmand-0.14/libgearman/result.cc gearmand-0.23/libgearman/result.cc --- gearmand-0.14/libgearman/result.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/result.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,168 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#include +#include + +bool gearman_result_is_null(const gearman_result_st *self) +{ + return self->is_null(); +} + +int64_t gearman_result_integer(const gearman_result_st *self) +{ + if (not self) + return false; + + switch (self->type) + { + case GEARMAN_RESULT_BINARY: + return atoll(gearman_string_value(&self->value.string)); + case GEARMAN_RESULT_BOOLEAN: + return self->value.boolean; + case GEARMAN_RESULT_INTEGER: + return self->value.integer; + } + + return false; +} + +bool gearman_result_boolean(const gearman_result_st *self) +{ + if (not self) + return false; + + switch (self->type) + { + case GEARMAN_RESULT_BINARY: + return gearman_string_length(&self->value.string); + case GEARMAN_RESULT_BOOLEAN: + return self->value.boolean; + case GEARMAN_RESULT_INTEGER: + return self->value.integer ? true : false; + } + + return false; +} + +size_t gearman_result_size(const gearman_result_st *self) +{ + if (not self or self->type != GEARMAN_RESULT_BINARY) + return 0; + + return gearman_string_length(&self->value.string); +} + +const char *gearman_result_value(const gearman_result_st *self) +{ + if (not self or self->type != GEARMAN_RESULT_BINARY) + return NULL; + + gearman_string_t ret= gearman_string(&self->value.string); + + return gearman_c_str(ret); +} + +gearman_string_t gearman_result_string(const gearman_result_st *self) +{ + if (not self or self->type != GEARMAN_RESULT_BINARY) + { + gearman_string_t ret= {0, 0}; + return ret; + } + + return gearman_string(&self->value.string); +} + +gearman_string_t gearman_result_take_string(gearman_result_st *self) +{ + assert(self); // Programming error + if (self->type == GEARMAN_RESULT_BINARY and gearman_result_size(self)) + { + return gearman_string_take_string(&self->value.string); + } + self->_is_null= false; + + static gearman_string_t ret= {0, 0}; + return ret; +} + +gearman_return_t gearman_result_store_string(gearman_result_st *self, gearman_string_t arg) +{ + return gearman_result_store_value(self, gearman_string_param(arg)); +} + +gearman_return_t gearman_result_store_value(gearman_result_st *self, const void *value, size_t size) +{ + if (not self) + return GEARMAN_INVALID_ARGUMENT; + + if (self->type == GEARMAN_RESULT_BINARY) + { + gearman_string_reset(&self->value.string); + } + else + { + self->type= GEARMAN_RESULT_BINARY; + gearman_string_create(&self->value.string, size); + } + self->_is_null= false; + + return gearman_string_append(&self->value.string, static_cast(value), size); +} + +void gearman_result_store_integer(gearman_result_st *self, int64_t value) +{ + if (not self) + return; + + if (self->type == GEARMAN_RESULT_BINARY) + { + gearman_string_free(&self->value.string); + } + + self->type= GEARMAN_RESULT_INTEGER; + self->value.integer= value; + self->_is_null= false; +} diff -Nru gearmand-0.14/libgearman/result.h gearmand-0.23/libgearman/result.h --- gearmand-0.14/libgearman/result.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/result.h 2011-06-14 23:30:57.000000000 +0200 @@ -0,0 +1,85 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +enum gearman_result_t { + GEARMAN_RESULT_BINARY, + GEARMAN_RESULT_BOOLEAN, + GEARMAN_RESULT_INTEGER +}; +#ifndef __cplusplus +typedef enum gearman_result_t gearman_result_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + GEARMAN_API + int64_t gearman_result_integer(const gearman_result_st *self); + + GEARMAN_API + bool gearman_result_boolean(const gearman_result_st *self); + + GEARMAN_API + gearman_string_t gearman_result_string(const gearman_result_st *self); + + GEARMAN_LOCAL + gearman_string_t gearman_result_take_string(gearman_result_st *self); + + GEARMAN_API + gearman_return_t gearman_result_store_string(gearman_result_st *self, gearman_string_t arg); + + GEARMAN_API + void gearman_result_store_integer(gearman_result_st *self, int64_t value); + + GEARMAN_API + gearman_return_t gearman_result_store_value(gearman_result_st *self, const void *value, size_t size); + + GEARMAN_API + size_t gearman_result_size(const gearman_result_st *self); + + GEARMAN_API + const char *gearman_result_value(const gearman_result_st *self); + + GEARMAN_API + bool gearman_result_is_null(const gearman_result_st *self); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/result.hpp gearmand-0.23/libgearman/result.hpp --- gearmand-0.14/libgearman/result.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/result.hpp 2011-06-18 05:22:56.000000000 +0200 @@ -0,0 +1,107 @@ + +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +struct gearman_result_st +{ + bool _is_null; + enum gearman_result_t type; + + union { + bool boolean; + int64_t integer; + gearman_vector_st string; + } value; + + gearman_result_st() : + _is_null(true), + type(GEARMAN_RESULT_BOOLEAN) + { + value.boolean= false; + } + + gearman_result_st(size_t initial_size) : + _is_null(true), + type(GEARMAN_RESULT_BINARY) + { + gearman_string_create(&value.string, initial_size); + } + + bool is_null() const + { + return _is_null; + } + + void clear() + { + if (type == GEARMAN_RESULT_BINARY) + { + gearman_string_free(&value.string); + } + else if (type == GEARMAN_RESULT_INTEGER) + { + value.integer= 0; + } + + type= GEARMAN_RESULT_BOOLEAN; + _is_null= true; + } + + gearman_vector_st *string() + { + if (type == GEARMAN_RESULT_BINARY) + return &value.string; + + return NULL; + } + + int64_t integer() + { + if (type == GEARMAN_RESULT_INTEGER) + return value.integer; + + return 0; + } + + ~gearman_result_st() + { + if (type == GEARMAN_RESULT_BINARY) + gearman_string_free(&value.string); + } +}; diff -Nru gearmand-0.14/libgearman/return.h gearmand-0.23/libgearman/return.h --- gearmand-0.14/libgearman/return.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/return.h 2011-06-18 04:12:39.000000000 +0200 @@ -0,0 +1,108 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/** + * Return codes. + */ +enum gearman_return_t +{ + GEARMAN_SUCCESS, + GEARMAN_IO_WAIT, + GEARMAN_SHUTDOWN, + GEARMAN_SHUTDOWN_GRACEFUL, + GEARMAN_ERRNO, + GEARMAN_EVENT, // DEPRECATED, SERVER ONLY + GEARMAN_TOO_MANY_ARGS, + GEARMAN_NO_ACTIVE_FDS, // No servers available + GEARMAN_INVALID_MAGIC, + GEARMAN_INVALID_COMMAND, + GEARMAN_INVALID_PACKET, + GEARMAN_UNEXPECTED_PACKET, + GEARMAN_GETADDRINFO, + GEARMAN_NO_SERVERS, + GEARMAN_LOST_CONNECTION, + GEARMAN_MEMORY_ALLOCATION_FAILURE, + GEARMAN_JOB_EXISTS, // see gearman_client_job_status() + GEARMAN_JOB_QUEUE_FULL, + GEARMAN_SERVER_ERROR, + GEARMAN_WORK_ERROR, + GEARMAN_WORK_DATA, + GEARMAN_WORK_WARNING, + GEARMAN_WORK_STATUS, + GEARMAN_WORK_EXCEPTION, + GEARMAN_WORK_FAIL, + GEARMAN_NOT_CONNECTED, + GEARMAN_COULD_NOT_CONNECT, + GEARMAN_SEND_IN_PROGRESS, // DEPRECATED, SERVER ONLY + GEARMAN_RECV_IN_PROGRESS, // DEPRECATED, SERVER ONLY + GEARMAN_NOT_FLUSHING, + GEARMAN_DATA_TOO_LARGE, + GEARMAN_INVALID_FUNCTION_NAME, + GEARMAN_INVALID_WORKER_FUNCTION, + GEARMAN_NO_REGISTERED_FUNCTION, + GEARMAN_NO_REGISTERED_FUNCTIONS, + GEARMAN_NO_JOBS, + GEARMAN_ECHO_DATA_CORRUPTION, + GEARMAN_NEED_WORKLOAD_FN, + GEARMAN_PAUSE, // Used only in custom application for client return based on work status, exception, or warning. + GEARMAN_UNKNOWN_STATE, + GEARMAN_PTHREAD, // DEPRECATED, SERVER ONLY + GEARMAN_PIPE_EOF, // DEPRECATED, SERVER ONLY + GEARMAN_QUEUE_ERROR, // DEPRECATED, SERVER ONLY + GEARMAN_FLUSH_DATA, // Internal state, should never be seen by either client or worker. + GEARMAN_SEND_BUFFER_TOO_SMALL, + GEARMAN_IGNORE_PACKET, // Internal only + GEARMAN_UNKNOWN_OPTION, // DEPRECATED + GEARMAN_TIMEOUT, + GEARMAN_ARGUMENT_TOO_LARGE, + GEARMAN_INVALID_ARGUMENT, + GEARMAN_IN_PROGRESS, // See gearman_client_job_status() + GEARMAN_MAX_RETURN, /* Always add new error code before */ + GEARMAN_FATAL= GEARMAN_WORK_FAIL, + GEARMAN_ERROR= GEARMAN_WORK_ERROR +}; + +#define gearman_continue(__gearman_return_t) (((__gearman_return_t) == GEARMAN_IO_WAIT) || ((__gearman_return_t) == GEARMAN_IN_PROGRESS) || ((__gearman_return_t) == GEARMAN_PAUSE) || ((__gearman_return_t) == GEARMAN_JOB_EXISTS) || ((__gearman_return_t) == GEARMAN_NO_ACTIVE_FDS)) +#define gearman_failed(__gearman_return_t) ((__gearman_return_t) != GEARMAN_SUCCESS) +#define gearman_success(__gearman_return_t) ((__gearman_return_t) == GEARMAN_SUCCESS) + +#ifndef __cplusplus +typedef enum gearman_return_t gearman_return_t; +#endif diff -Nru gearmand-0.14/libgearman/run.cc gearmand-0.23/libgearman/run.cc --- gearmand-0.14/libgearman/run.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/run.cc 2011-06-18 05:22:56.000000000 +0200 @@ -0,0 +1,346 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +#include +#include + +gearman_return_t _client_run_task(gearman_client_st *client, gearman_task_st *task) +{ + switch(task->state) + { + case GEARMAN_TASK_STATE_NEW: + if (not task->client->universal.con_list) + { + client->new_tasks--; + client->running_tasks--; + gearman_universal_set_error(client->universal, GEARMAN_NO_SERVERS, __func__, AT, "no servers added"); + return GEARMAN_NO_SERVERS; + } + + for (task->con= task->client->universal.con_list; task->con; + task->con= task->con->next) + { + if (task->con->send_state == GEARMAN_CON_SEND_STATE_NONE) + { + break; + } + } + + if (not task->con) + { + client->options.no_new= true; + gearman_gerror(client->universal, GEARMAN_IO_WAIT); + return GEARMAN_IO_WAIT; + } + + client->new_tasks--; + + if (task->send.command != GEARMAN_COMMAND_GET_STATUS) + { + task->created_id= task->con->created_id_next; + task->con->created_id_next++; + } + + case GEARMAN_TASK_STATE_SUBMIT: + while (1) + { + assert(task->con); + gearman_return_t ret= task->con->send(task->send, client->new_tasks == 0 ? true : false); + + if (gearman_success(ret)) + { + break; + } + else if (ret == GEARMAN_IO_WAIT) + { + task->state= GEARMAN_TASK_STATE_SUBMIT; + return ret; + } + else if (gearman_failed(ret)) + { + /* Increment this since the job submission failed. */ + task->con->created_id++; + + if (ret == GEARMAN_COULD_NOT_CONNECT) + { + for (task->con= task->con->next; + task->con; + task->con= task->con->next) + { + if (task->con->send_state == GEARMAN_CON_SEND_STATE_NONE) + { + break; + } + } + } + else + { + task->con= NULL; + } + + if (not task->con) + { + task->result_rc= ret; + + if (ret == GEARMAN_COULD_NOT_CONNECT) // If no connection is found, we will let the user try again + { + task->state= GEARMAN_TASK_STATE_NEW; + client->new_tasks++; + } + else + { + task->state= GEARMAN_TASK_STATE_FAIL; + client->running_tasks--; + } + return ret; + } + + if (task->send.command != GEARMAN_COMMAND_GET_STATUS) + { + task->created_id= task->con->created_id_next; + task->con->created_id_next++; + } + } + } + + if (task->send.data_size > 0 and not task->send.data) + { + if (not task->func.workload_fn) + { + gearman_error(client->universal, GEARMAN_NEED_WORKLOAD_FN, + "workload size > 0, but no data pointer or workload_fn was given"); + return GEARMAN_NEED_WORKLOAD_FN; + } + + case GEARMAN_TASK_STATE_WORKLOAD: + gearman_return_t ret= task->func.workload_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_WORKLOAD; + return ret; + } + } + + client->options.no_new= false; + task->state= GEARMAN_TASK_STATE_WORK; + task->con->set_events(POLLIN); + return GEARMAN_SUCCESS; + + case GEARMAN_TASK_STATE_WORK: + if (task->recv->command == GEARMAN_COMMAND_JOB_CREATED) + { + task->options.is_known= true; + snprintf(task->job_handle, GEARMAN_JOB_HANDLE_SIZE, "%.*s", + int(task->recv->arg_size[0]), + static_cast(task->recv->arg[0])); + + case GEARMAN_TASK_STATE_CREATED: + if (task->func.created_fn) + { + gearman_return_t ret= task->func.created_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_CREATED; + return ret; + } + } + + if (task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_BG || + task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG || + task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG || + task->send.command == GEARMAN_COMMAND_SUBMIT_JOB_EPOCH || + task->send.command == GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND) + { + break; + } + } + else if (task->recv->command == GEARMAN_COMMAND_WORK_DATA) + { + task->options.is_known= true; + task->options.is_running= true; + + case GEARMAN_TASK_STATE_DATA: + if (task->func.data_fn) + { + gearman_return_t ret= task->func.data_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_DATA; + return ret; + } + } + } + else if (task->recv->command == GEARMAN_COMMAND_WORK_WARNING) + { + case GEARMAN_TASK_STATE_WARNING: + if (task->func.warning_fn) + { + gearman_return_t ret= task->func.warning_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_WARNING; + return ret; + } + } + } + else if (task->recv->command == GEARMAN_COMMAND_WORK_STATUS || + task->recv->command == GEARMAN_COMMAND_STATUS_RES) + { + uint8_t x; + + if (task->recv->command == GEARMAN_COMMAND_STATUS_RES) + { + if (atoi(static_cast(task->recv->arg[1])) == 0) + task->options.is_known= false; + else + task->options.is_known= true; + + if (atoi(static_cast(task->recv->arg[2])) == 0) + task->options.is_running= false; + else + task->options.is_running= true; + + x= 3; + } + else + { + x= 1; + } + + task->numerator= uint32_t(atoi(static_cast(task->recv->arg[x]))); + char status_buffer[11]; /* Max string size to hold a uint32_t. */ + snprintf(status_buffer, 11, "%.*s", + int(task->recv->arg_size[x + 1]), + static_cast(task->recv->arg[x + 1])); + task->denominator= uint32_t(atoi(status_buffer)); + + case GEARMAN_TASK_STATE_STATUS: + if (task->func.status_fn) + { + gearman_return_t ret= task->func.status_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_STATUS; + return ret; + } + } + + if (task->send.command == GEARMAN_COMMAND_GET_STATUS) + { + break; + } + } + else if (task->recv->command == GEARMAN_COMMAND_WORK_COMPLETE) + { + task->options.is_known= false; + task->options.is_running= false; + task->result_rc= GEARMAN_SUCCESS; + + case GEARMAN_TASK_STATE_COMPLETE: + if (task->func.complete_fn) + { + gearman_return_t ret= task->func.complete_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_COMPLETE; + return ret; + } + } + + break; + } + else if (task->recv->command == GEARMAN_COMMAND_WORK_EXCEPTION) + { + case GEARMAN_TASK_STATE_EXCEPTION: + if (task->func.exception_fn) + { + gearman_return_t ret= task->func.exception_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_EXCEPTION; + return ret; + } + } + } + else if (task->recv->command == GEARMAN_COMMAND_WORK_FAIL) + { + // If things fail we need to delete the result, and set the result_rc + // correctly. + task->options.is_known= false; + task->options.is_running= false; + delete task->result_ptr; + task->result_ptr= NULL; + task->result_rc= GEARMAN_WORK_FAIL; + + case GEARMAN_TASK_STATE_FAIL: + if (task->func.fail_fn) + { + gearman_return_t ret= task->func.fail_fn(task); + if (gearman_failed(ret)) + { + task->state= GEARMAN_TASK_STATE_FAIL; + return ret; + } + } + + break; + } + + task->state= GEARMAN_TASK_STATE_WORK; + return GEARMAN_SUCCESS; + + case GEARMAN_TASK_STATE_FINISHED: + break; + } + + client->running_tasks--; + task->state= GEARMAN_TASK_STATE_FINISHED; + + if (client->options.free_tasks and task->type == GEARMAN_TASK_KIND_ADD_TASK) + { + gearman_task_free(task); + } + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman/run.hpp gearmand-0.23/libgearman/run.hpp --- gearmand-0.14/libgearman/run.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/run.hpp 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,42 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +GEARMAN_LOCAL +gearman_return_t _client_run_task(gearman_client_st *client, gearman_task_st *task); diff -Nru gearmand-0.14/libgearman/strcommand.cc gearmand-0.23/libgearman/strcommand.cc --- gearmand-0.14/libgearman/strcommand.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/strcommand.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,89 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + + +const char *gearman_strcommand(gearman_command_t command) +{ + switch(command) + { + case GEARMAN_COMMAND_TEXT: return "GEARMAN_COMMAND_TEXT"; + case GEARMAN_COMMAND_CAN_DO: return "GEARMAN_COMMAND_CAN_DO"; + case GEARMAN_COMMAND_CANT_DO: return "GEARMAN_COMMAND_CANT_DO"; + case GEARMAN_COMMAND_RESET_ABILITIES: return "GEARMAN_COMMAND_RESET_ABILITIES"; + case GEARMAN_COMMAND_PRE_SLEEP: return "GEARMAN_COMMAND_PRE_SLEEP"; + case GEARMAN_COMMAND_UNUSED: return "GEARMAN_COMMAND_UNUSED"; + case GEARMAN_COMMAND_NOOP: return "GEARMAN_COMMAND_NOOP"; + case GEARMAN_COMMAND_SUBMIT_JOB: return "GEARMAN_COMMAND_SUBMIT_JOB"; + case GEARMAN_COMMAND_JOB_CREATED: return "GEARMAN_COMMAND_JOB_CREATED"; + case GEARMAN_COMMAND_GRAB_JOB: return "GEARMAN_COMMAND_GRAB_JOB"; + case GEARMAN_COMMAND_NO_JOB: return "GEARMAN_COMMAND_NO_JOB"; + case GEARMAN_COMMAND_JOB_ASSIGN: return "GEARMAN_COMMAND_JOB_ASSIGN"; + case GEARMAN_COMMAND_WORK_STATUS: return "GEARMAN_COMMAND_WORK_STATUS"; + case GEARMAN_COMMAND_WORK_COMPLETE: return "GEARMAN_COMMAND_WORK_COMPLETE"; + case GEARMAN_COMMAND_WORK_FAIL: return "GEARMAN_COMMAND_WORK_FAIL"; + case GEARMAN_COMMAND_GET_STATUS: return "GEARMAN_COMMAND_GET_STATUS"; + case GEARMAN_COMMAND_ECHO_REQ: return "GEARMAN_COMMAND_ECHO_REQ"; + case GEARMAN_COMMAND_ECHO_RES: return "GEARMAN_COMMAND_ECHO_RES"; + case GEARMAN_COMMAND_SUBMIT_JOB_BG: return "GEARMAN_COMMAND_SUBMIT_JOB_BG"; + case GEARMAN_COMMAND_ERROR: return "GEARMAN_COMMAND_ERROR"; + case GEARMAN_COMMAND_STATUS_RES: return "GEARMAN_COMMAND_STATUS_RES"; + case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: return "GEARMAN_COMMAND_SUBMIT_JOB_HIGH"; + case GEARMAN_COMMAND_SET_CLIENT_ID: return "GEARMAN_COMMAND_SET_CLIENT_ID"; + case GEARMAN_COMMAND_CAN_DO_TIMEOUT: return "GEARMAN_COMMAND_CAN_DO_TIMEOUT"; + case GEARMAN_COMMAND_ALL_YOURS: return "GEARMAN_COMMAND_ALL_YOURS"; + case GEARMAN_COMMAND_WORK_EXCEPTION: return "GEARMAN_COMMAND_WORK_EXCEPTION"; + case GEARMAN_COMMAND_OPTION_REQ: return "GEARMAN_COMMAND_OPTION_REQ"; + case GEARMAN_COMMAND_OPTION_RES: return "GEARMAN_COMMAND_OPTION_RES"; + case GEARMAN_COMMAND_WORK_DATA: return "GEARMAN_COMMAND_WORK_DATA"; + case GEARMAN_COMMAND_WORK_WARNING: return "GEARMAN_COMMAND_WORK_WARNING"; + case GEARMAN_COMMAND_GRAB_JOB_UNIQ: return "GEARMAN_COMMAND_GRAB_JOB_UNIQ"; + case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: return "GEARMAN_COMMAND_JOB_ASSIGN_UNIQ"; + case GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG: return "GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG"; + case GEARMAN_COMMAND_SUBMIT_JOB_LOW: return "GEARMAN_COMMAND_SUBMIT_JOB_LOW"; + case GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG: return "GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG"; + case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: return "GEARMAN_COMMAND_SUBMIT_JOB_SCHED"; + case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: return "GEARMAN_COMMAND_SUBMIT_JOB_EPOCH"; + case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: return "GEARMAN_COMMAND_SUBMIT_REDUCE_JOB"; + case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: return "GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND"; + case GEARMAN_COMMAND_GRAB_JOB_ALL: return "GEARMAN_COMMAND_GRAB_JOB_ALL"; + case GEARMAN_COMMAND_JOB_ASSIGN_ALL: return "GEARMAN_COMMAND_JOB_ASSIGN_ALL"; + default: + case GEARMAN_COMMAND_MAX: return "GEARMAN_COMMAND_MAX"; + } +} diff -Nru gearmand-0.14/libgearman/strcommand.h gearmand-0.23/libgearman/strcommand.h --- gearmand-0.14/libgearman/strcommand.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/strcommand.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,48 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +const char *gearman_strcommand(gearman_command_t command); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/strerror.c gearmand-0.23/libgearman/strerror.c --- gearmand-0.14/libgearman/strerror.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/strerror.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,122 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2010 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief gearman_strerror() - */ - -#include "common.h" - -const char *gearman_strerror(gearman_return_t rc) -{ - switch (rc) - { - case GEARMAN_SUCCESS: - return "SUCCESS"; - case GEARMAN_IO_WAIT: - return "IO_WAIT"; - case GEARMAN_SHUTDOWN: - return "SHUTDOWN"; - case GEARMAN_SHUTDOWN_GRACEFUL: - return "SHUTDOWN_GRACEFUL"; - case GEARMAN_ERRNO: - return "ERRNO"; - case GEARMAN_EVENT: - return "EVENT"; - case GEARMAN_TOO_MANY_ARGS: - return "TOO_MANY_ARGS"; - case GEARMAN_NO_ACTIVE_FDS: - return "NO_ACTIVE_FDS"; - case GEARMAN_INVALID_MAGIC: - return "INVALID_MAGIC"; - case GEARMAN_INVALID_COMMAND: - return "INVALID_COMMAND"; - case GEARMAN_INVALID_PACKET: - return "INVALID_PACKET"; - case GEARMAN_UNEXPECTED_PACKET: - return "UNEXPECTED_PACKET"; - case GEARMAN_GETADDRINFO: - return "GETADDRINFO"; - case GEARMAN_NO_SERVERS: - return "NO_SERVERS"; - case GEARMAN_LOST_CONNECTION: - return "LOST_CONNECTION"; - case GEARMAN_MEMORY_ALLOCATION_FAILURE: - return "MEMORY_ALLOCATION_FAILURE"; - case GEARMAN_JOB_EXISTS: - return "JOB_EXISTS"; - case GEARMAN_JOB_QUEUE_FULL: - return "JOB_JOB_QUEUE_FULL"; - case GEARMAN_SERVER_ERROR: - return "SERVER_ERROR"; - case GEARMAN_WORK_ERROR: - return "WORK_ERROR"; - case GEARMAN_WORK_DATA: - return "WORK_DATA"; - case GEARMAN_WORK_WARNING: - return "WORK_WARNING"; - case GEARMAN_WORK_STATUS: - return "WORK_STATUS"; - case GEARMAN_WORK_EXCEPTION: - return "WORK_EXCEPTION"; - case GEARMAN_WORK_FAIL: - return "WORK_FAIL"; - case GEARMAN_NOT_CONNECTED: - return "NOT_CONNECTED"; - case GEARMAN_COULD_NOT_CONNECT: - return "COULD_NOT_CONNECT"; - case GEARMAN_SEND_IN_PROGRESS: - return "SEND_IN_PROGRESS"; - case GEARMAN_RECV_IN_PROGRESS: - return "RECV_IN_PROGRESS"; - case GEARMAN_NOT_FLUSHING: - return "NOT_FLUSHING"; - case GEARMAN_DATA_TOO_LARGE: - return "DATA_TOO_LARGE"; - case GEARMAN_INVALID_FUNCTION_NAME: - return "INVALID_FUNCTION_NAME"; - case GEARMAN_INVALID_WORKER_FUNCTION: - return "INVALID_WORKER_FUNCTION"; - case GEARMAN_NO_REGISTERED_FUNCTION: - return "NO_REGISTERED_FUNCTION"; - case GEARMAN_NO_REGISTERED_FUNCTIONS: - return "NO_REGISTERED_FUNCTIONS"; - case GEARMAN_NO_JOBS: - return "NO_JOBS"; - case GEARMAN_ECHO_DATA_CORRUPTION: - return "ECHO_DATA_CORRUPTION"; - case GEARMAN_NEED_WORKLOAD_FN: - return "NEED_WORKLOAD_FN"; - case GEARMAN_PAUSE: - return "PAUSE"; - case GEARMAN_UNKNOWN_STATE: - return "UNKNOWN_STATE"; - case GEARMAN_PTHREAD: - return "PTHREAD"; - case GEARMAN_PIPE_EOF: - return "PIPE_EOF"; - case GEARMAN_QUEUE_ERROR: - return "QUEUE_ERROR"; - case GEARMAN_FLUSH_DATA: - return "FLUSH_DATA"; - case GEARMAN_SEND_BUFFER_TOO_SMALL: - return "SEND_BUFFER_TOO_SMALL"; - case GEARMAN_IGNORE_PACKET: - return "IGNORE_PACKET"; - case GEARMAN_UNKNOWN_OPTION: - return "UNKNOWN_OPTION"; - case GEARMAN_TIMEOUT: - return "TIMEOUT"; - case GEARMAN_ARGUMENT_TOO_LARGE: - return "The argument was too large for Gearman to handle."; - case GEARMAN_MAX_RETURN: - default: - return "Gibberish returned!"; - } -} diff -Nru gearmand-0.14/libgearman/strerror.cc gearmand-0.23/libgearman/strerror.cc --- gearmand-0.14/libgearman/strerror.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/strerror.cc 2011-06-17 22:47:55.000000000 +0200 @@ -0,0 +1,79 @@ +/* Gearman server and library + * Copyright (C) 2010 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief gearman_strerror() + */ + +#include + +// Please see http://gearman.info/libgearman/gearman_return_t.html + +const char *gearman_strerror(gearman_return_t rc) +{ + switch (rc) + { + case GEARMAN_SUCCESS: return "GEARMAN_SUCCESS"; + + case GEARMAN_ARGUMENT_TOO_LARGE: return "GEARMAN_ARGUMENT_TOO_LARGE"; + case GEARMAN_COULD_NOT_CONNECT: return "GEARMAN_COULD_NOT_CONNECT"; + case GEARMAN_DATA_TOO_LARGE: return "GEARMAN_DATA_TOO_LARGE"; + case GEARMAN_ECHO_DATA_CORRUPTION: return "GEARMAN_ECHO_DATA_CORRUPTION"; + case GEARMAN_ERRNO: return "GEARMAN_ERRNO"; + case GEARMAN_EVENT: return "GEARMAN_EVENT"; + case GEARMAN_FLUSH_DATA: return "GEARMAN_FLUSH_DATA"; + case GEARMAN_GETADDRINFO: return "GEARMAN_GETADDRINFO"; + case GEARMAN_IGNORE_PACKET: return "GEARMAN_IGNORE_PACKET"; + case GEARMAN_INVALID_ARGUMENT: return "GEARMAN_INVALID_ARGUMENT"; + case GEARMAN_INVALID_COMMAND: return "GEARMAN_INVALID_COMMAND"; + case GEARMAN_INVALID_FUNCTION_NAME: return "GEARMAN_INVALID_FUNCTION_NAME"; + case GEARMAN_INVALID_MAGIC: return "GEARMAN_INVALID_MAGIC"; + case GEARMAN_INVALID_PACKET: return "GEARMAN_INVALID_PACKET"; + case GEARMAN_INVALID_WORKER_FUNCTION: return "GEARMAN_INVALID_WORKER_FUNCTION"; + case GEARMAN_IN_PROGRESS: return "GEARMAN_IN_PROGRESS"; + case GEARMAN_IO_WAIT: return "GEARMAN_IO_WAIT"; + case GEARMAN_JOB_EXISTS: return "GEARMAN_JOB_EXISTS"; + case GEARMAN_JOB_QUEUE_FULL: return "GEARMAN_JOB_QUEUE_FULL"; + case GEARMAN_LOST_CONNECTION: return "GEARMAN_LOST_CONNECTION"; + case GEARMAN_MEMORY_ALLOCATION_FAILURE: return "GEARMAN_MEMORY_ALLOCATION_FAILURE"; + case GEARMAN_NEED_WORKLOAD_FN: return "GEARMAN_NEED_WORKLOAD_FN"; + case GEARMAN_NOT_CONNECTED: return "GEARMAN_NOT_CONNECTED"; + case GEARMAN_NOT_FLUSHING: return "GEARMAN_NOT_FLUSHING"; + case GEARMAN_NO_ACTIVE_FDS: return "GEARMAN_NO_ACTIVE_FDS"; + case GEARMAN_NO_JOBS: return "GEARMAN_NO_JOBS"; + case GEARMAN_NO_REGISTERED_FUNCTION: return "GEARMAN_NO_REGISTERED_FUNCTION"; + case GEARMAN_NO_REGISTERED_FUNCTIONS: return "GEARMAN_NO_REGISTERED_FUNCTIONS"; + case GEARMAN_NO_SERVERS: return "GEARMAN_NO_SERVERS"; + case GEARMAN_PAUSE: return "GEARMAN_PAUSE"; + case GEARMAN_PIPE_EOF: return "GEARMAN_PIPE_EOF"; + case GEARMAN_PTHREAD: return "GEARMAN_PTHREAD"; + case GEARMAN_QUEUE_ERROR: return "GEARMAN_QUEUE_ERROR"; + case GEARMAN_RECV_IN_PROGRESS: return "GEARMAN_RECV_IN_PROGRESS"; + case GEARMAN_SEND_BUFFER_TOO_SMALL: return "GEARMAN_SEND_BUFFER_TOO_SMALL"; + case GEARMAN_SEND_IN_PROGRESS: return "GEARMAN_SEND_IN_PROGRESS"; + case GEARMAN_SERVER_ERROR: return "GEARMAN_SERVER_ERROR"; + case GEARMAN_SHUTDOWN: return "GEARMAN_SHUTDOWN"; + case GEARMAN_SHUTDOWN_GRACEFUL: return "GEARMAN_SHUTDOWN_GRACEFUL"; + case GEARMAN_TIMEOUT: return "GEARMAN_TIMEOUT"; + case GEARMAN_TOO_MANY_ARGS: return "GEARMAN_TOO_MANY_ARGS"; + case GEARMAN_UNEXPECTED_PACKET: return "GEARMAN_UNEXPECTED_PACKET"; + case GEARMAN_UNKNOWN_OPTION: return "GEARMAN_UNKNOWN_OPTION"; + case GEARMAN_UNKNOWN_STATE: return "GEARMAN_UNKNOWN_STATE"; + case GEARMAN_WORK_DATA: return "GEARMAN_WORK_DATA"; + case GEARMAN_WORK_ERROR: return "GEARMAN_WORK_ERROR"; + case GEARMAN_WORK_EXCEPTION: return "GEARMAN_WORK_EXCEPTION"; + case GEARMAN_WORK_FAIL: return "GEARMAN_WORK_FAIL"; + case GEARMAN_WORK_STATUS: return "GEARMAN_WORK_STATUS"; + case GEARMAN_WORK_WARNING: return "GEARMAN_WORK_WARNING"; + + case GEARMAN_MAX_RETURN: + default: + return "GEARMAN_MAX_RETURN"; + } +} diff -Nru gearmand-0.14/libgearman/strerror.h gearmand-0.23/libgearman/strerror.h --- gearmand-0.14/libgearman/strerror.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/strerror.h 2011-04-25 19:45:20.000000000 +0200 @@ -11,8 +11,7 @@ * @brief Gearman Declarations */ -#ifndef __GEARMAN_STRERROR_H__ -#define __GEARMAN_STRERROR_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -24,5 +23,3 @@ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_STRERROR_H__ */ diff -Nru gearmand-0.14/libgearman/string.cc gearmand-0.23/libgearman/string.cc --- gearmand-0.14/libgearman/string.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/string.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,38 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand String + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include diff -Nru gearmand-0.14/libgearman/string.h gearmand-0.23/libgearman/string.h --- gearmand-0.14/libgearman/string.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/string.h 2011-06-28 19:52:37.000000000 +0200 @@ -0,0 +1,60 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libgearman library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/* shallow structure we use externally */ + +struct gearman_string_t { + const char *c_str; + const size_t size; +}; + +#define gearman_size(X) (X).size +#define gearman_c_str(X) (X).c_str +#define gearman_string_param(X) (X).c_str, (X).size +#define gearman_string_param_null NULL, 0 +#define gearman_string_param_cstr(X) (X), ((X) ? strlen(X) : 0) + +#ifdef BUILDING_LIBGEARMAN + +#ifdef __cplusplus // correct define +#define gearman_string_make(X) (X), size_t((sizeof(X) - 1)) +#else +#define gearman_string_make(X) (X), (((size_t)((sizeof(X) - 1))) +#endif // correct define + +#endif // BUILDING_LIBGEARMAN diff -Nru gearmand-0.14/libgearman/task_attr.cc gearmand-0.23/libgearman/task_attr.cc --- gearmand-0.14/libgearman/task_attr.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/task_attr.cc 2011-06-18 20:10:49.000000000 +0200 @@ -0,0 +1,91 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +gearman_task_attr_t gearman_task_attr_init(gearman_job_priority_t priority) +{ + gearman_task_attr_t local= { GEARMAN_TASK_ATTR_FOREGROUND, priority, {{0}}}; + + return local; +} + +gearman_task_attr_t gearman_task_attr_init_background(gearman_job_priority_t priority) +{ + gearman_task_attr_t local= { GEARMAN_TASK_ATTR_BACKGROUND, priority, {{0}}}; + + return local; +} + +gearman_task_attr_t gearman_task_attr_init_epoch(time_t epoch, gearman_job_priority_t priority) +{ + gearman_task_attr_t local= { GEARMAN_TASK_ATTR_BACKGROUND, priority, {{0}}}; + local.options.epoch.value= epoch; + + return local; +} + +time_t gearman_task_attr_has_epoch(const gearman_task_attr_t *self) +{ + if (not self) + return 0; + + if (self->kind == GEARMAN_TASK_ATTR_BACKGROUND) + return self->options.epoch.value; + + return 0; +} + +gearman_job_priority_t gearman_task_attr_priority(const gearman_task_attr_t *self) +{ + if (not self) + return GEARMAN_JOB_PRIORITY_NORMAL; + + return self->priority; +} + +bool gearman_task_attr_is_background(const gearman_task_attr_t *self) +{ + if (not self) + return false; + + return (self->kind == GEARMAN_TASK_ATTR_BACKGROUND or self->kind == GEARMAN_TASK_ATTR_EPOCH); +} diff -Nru gearmand-0.14/libgearman/task_attr.h gearmand-0.23/libgearman/task_attr.h --- gearmand-0.14/libgearman/task_attr.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/task_attr.h 2011-06-18 20:10:18.000000000 +0200 @@ -0,0 +1,93 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +#include +#else +#include +#endif + +enum gearman_task_attr_kind_t { + GEARMAN_TASK_ATTR_FOREGROUND, + GEARMAN_TASK_ATTR_BACKGROUND, + GEARMAN_TASK_ATTR_EPOCH +}; + +struct gearman_task_attr_epoch_t { + time_t value; +}; + +struct gearman_task_attr_t { + enum gearman_task_attr_kind_t kind; + gearman_job_priority_t priority; + union { + char bytes[sizeof(struct gearman_task_attr_epoch_t)]; + struct gearman_task_attr_epoch_t epoch; + } options; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +#define gearman_next(X) (X) ? (X)->next : NULL + +GEARMAN_API + gearman_task_attr_t gearman_task_attr_init(gearman_job_priority_t priority); + +GEARMAN_API + gearman_task_attr_t gearman_task_attr_init_epoch(time_t epoch, gearman_job_priority_t priority); + +GEARMAN_API + gearman_task_attr_t gearman_task_attr_init_background(gearman_job_priority_t priority); + +// Everything below here is private + +GEARMAN_LOCAL +time_t gearman_task_attr_has_epoch(const gearman_task_attr_t *); + +GEARMAN_LOCAL +gearman_job_priority_t gearman_task_attr_priority(const gearman_task_attr_t *); + +GEARMAN_LOCAL +bool gearman_task_attr_is_background(const gearman_task_attr_t *); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/task.c gearmand-0.23/libgearman/task.c --- gearmand-0.14/libgearman/task.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/task.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,165 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Task Definitions - */ - -#include "common.h" - -/* - * Public Definitions - */ - -gearman_task_st *gearman_task_create(gearman_client_st *client, gearman_task_st *task) -{ - if (task == NULL) - { - task= malloc(sizeof(gearman_task_st)); - if (task == NULL) - { - gearman_universal_set_error(&client->universal, "_task_create", "malloc"); - return NULL; - } - - task->options.allocated= true; - } - else - { - task->options.allocated= false; - } - - task->options.send_in_use= false; - task->options.is_known= false; - task->options.is_running= false; - - task->state= 0; - task->created_id= 0; - task->numerator= 0; - task->denominator= 0; - task->client= client; - - if (client->task_list != NULL) - client->task_list->prev= task; - task->next= client->task_list; - task->prev= NULL; - client->task_list= task; - client->task_count++; - - task->context= NULL; - task->con= NULL; - task->recv= NULL; - task->job_handle[0]= 0; - - return task; -} - - -void gearman_task_free(gearman_task_st *task) -{ - if (task->options.send_in_use) - gearman_packet_free(&(task->send)); - - if (task != &(task->client->do_task) && task->context != NULL && - task->client->task_context_free_fn != NULL) - { - task->client->task_context_free_fn(task, (void *)task->context); - } - - if (task->client->task_list == task) - task->client->task_list= task->next; - if (task->prev != NULL) - task->prev->next= task->next; - if (task->next != NULL) - task->next->prev= task->prev; - task->client->task_count--; - - if (task->options.allocated) - free(task); -} - -const void *gearman_task_context(const gearman_task_st *task) -{ - return task->context; -} - -void gearman_task_set_context(gearman_task_st *task, void *context) -{ - task->context= context; -} - -const char *gearman_task_function_name(const gearman_task_st *task) -{ - return task->send.arg[0]; -} - -const char *gearman_task_unique(const gearman_task_st *task) -{ - return task->send.arg[1]; -} - -const char *gearman_task_job_handle(const gearman_task_st *task) -{ - return task->job_handle; -} - -bool gearman_task_is_known(const gearman_task_st *task) -{ - return task->options.is_known; -} - -bool gearman_task_is_running(const gearman_task_st *task) -{ - return task->options.is_running; -} - -uint32_t gearman_task_numerator(const gearman_task_st *task) -{ - return task->numerator; -} - -uint32_t gearman_task_denominator(const gearman_task_st *task) -{ - return task->denominator; -} - -void gearman_task_give_workload(gearman_task_st *task, const void *workload, - size_t workload_size) -{ - gearman_packet_give_data(&(task->send), workload, workload_size); -} - -size_t gearman_task_send_workload(gearman_task_st *task, const void *workload, - size_t workload_size, - gearman_return_t *ret_ptr) -{ - return gearman_connection_send_data(task->con, workload, workload_size, ret_ptr); -} - -const void *gearman_task_data(const gearman_task_st *task) -{ - return task->recv->data; -} - -size_t gearman_task_data_size(const gearman_task_st *task) -{ - return task->recv->data_size; -} - -void *gearman_task_take_data(gearman_task_st *task, size_t *data_size) -{ - return gearman_packet_take_data(task->recv, data_size); -} - -size_t gearman_task_recv_data(gearman_task_st *task, void *data, - size_t data_size, - gearman_return_t *ret_ptr) -{ - return gearman_connection_recv_data(task->con, data, data_size, ret_ptr); -} diff -Nru gearmand-0.14/libgearman/task.cc gearmand-0.23/libgearman/task.cc --- gearmand-0.14/libgearman/task.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/task.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,383 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * @file + * @brief Task Definitions + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * Public Definitions + */ + +gearman_task_st *gearman_task_internal_create(gearman_client_st *client, gearman_task_st *task) +{ + assert(client); + if (task) + { + task->options.allocated= false; + } + else + { + task= new (std::nothrow) gearman_task_st; + if (task == NULL) + { + gearman_perror(client->universal, "gearman_task_st new"); + return NULL; + } + + task->options.allocated= true; + } + + task->options.send_in_use= false; + task->options.is_known= false; + task->options.is_running= false; + task->options.was_reduced= false; + task->options.is_paused= false; + + task->type= GEARMAN_TASK_KIND_ADD_TASK; + + task->state= GEARMAN_TASK_STATE_NEW; + task->created_id= 0; + task->numerator= 0; + task->denominator= 0; + task->client= client; + + task->func= client->actions; + task->result_rc= GEARMAN_UNKNOWN_STATE; + + if (client->task_list) + client->task_list->prev= task; + task->next= client->task_list; + task->prev= NULL; + client->task_list= task; + client->task_count++; + + task->context= NULL; + task->con= NULL; + task->recv= NULL; + task->result_ptr= NULL; + task->job_handle[0]= 0; + + return task; +} + + +void gearman_task_free(gearman_task_st *task) +{ + if (not task) + return; + + delete task->result_ptr; + task->result_ptr= NULL; + + if (not task->client) + return; + + if (task->options.send_in_use) + { + gearman_packet_free(&(task->send)); + } + + if (task->type != GEARMAN_TASK_KIND_DO and task->context and task->client->task_context_free_fn) + { + task->client->task_context_free_fn(task, static_cast(task->context)); + } + + if (task->client->task_list == task) + task->client->task_list= task->next; + + if (task->prev) + task->prev->next= task->next; + if (task->next) + task->next->prev= task->prev; + + task->client->task_count--; + + if (task->options.allocated) + delete task; +} + +void gearman_task_free_result(gearman_task_st *task) +{ + assert(task); + delete task->result_ptr; + task->result_ptr= NULL; +} + +bool gearman_task_is_active(const gearman_task_st *self) +{ + switch (self->state) + { + case GEARMAN_TASK_STATE_NEW: + case GEARMAN_TASK_STATE_SUBMIT: + case GEARMAN_TASK_STATE_WORKLOAD: + case GEARMAN_TASK_STATE_WORK: + case GEARMAN_TASK_STATE_CREATED: + case GEARMAN_TASK_STATE_DATA: + case GEARMAN_TASK_STATE_WARNING: + case GEARMAN_TASK_STATE_STATUS: + return true; + + case GEARMAN_TASK_STATE_COMPLETE: + case GEARMAN_TASK_STATE_EXCEPTION: + case GEARMAN_TASK_STATE_FAIL: + case GEARMAN_TASK_STATE_FINISHED: + break; + } + + return false; +} + +const char *gearman_task_strstate(gearman_task_st *self) +{ + switch (self->state) + { + case GEARMAN_TASK_STATE_NEW: return "GEARMAN_TASK_STATE_NEW"; + case GEARMAN_TASK_STATE_SUBMIT: return "GEARMAN_TASK_STATE_SUBMIT"; + case GEARMAN_TASK_STATE_WORKLOAD: return "GEARMAN_TASK_STATE_WORKLOAD"; + case GEARMAN_TASK_STATE_WORK: return "GEARMAN_TASK_STATE_WORK"; + case GEARMAN_TASK_STATE_CREATED: return "GEARMAN_TASK_STATE_CREATED"; + case GEARMAN_TASK_STATE_DATA: return "GEARMAN_TASK_STATE_DATA"; + case GEARMAN_TASK_STATE_WARNING: return "GEARMAN_TASK_STATE_WARNING"; + case GEARMAN_TASK_STATE_STATUS: return "GEARMAN_TASK_STATE_STATUS"; + case GEARMAN_TASK_STATE_COMPLETE: return "GEARMAN_TASK_STATE_COMPLETE"; + case GEARMAN_TASK_STATE_EXCEPTION: return "GEARMAN_TASK_STATE_EXCEPTION"; + case GEARMAN_TASK_STATE_FAIL: return "GEARMAN_TASK_STATE_FAIL"; + case GEARMAN_TASK_STATE_FINISHED: return "GEARMAN_TASK_STATE_FINISHED"; + } + + return ""; +} + +void gearman_task_clear_fn(gearman_task_st *task) +{ + task->func= gearman_actions_default(); +} + +void *gearman_task_context(const gearman_task_st *task) +{ + if (not task) + return NULL; + + return const_cast(task->context); +} + +void gearman_task_set_context(gearman_task_st *task, void *context) +{ + if (not task) + return; + + task->context= context; +} + +const char *gearman_task_function_name(const gearman_task_st *task) +{ + if (not task) + return 0; + + return task->send.arg[0]; +} + +const char *gearman_task_unique(const gearman_task_st *task) +{ + if (not task) + return 0; + + return task->send.arg[1]; +} + +const char *gearman_task_job_handle(const gearman_task_st *task) +{ + if (not task) + { + return 0; + } + + return task->job_handle; +} + +bool gearman_task_is_known(const gearman_task_st *task) +{ + if (not task) + return false; + + return task->options.is_known; +} + +bool gearman_task_is_running(const gearman_task_st *task) +{ + if (not task) + return false; + + return task->options.is_running; +} + +uint32_t gearman_task_numerator(const gearman_task_st *task) +{ + if (not task) + return 0; + + return task->numerator; +} + +uint32_t gearman_task_denominator(const gearman_task_st *task) +{ + if (not task) + return 0; + + return task->denominator; +} + +void gearman_task_give_workload(gearman_task_st *task, const void *workload, + size_t workload_size) +{ + if (not task) + return; + + gearman_packet_give_data(task->send, workload, workload_size); +} + +size_t gearman_task_send_workload(gearman_task_st *task, const void *workload, + size_t workload_size, + gearman_return_t *ret_ptr) +{ + if (not task) + return 0; + + return task->con->send_and_flush(workload, workload_size, ret_ptr); +} + +gearman_result_st *gearman_task_result(gearman_task_st *task) +{ + if (not task) + return NULL; + + return task->result_ptr; +} + +gearman_result_st *gearman_task_mutable_result(gearman_task_st *task) +{ + assert(task); // Programmer error + if (not task->result_ptr) + task->result_ptr= new gearman_result_st(); + + return task->result_ptr; +} + +const void *gearman_task_data(const gearman_task_st *task) +{ + if (not task) + return NULL; + + if (task->recv and task->recv->data) + return task->recv->data; + + return 0; +} + +size_t gearman_task_data_size(const gearman_task_st *task) +{ + if (not task) + return 0; + + if (task->recv and task->recv->data_size) + return task->recv->data_size; + + return 0; +} + +void *gearman_task_take_data(gearman_task_st *task, size_t *data_size) +{ + if (not task) + return 0; + + return gearman_packet_take_data(*task->recv, data_size); +} + +size_t gearman_task_recv_data(gearman_task_st *task, void *data, + size_t data_size, + gearman_return_t *ret_ptr) +{ + if (not task) + { + return 0; + } + + if (not ret_ptr) + { + gearman_return_t unused; + return task->con->receiving(data, data_size, unused); + } + + return task->con->receiving(data, data_size, *ret_ptr); +} + +const char *gearman_task_error(const gearman_task_st *task) +{ + if (not task) + { + return NULL; + } + + if (task->result_rc == GEARMAN_UNKNOWN_STATE or task->result_rc == GEARMAN_SUCCESS) + return NULL; + + return gearman_strerror(task->result_rc); +} + +gearman_return_t gearman_task_return(const gearman_task_st *task) +{ + assert(task); // Only used internally. + if (not task) + { + return GEARMAN_INVALID_ARGUMENT; + } + + return task->result_rc; +} diff -Nru gearmand-0.14/libgearman/task.h gearmand-0.23/libgearman/task.h --- gearmand-0.14/libgearman/task.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/task.h 2011-06-18 05:22:56.000000000 +0200 @@ -1,9 +1,39 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ /** @@ -11,8 +41,9 @@ * @brief Task Declarations */ -#ifndef __GEARMAN_TASK_H__ -#define __GEARMAN_TASK_H__ +#pragma once + +#include #ifdef __cplusplus extern "C" { @@ -32,28 +63,39 @@ * @ingroup gearman_task */ +enum gearman_task_state_t { + GEARMAN_TASK_STATE_NEW, + GEARMAN_TASK_STATE_SUBMIT, + GEARMAN_TASK_STATE_WORKLOAD, + GEARMAN_TASK_STATE_WORK, + GEARMAN_TASK_STATE_CREATED, + GEARMAN_TASK_STATE_DATA, + GEARMAN_TASK_STATE_WARNING, + GEARMAN_TASK_STATE_STATUS, + GEARMAN_TASK_STATE_COMPLETE, + GEARMAN_TASK_STATE_EXCEPTION, + GEARMAN_TASK_STATE_FAIL, + GEARMAN_TASK_STATE_FINISHED +}; + +enum gearman_task_kind_t { + GEARMAN_TASK_KIND_ADD_TASK, + GEARMAN_TASK_KIND_EXECUTE, + GEARMAN_TASK_KIND_DO +}; + struct gearman_task_st { struct { - bool allocated LIBGEARMAN_BITFIELD; - bool send_in_use LIBGEARMAN_BITFIELD; - bool is_known LIBGEARMAN_BITFIELD; - bool is_running LIBGEARMAN_BITFIELD; + bool allocated; + bool send_in_use; + bool is_known; + bool is_running; + bool was_reduced; + bool is_paused; } options; - enum { - GEARMAN_TASK_STATE_NEW, - GEARMAN_TASK_STATE_SUBMIT, - GEARMAN_TASK_STATE_WORKLOAD, - GEARMAN_TASK_STATE_WORK, - GEARMAN_TASK_STATE_CREATED, - GEARMAN_TASK_STATE_DATA, - GEARMAN_TASK_STATE_WARNING, - GEARMAN_TASK_STATE_STATUS, - GEARMAN_TASK_STATE_COMPLETE, - GEARMAN_TASK_STATE_EXCEPTION, - GEARMAN_TASK_STATE_FAIL, - GEARMAN_TASK_STATE_FINISHED - } state; + enum gearman_task_kind_t type; + enum gearman_task_state_t state; uint32_t created_id; uint32_t numerator; uint32_t denominator; @@ -64,9 +106,13 @@ gearman_connection_st *con; gearman_packet_st *recv; gearman_packet_st send; + struct gearman_actions_t func; + gearman_return_t result_rc; + struct gearman_result_st *result_ptr; char job_handle[GEARMAN_JOB_HANDLE_SIZE]; }; +#ifdef __cplusplus /** * Initialize a task structure. * @@ -77,8 +123,16 @@ * failure this will be NULL. */ GEARMAN_LOCAL -gearman_task_st *gearman_task_create(gearman_client_st *client, - gearman_task_st *task); +gearman_task_st *gearman_task_internal_create(gearman_client_st *client, + gearman_task_st *task); + +GEARMAN_LOCAL +const char *gearman_task_strstate(gearman_task_st *self); + +#endif + +GEARMAN_LOCAL +void gearman_task_clear_fn(gearman_task_st *task); /** * Free a task structure. @@ -94,7 +148,10 @@ * Get context for a task. */ GEARMAN_API -const void *gearman_task_context(const gearman_task_st *task); +void *gearman_task_context(const gearman_task_st *task); + +GEARMAN_LOCAL +bool gearman_task_is_active(const gearman_task_st *self); /** * Set context for a task. @@ -186,10 +243,23 @@ size_t gearman_task_recv_data(gearman_task_st *task, void *data, size_t data_size, gearman_return_t *ret_ptr); +GEARMAN_API +const char *gearman_task_error(const gearman_task_st *task); + +GEARMAN_API +gearman_result_st *gearman_task_result(gearman_task_st *task); + +GEARMAN_API +gearman_return_t gearman_task_return(const gearman_task_st *task); + +GEARMAN_LOCAL +gearman_result_st *gearman_task_mutable_result(gearman_task_st *task); + +GEARMAN_LOCAL +void gearman_task_free_result(gearman_task_st *task); + /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_TASK_H__ */ diff -Nru gearmand-0.14/libgearman/unique.cc gearmand-0.23/libgearman/unique.cc --- gearmand-0.14/libgearman/unique.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/unique.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,52 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +gearman_unique_t gearman_unique_make(const char *arg, size_t arg_size) +{ + gearman_unique_t local= { arg, arg_size }; + return local; +} + +size_t gearman_unique_size(gearman_unique_t *self) +{ + if (not self) + return 0; + + return self->size; +} diff -Nru gearmand-0.14/libgearman/unique.h gearmand-0.23/libgearman/unique.h --- gearmand-0.14/libgearman/unique.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/unique.h 2011-05-25 01:17:50.000000000 +0200 @@ -0,0 +1,57 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +struct gearman_unique_t { + const char *c_str; + const size_t size; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_API +gearman_unique_t gearman_unique_make(const char *arg, size_t arg_size); + +GEARMAN_LOCAL +size_t gearman_unique_size(gearman_unique_t *self); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/universal.c gearmand-0.23/libgearman/universal.c --- gearmand-0.14/libgearman/universal.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/universal.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,418 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman State Definitions - */ - -#include "common.h" - -/** - * @addtogroup gearman_universal Static Gearman Declarations - * @ingroup universal - * @{ - */ - -gearman_universal_st *gearman_universal_create(gearman_universal_st *universal, const gearman_universal_options_t *options) -{ - assert(universal); - - { // Set defaults on all options. - universal->options.allocated= false; - universal->options.dont_track_packets= false; - universal->options.non_blocking= false; - universal->options.stored_non_blocking= false; - } - - if (options) - { - while (*options != GEARMAN_MAX) - { - /** - @note Check for bad value, refactor gearman_add_options(). - */ - gearman_universal_add_options(universal, *options); - options++; - } - } - - universal->verbose= 0; - universal->con_count= 0; - universal->packet_count= 0; - universal->pfds_size= 0; - universal->sending= 0; - universal->last_errno= 0; - universal->timeout= -1; - universal->con_list= NULL; - universal->packet_list= NULL; - universal->pfds= NULL; - universal->log_fn= NULL; - universal->log_context= NULL; - universal->event_watch_fn= NULL; - universal->event_watch_context= NULL; - universal->workload_malloc_fn= NULL; - universal->workload_malloc_context= NULL; - universal->workload_free_fn= NULL; - universal->workload_free_context= NULL; - universal->last_error[0]= 0; - - return universal; -} - -gearman_universal_st *gearman_universal_clone(gearman_universal_st *destination, const gearman_universal_st *source) -{ - gearman_universal_st *check; - gearman_connection_st *con; - - assert(destination); - assert(source); - - if (! destination || ! source) - return NULL; - - check= gearman_universal_create(destination, NULL); - - if (! check) - { - return destination; - } - - (void)gearman_universal_set_option(destination, GEARMAN_NON_BLOCKING, source->options.non_blocking); - (void)gearman_universal_set_option(destination, GEARMAN_DONT_TRACK_PACKETS, source->options.dont_track_packets); - - destination->timeout= source->timeout; - - for (con= source->con_list; con != NULL; con= con->next) - { - if (gearman_connection_clone(destination, NULL, con) == NULL) - { - gearman_universal_free(destination); - return NULL; - } - } - - /* Don't clone job or packet information, this is universal information for - old and active jobs/connections. */ - - return destination; -} - -void gearman_universal_free(gearman_universal_st *universal) -{ - gearman_free_all_cons(universal); - gearman_free_all_packets(universal); - - if (universal->pfds != NULL) - free(universal->pfds); - - if (universal->options.allocated) - { - assert(0); - free(universal); - } -} - -gearman_return_t gearman_universal_set_option(gearman_universal_st *universal, gearman_universal_options_t option, bool value) -{ - switch (option) - { - case GEARMAN_NON_BLOCKING: - universal->options.non_blocking= value; - break; - case GEARMAN_DONT_TRACK_PACKETS: - universal->options.dont_track_packets= value; - break; - case GEARMAN_MAX: - default: - return GEARMAN_INVALID_COMMAND; - } - - return GEARMAN_SUCCESS; -} - -int gearman_universal_timeout(gearman_universal_st *universal) -{ - return universal->timeout; -} - -void gearman_universal_set_timeout(gearman_universal_st *universal, int timeout) -{ - universal->timeout= timeout; -} - -void gearman_set_log_fn(gearman_universal_st *universal, gearman_log_fn *function, - void *context, gearman_verbose_t verbose) -{ - universal->log_fn= function; - universal->log_context= context; - universal->verbose= verbose; -} - -void gearman_set_event_watch_fn(gearman_universal_st *universal, - gearman_event_watch_fn *function, - void *context) -{ - universal->event_watch_fn= function; - universal->event_watch_context= context; -} - -void gearman_set_workload_malloc_fn(gearman_universal_st *universal, - gearman_malloc_fn *function, - void *context) -{ - universal->workload_malloc_fn= function; - universal->workload_malloc_context= context; -} - -void gearman_set_workload_free_fn(gearman_universal_st *universal, - gearman_free_fn *function, - void *context) -{ - universal->workload_free_fn= function; - universal->workload_free_context= context; -} - -void gearman_free_all_cons(gearman_universal_st *universal) -{ - while (universal->con_list != NULL) - gearman_connection_free(universal->con_list); -} - -gearman_return_t gearman_flush_all(gearman_universal_st *universal) -{ - gearman_connection_st *con; - gearman_return_t ret; - - for (con= universal->con_list; con != NULL; con= con->next) - { - if (con->events & POLLOUT) - continue; - - ret= gearman_connection_flush(con); - if (ret != GEARMAN_SUCCESS && ret != GEARMAN_IO_WAIT) - return ret; - } - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_wait(gearman_universal_st *universal) -{ - gearman_connection_st *con; - struct pollfd *pfds; - nfds_t x; - int ret; - gearman_return_t gret; - - if (universal->pfds_size < universal->con_count) - { - pfds= realloc(universal->pfds, universal->con_count * sizeof(struct pollfd)); - if (pfds == NULL) - { - gearman_universal_set_error(universal, "gearman_wait", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - universal->pfds= pfds; - universal->pfds_size= universal->con_count; - } - else - pfds= universal->pfds; - - x= 0; - for (con= universal->con_list; con != NULL; con= con->next) - { - if (con->events == 0) - continue; - - pfds[x].fd= con->fd; - pfds[x].events= con->events; - pfds[x].revents= 0; - x++; - } - - if (x == 0) - { - gearman_universal_set_error(universal, "gearman_wait", "no active file descriptors"); - return GEARMAN_NO_ACTIVE_FDS; - } - - while (1) - { - ret= poll(pfds, x, universal->timeout); - if (ret == -1) - { - if (errno == EINTR) - continue; - - gearman_universal_set_error(universal, "gearman_wait", "poll:%d", errno); - universal->last_errno= errno; - return GEARMAN_ERRNO; - } - - break; - } - - if (ret == 0) - { - gearman_universal_set_error(universal, "gearman_wait", "timeout reached"); - return GEARMAN_TIMEOUT; - } - - x= 0; - for (con= universal->con_list; con != NULL; con= con->next) - { - if (con->events == 0) - continue; - - gret= gearman_connection_set_revents(con, pfds[x].revents); - if (gret != GEARMAN_SUCCESS) - return gret; - - x++; - } - - return GEARMAN_SUCCESS; -} - -gearman_connection_st *gearman_ready(gearman_universal_st *universal) -{ - gearman_connection_st *con; - - /* We can't keep universal between calls since connections may be removed during - processing. If this list ever gets big, we may want something faster. */ - - for (con= universal->con_list; con != NULL; con= con->next) - { - if (con->options.ready) - { - con->options.ready= false; - return con; - } - } - - return NULL; -} - -/** - @note _push_blocking is only used for echo (and should be fixed - when tricky flip/flop in IO is fixed). -*/ -static inline void _push_blocking(gearman_universal_st *universal, bool *orig_block_universal) -{ - *orig_block_universal= universal->options.non_blocking; - universal->options.non_blocking= false; -} - -static inline void _pop_non_blocking(gearman_universal_st *universal, bool orig_block_universal) -{ - universal->options.non_blocking= orig_block_universal; -} - -gearman_return_t gearman_echo(gearman_universal_st *universal, - const void *workload, - size_t workload_size) -{ - gearman_connection_st *con; - gearman_packet_st packet; - gearman_return_t ret; - bool orig_block_universal; - - ret= gearman_packet_create_args(universal, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_ECHO_REQ, - &workload, &workload_size, 1); - if (ret != GEARMAN_SUCCESS) - { - return ret; - } - - _push_blocking(universal, &orig_block_universal); - - for (con= universal->con_list; con != NULL; con= con->next) - { - gearman_packet_st *packet_ptr; - - ret= gearman_connection_send(con, &packet, true); - if (ret != GEARMAN_SUCCESS) - { - goto exit; - } - - packet_ptr= gearman_connection_recv(con, &(con->packet), &ret, true); - if (ret != GEARMAN_SUCCESS) - { - goto exit; - } - - assert(packet_ptr); - - if (con->packet.data_size != workload_size || - memcmp(workload, con->packet.data, workload_size)) - { - gearman_packet_free(&(con->packet)); - gearman_universal_set_error(universal, "gearman_echo", "corruption during echo"); - - ret= GEARMAN_ECHO_DATA_CORRUPTION; - goto exit; - } - - gearman_packet_free(&(con->packet)); - } - - ret= GEARMAN_SUCCESS; - -exit: - gearman_packet_free(&packet); - _pop_non_blocking(universal, orig_block_universal); - - return ret; -} - -void gearman_free_all_packets(gearman_universal_st *universal) -{ - while (universal->packet_list != NULL) - gearman_packet_free(universal->packet_list); -} - -/* - * Local Definitions - */ - -void gearman_universal_set_error(gearman_universal_st *universal, const char *function, - const char *format, ...) -{ - size_t size; - char *ptr; - char log_buffer[GEARMAN_MAX_ERROR_SIZE]; - va_list args; - - size= strlen(function); - ptr= memcpy(log_buffer, function, size); - ptr+= size; - ptr[0]= ':'; - size++; - ptr++; - - va_start(args, format); - size+= (size_t)vsnprintf(ptr, GEARMAN_MAX_ERROR_SIZE - size, format, args); - va_end(args); - - if (universal->log_fn == NULL) - { - if (size >= GEARMAN_MAX_ERROR_SIZE) - size= GEARMAN_MAX_ERROR_SIZE - 1; - - memcpy(universal->last_error, log_buffer, size + 1); - } - else - { - universal->log_fn(log_buffer, GEARMAN_VERBOSE_FATAL, - (void *)universal->log_context); - } -} diff -Nru gearmand-0.14/libgearman/universal.cc gearmand-0.23/libgearman/universal.cc --- gearmand-0.14/libgearman/universal.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/universal.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,480 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * @file + * @brief Gearman State Definitions + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +void gearman_universal_initialize(gearman_universal_st &self, const gearman_universal_options_t *options) +{ + { // Set defaults on all options. + self.options.dont_track_packets= false; + self.options.non_blocking= false; + self.options.stored_non_blocking= false; + } + + if (options) + { + while (*options != GEARMAN_MAX) + { + /** + @note Check for bad value, refactor gearman_add_options(). + */ + gearman_universal_add_options(self, *options); + options++; + } + } + + self.verbose= GEARMAN_VERBOSE_NEVER; + self.con_count= 0; + self.packet_count= 0; + self.pfds_size= 0; + self.sending= 0; + self.timeout= -1; + self.con_list= NULL; + self.packet_list= NULL; + self.pfds= NULL; + self.log_fn= NULL; + self.log_context= NULL; + self.allocator= gearman_default_allocator(); + self._namespace= NULL; + self.error.rc= GEARMAN_SUCCESS; + self.error.last_errno= 0; + self.error.last_error[0]= 0; +} + +void gearman_universal_clone(gearman_universal_st &destination, const gearman_universal_st &source) +{ + gearman_universal_initialize(destination); + + (void)gearman_universal_set_option(destination, GEARMAN_NON_BLOCKING, source.options.non_blocking); + (void)gearman_universal_set_option(destination, GEARMAN_DONT_TRACK_PACKETS, source.options.dont_track_packets); + + destination.timeout= source.timeout; + + destination._namespace= gearman_string_clone(source._namespace); + + for (gearman_connection_st *con= source.con_list; con; con= con->next) + { + if (not gearman_connection_copy(destination, *con)) + { + gearman_universal_free(destination); + return; + } + } +} + +void gearman_universal_free(gearman_universal_st &universal) +{ + gearman_free_all_cons(universal); + gearman_free_all_packets(universal); + gearman_string_free(universal._namespace); + + if (universal.pfds) + { + // created realloc() + free(universal.pfds); + } +} + +gearman_return_t gearman_universal_set_option(gearman_universal_st &self, gearman_universal_options_t option, bool value) +{ + switch (option) + { + case GEARMAN_NON_BLOCKING: + self.options.non_blocking= value; + break; + + case GEARMAN_DONT_TRACK_PACKETS: + self.options.dont_track_packets= value; + break; + + case GEARMAN_MAX: + default: + return GEARMAN_INVALID_COMMAND; + } + + return GEARMAN_SUCCESS; +} + +int gearman_universal_timeout(gearman_universal_st &self) +{ + return self.timeout; +} + +void gearman_universal_set_timeout(gearman_universal_st &self, int timeout) +{ + self.timeout= timeout; +} + +void gearman_set_log_fn(gearman_universal_st &self, gearman_log_fn *function, + void *context, gearman_verbose_t verbose) +{ + self.log_fn= function; + self.log_context= context; + self.verbose= verbose; +} + +void gearman_set_workload_malloc_fn(gearman_universal_st& universal, + gearman_malloc_fn *function, + void *context) +{ + universal.allocator.malloc= function; + universal.allocator.context= context; +} + +void gearman_set_workload_free_fn(gearman_universal_st& universal, + gearman_free_fn *function, + void *context) +{ + universal.allocator.free= function; + universal.allocator.context= context; +} + +void gearman_free_all_cons(gearman_universal_st& universal) +{ + while (universal.con_list) + { + delete universal.con_list; + } +} + +void gearman_reset(gearman_universal_st& universal) +{ + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + con->close(); + } +} + +gearman_return_t gearman_flush_all(gearman_universal_st& universal) +{ + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + if (con->events & POLLOUT) + continue; + + gearman_return_t ret= con->flush(); + if (gearman_failed(ret) and ret != GEARMAN_IO_WAIT) + return ret; + } + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_wait(gearman_universal_st& universal) +{ + struct pollfd *pfds; + + if (universal.pfds_size < universal.con_count) + { + pfds= static_cast(realloc(universal.pfds, universal.con_count * sizeof(struct pollfd))); + if (not pfds) + { + gearman_perror(universal, "pollfd realloc"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + universal.pfds= pfds; + universal.pfds_size= universal.con_count; + } + else + { + pfds= universal.pfds; + } + + nfds_t x= 0; + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + if (con->events == 0) + continue; + + pfds[x].fd= con->fd; + pfds[x].events= con->events; + pfds[x].revents= 0; + x++; + } + + if (x == 0) + { + return gearman_error(universal, GEARMAN_NO_ACTIVE_FDS, "no active file descriptors"); + } + + int ret= 0; + while (universal.timeout) + { + ret= poll(pfds, x, universal.timeout); + if (ret == -1) + { + switch(errno) + { + case EINTR: + continue; + + default: + return gearman_perror(universal, "poll"); + } + } + + break; + } + + if (not ret) + { + gearman_error(universal, GEARMAN_TIMEOUT, "timeout reached"); + return GEARMAN_TIMEOUT; + } + + x= 0; + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + if (con->events == 0) + continue; + + int err; + socklen_t len= sizeof (err); + (void)getsockopt(con->fd, SOL_SOCKET, SO_ERROR, &err, &len); + if (err) + { + con->cached_errno= err; + } + + con->set_revents(pfds[x].revents); + + x++; + } + + return GEARMAN_SUCCESS; +} + +gearman_connection_st *gearman_ready(gearman_universal_st& universal) +{ + /* + We can't keep universal between calls since connections may be removed during + processing. If this list ever gets big, we may want something faster. + */ + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + if (con->options.ready) + { + con->options.ready= false; + return con; + } + } + + return NULL; +} + +/** + @note _push_blocking is only used for echo (and should be fixed + when tricky flip/flop in IO is fixed). +*/ +static inline void _push_blocking(gearman_universal_st& universal, bool &orig_block_universal) +{ + orig_block_universal= universal.options.non_blocking; + universal.options.non_blocking= false; +} + +static inline void _pop_non_blocking(gearman_universal_st& universal, bool orig_block_universal) +{ + universal.options.non_blocking= orig_block_universal; +} + +gearman_return_t gearman_echo(gearman_universal_st& universal, + const void *workload, + size_t workload_size) +{ + gearman_packet_st packet; + bool orig_block_universal; + + if (not workload) + { + gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "workload was NULL"); + return GEARMAN_INVALID_ARGUMENT; + } + + if (not workload_size) + { + gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "workload_size was 0"); + return GEARMAN_INVALID_ARGUMENT; + } + + gearman_return_t ret= gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_ECHO_REQ, + &workload, &workload_size, 1); + if (gearman_failed(ret)) + { + return ret; + } + + _push_blocking(universal, orig_block_universal); + + for (gearman_connection_st *con= universal.con_list; con; con= con->next) + { + gearman_packet_st *packet_ptr; + + ret= con->send(packet, true); + if (gearman_failed(ret)) + { + goto exit; + } + + packet_ptr= con->receiving(con->_packet, ret, true); + if (gearman_failed(ret)) + { + goto exit; + } + + assert(packet_ptr); + + if (con->_packet.data_size != workload_size || + memcmp(workload, con->_packet.data, workload_size)) + { + gearman_packet_free(&(con->_packet)); + gearman_error(universal, GEARMAN_ECHO_DATA_CORRUPTION, "corruption during echo"); + + ret= GEARMAN_ECHO_DATA_CORRUPTION; + goto exit; + } + + gearman_packet_free(&(con->_packet)); + } + + ret= GEARMAN_SUCCESS; + +exit: + gearman_packet_free(&packet); + _pop_non_blocking(universal, orig_block_universal); + + return ret; +} + +bool gearman_request_option(gearman_universal_st &universal, + gearman_string_t &option) +{ + gearman_connection_st *con; + gearman_packet_st packet; + bool orig_block_universal; + + const void *args[]= { gearman_c_str(option) }; + size_t args_size[]= { gearman_size(option) }; + + gearman_return_t ret; + ret= gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_OPTION_REQ, + args, args_size, 1); + if (gearman_failed(ret)) + { + gearman_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "gearman_packet_create_args()"); + return ret; + } + + _push_blocking(universal, orig_block_universal); + + for (con= universal.con_list; con != NULL; con= con->next) + { + gearman_packet_st *packet_ptr; + + ret= con->send(packet, true); + if (gearman_failed(ret)) + { + gearman_packet_free(&(con->_packet)); + goto exit; + } + + packet_ptr= con->receiving(con->_packet, ret, true); + if (gearman_failed(ret)) + { + gearman_packet_free(&(con->_packet)); + goto exit; + } + + assert(packet_ptr); + + if (packet_ptr->command == GEARMAN_COMMAND_ERROR) + { + gearman_packet_free(&(con->_packet)); + gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "invalid server option"); + + ret= GEARMAN_INVALID_ARGUMENT;; + goto exit; + } + + gearman_packet_free(&(con->_packet)); + } + + ret= GEARMAN_SUCCESS; + +exit: + gearman_packet_free(&packet); + _pop_non_blocking(universal, orig_block_universal); + + return gearman_success(ret); +} + +void gearman_free_all_packets(gearman_universal_st &universal) +{ + while (universal.packet_list) + gearman_packet_free(universal.packet_list); +} + +/* + * Local Definitions + */ + +void gearman_universal_set_namespace(gearman_universal_st& universal, const char *namespace_key, size_t namespace_key_size) +{ + gearman_string_free(universal._namespace); + universal._namespace= gearman_string_create(NULL, namespace_key, namespace_key_size); +} diff -Nru gearmand-0.14/libgearman/universal.h gearmand-0.23/libgearman/universal.h --- gearmand-0.14/libgearman/universal.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/universal.h 2011-06-22 17:48:39.000000000 +0200 @@ -1,22 +1,51 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Gearman Declarations - */ +#pragma once -#ifndef __GEARMAN_UNIVERSAL_H__ -#define __GEARMAN_UNIVERSAL_H__ +#include -#ifdef __cplusplus -extern "C" { -#endif +/** + @todo this is only used by the server and should be made private. + */ +typedef struct gearman_connection_st gearman_connection_st; +typedef gearman_return_t (gearman_event_watch_fn)(gearman_connection_st *con, + short events, void *context); /** * @ingroup gearman_universal @@ -24,291 +53,26 @@ struct gearman_universal_st { struct { - bool allocated LIBGEARMAN_BITFIELD; // Not Used (will remove later) - bool dont_track_packets LIBGEARMAN_BITFIELD; - bool non_blocking LIBGEARMAN_BITFIELD; - bool stored_non_blocking LIBGEARMAN_BITFIELD; + bool dont_track_packets; + bool non_blocking; + bool stored_non_blocking; } options; gearman_verbose_t verbose; uint32_t con_count; uint32_t packet_count; uint32_t pfds_size; uint32_t sending; - int last_errno; int timeout; // Used by poll() gearman_connection_st *con_list; gearman_packet_st *packet_list; struct pollfd *pfds; gearman_log_fn *log_fn; void *log_context; - gearman_event_watch_fn *event_watch_fn; - void *event_watch_context; - gearman_malloc_fn *workload_malloc_fn; - void *workload_malloc_context; - gearman_free_fn *workload_free_fn; - void *workload_free_context; - char last_error[GEARMAN_MAX_ERROR_SIZE]; + gearman_allocator_t allocator; + struct gearman_vector_st *_namespace; + struct { + gearman_return_t rc; + int last_errno; + char last_error[GEARMAN_MAX_ERROR_SIZE]; + } error; }; - -#ifdef GEARMAN_CORE - - -/** - * @addtogroup gearman_universal Gearman Declarations - * - * This is a low level interface for gearman library instances. This is used - * internally by both client and worker interfaces, so you probably want to - * look there first. - * - * There is no locking within a single gearman_universal_st structure, so for threaded - * applications you must either ensure isolation in the application or use - * multiple gearman_universal_st structures (for example, one for each thread). - * - * @{ - */ - - -/** - * Initialize a gearman_universal_st structure. Always check the return value for failure. - * Some other initialization may have failed. It is not required to memset() - * a structure before providing it. These are for internal use only. - * - * @param[in] source Caller allocated structure. - * @param[in] options gearman_universal_options_t options used to modify creation. - * @return On success, a pointer to the (possibly allocated) structure. On - * failure this will be NULL. - */ -GEARMAN_INTERNAL_API -gearman_universal_st *gearman_universal_create(gearman_universal_st *source, const gearman_universal_options_t *options); - -/** - * Clone a gearman structure. - * - * @param[in] destination gearman_universal_st. - * @param[in] source gearman_universal_st to clone from. - * @return Same return as gearman_universal_create(). - */ -GEARMAN_INTERNAL_API -gearman_universal_st *gearman_universal_clone(gearman_universal_st *destination, const gearman_universal_st *source); - -/** - * Free a gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - */ -GEARMAN_INTERNAL_API -void gearman_universal_free(gearman_universal_st *gearman); - -/** - * Set the error string. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] function Name of function the error happened in. - * @param[in] format Format and variable argument list of message. - */ -GEARMAN_INTERNAL_API -void gearman_universal_set_error(gearman_universal_st *gearman, const char *function, - const char *format, ...); - -/** - * Return an error string for last error encountered. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @return Pointer to a buffer in the structure that holds an error string. - */ -static inline const char *gearman_universal_error(const gearman_universal_st *gearman) -{ - if (gearman->last_error[0] == 0) - return NULL; - return (const char *)(gearman->last_error); -} - -/** - * Value of errno in the case of a GEARMAN_ERRNO return value. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @return An errno value as defined in your system errno.h file. - */ -static inline int gearman_universal_errno(const gearman_universal_st *gearman) -{ - return gearman->last_errno; -} - -/** - * Add options for a gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] options Available options for gearman structures. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_universal_set_option(gearman_universal_st *gearman, gearman_universal_options_t option, bool value); - -static inline void gearman_universal_add_options(gearman_universal_st *gearman, gearman_universal_options_t options) -{ - (void)gearman_universal_set_option(gearman, options, true); -} - -static inline void gearman_universal_remove_options(gearman_universal_st *gearman, gearman_universal_options_t options) -{ - (void)gearman_universal_set_option(gearman, options, false); -} - -static inline bool gearman_universal_is_non_blocking(gearman_universal_st *gearman) -{ - return gearman->options.non_blocking; -} - -/** - * Get current socket I/O activity timeout value. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @return Timeout in milliseconds to wait for I/O activity. A negative value - * means an infinite timeout. - */ -GEARMAN_INTERNAL_API -int gearman_universal_timeout(gearman_universal_st *gearman); - -/** - * Set socket I/O activity timeout for connections in a Gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] timeout Milliseconds to wait for I/O activity. A negative value - * means an infinite timeout. - */ -GEARMAN_INTERNAL_API -void gearman_universal_set_timeout(gearman_universal_st *gearman, int timeout); - -/** - * Set logging function for a gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] function Function to call when there is a logging message. - * @param[in] context Argument to pass into the callback function. - * @param[in] verbose Verbosity level threshold. Only call function when the - * logging message is equal to or less verbose that this. - */ -GEARMAN_INTERNAL_API -void gearman_set_log_fn(gearman_universal_st *gearman, gearman_log_fn *function, - void *context, gearman_verbose_t verbose); - -/** - * Set custom I/O event callback function for a gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] function Function to call when there is an I/O event. - * @param[in] context Argument to pass into the callback function. - */ -GEARMAN_INTERNAL_API -void gearman_set_event_watch_fn(gearman_universal_st *gearman, - gearman_event_watch_fn *function, - void *context); - -/** - * Set custom memory allocation function for workloads. Normally gearman uses - * the standard system malloc to allocate memory used with workloads. The - * provided function will be used instead. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] function Memory allocation function to use instead of malloc(). - * @param[in] context Argument to pass into the callback function. - */ -GEARMAN_INTERNAL_API -void gearman_set_workload_malloc_fn(gearman_universal_st *gearman, - gearman_malloc_fn *function, - void *context); - -/** - * Set custom memory free function for workloads. Normally gearman uses the - * standard system free to free memory used with workloads. The provided - * function will be used instead. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] function Memory free function to use instead of free(). - * @param[in] context Argument to pass into the callback function. - */ -GEARMAN_INTERNAL_API -void gearman_set_workload_free_fn(gearman_universal_st *gearman, - gearman_free_fn *function, - void *context); - -/** - * Free all connections for a gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - */ -GEARMAN_INTERNAL_API -void gearman_free_all_cons(gearman_universal_st *gearman); - -/** - * Flush the send buffer for all connections. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @return Standard gearman return value. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_flush_all(gearman_universal_st *gearman); - -/** - * Wait for I/O on connections. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @return Standard gearman return value. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_wait(gearman_universal_st *gearman); - -/** - * Get next connection that is ready for I/O. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @return Connection that is ready for I/O, or NULL if there are none. - */ -GEARMAN_INTERNAL_API -gearman_connection_st *gearman_ready(gearman_universal_st *gearman); - -/** - * Test echo with all connections. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - * @param[in] workload Data to send in echo packet. - * @param[in] workload_size Size of workload. - * @return Standard gearman return value. - */ -GEARMAN_INTERNAL_API -gearman_return_t gearman_echo(gearman_universal_st *gearman, const void *workload, - size_t workload_size); - -/** - * Free all packets for a gearman structure. - * - * @param[in] gearman Structure previously initialized with gearman_universal_create() or - * gearman_clone(). - */ -GEARMAN_INTERNAL_API -void gearman_free_all_packets(gearman_universal_st *gearman); - -#endif /* GEARMAN_CORE */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_UNIVERSAL_H__ */ diff -Nru gearmand-0.14/libgearman/universal.hpp gearmand-0.23/libgearman/universal.hpp --- gearmand-0.14/libgearman/universal.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/universal.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,148 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +// Get next connection that is ready for I/O. +GEARMAN_LOCAL +gearman_connection_st *gearman_ready(gearman_universal_st&); + +GEARMAN_LOCAL +void gearman_universal_initialize(gearman_universal_st &self, const gearman_universal_options_t *options= NULL); + +GEARMAN_LOCAL +void gearman_universal_clone(gearman_universal_st &destination, const gearman_universal_st &source); + +GEARMAN_LOCAL +void gearman_universal_free(gearman_universal_st &gearman); + +GEARMAN_LOCAL +void gearman_free_all_packets(gearman_universal_st &gearman); + +GEARMAN_LOCAL +bool gearman_request_option(gearman_universal_st &universal, gearman_string_t &option); + +GEARMAN_LOCAL +gearman_return_t gearman_universal_set_option(gearman_universal_st &self, gearman_universal_options_t option, bool value); + +GEARMAN_LOCAL +void gearman_set_log_fn(gearman_universal_st &self, gearman_log_fn *function, void *context, gearman_verbose_t verbose); + +GEARMAN_LOCAL +void gearman_universal_set_timeout(gearman_universal_st &self, int timeout); + +GEARMAN_LOCAL +int gearman_universal_timeout(gearman_universal_st &self); + +GEARMAN_LOCAL +void gearman_universal_set_namespace(gearman_universal_st &self, const char *namespace_key, size_t namespace_key_size); + +GEARMAN_LOCAL +void gearman_reset(gearman_universal_st& universal); + +// Flush the send buffer for all connections. +GEARMAN_LOCAL +gearman_return_t gearman_flush_all(gearman_universal_st&); + +/** + * Set custom memory allocation function for workloads. Normally gearman uses + * the standard system malloc to allocate memory used with workloads. The + * provided function will be used instead. + */ +GEARMAN_LOCAL +void gearman_set_workload_malloc_fn(gearman_universal_st&, + gearman_malloc_fn *function, + void *context); + +/** + * Set custom memory free function for workloads. Normally gearman uses the + * standard system free to free memory used with workloads. The provided + * function will be used instead. + */ +GEARMAN_LOCAL +void gearman_set_workload_free_fn(gearman_universal_st&, + gearman_free_fn *function, + void *context); + +// Free all connections for a gearman structure. +GEARMAN_LOCAL +void gearman_free_all_cons(gearman_universal_st&); + +// Test echo with all connections. +GEARMAN_LOCAL +gearman_return_t gearman_echo(gearman_universal_st&, const void *workload, size_t workload_size); + +/** + * Wait for I/O on connections. + * + */ +GEARMAN_LOCAL +gearman_return_t gearman_wait(gearman_universal_st&); + +static inline void gearman_universal_add_options(gearman_universal_st &self, gearman_universal_options_t options) +{ + (void)gearman_universal_set_option(self, options, true); +} + +static inline void gearman_universal_remove_options(gearman_universal_st &self, gearman_universal_options_t options) +{ + (void)gearman_universal_set_option(self, options, false); +} + +static inline bool gearman_universal_is_non_blocking(gearman_universal_st &self) +{ + return self.options.non_blocking; +} + +static inline const char *gearman_universal_error(const gearman_universal_st &self) +{ + if (self.error.last_error[0] == 0) + return NULL; + + return static_cast(self.error.last_error); +} + +static inline gearman_return_t gearman_universal_error_code(const gearman_universal_st &self) +{ + return self.error.rc; +} + +static inline int gearman_universal_errno(const gearman_universal_st &self) +{ + return self.error.last_errno; +} diff -Nru gearmand-0.14/libgearman/vector.cc gearmand-0.23/libgearman/vector.cc --- gearmand-0.14/libgearman/vector.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/vector.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,276 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand String + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include + +#include +#include +#include + +#define GEARMAN_BLOCK_SIZE 1024*4 + +inline static gearman_return_t _string_check(gearman_vector_st *string, const size_t need) +{ + if (not string) + return GEARMAN_INVALID_ARGUMENT; + + if (need && need > size_t(string->current_size - size_t(string->end - string->string))) + { + size_t current_offset= size_t(string->end - string->string); + char *new_value; + size_t adjust; + size_t new_size; + + /* This is the block multiplier. To keep it larger and surive division errors we must round it up */ + adjust= (need - size_t(string->current_size - size_t(string->end - string->string))) / GEARMAN_BLOCK_SIZE; + adjust++; + + new_size= sizeof(char) * size_t((adjust * GEARMAN_BLOCK_SIZE) + string->current_size); + /* Test for overflow */ + if (new_size < need) + { + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + new_value= static_cast(realloc(string->string, new_size)); + if (new_value == NULL) + { + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + string->string= new_value; + string->end= string->string + current_offset; + + string->current_size+= (GEARMAN_BLOCK_SIZE * adjust); + } + + return GEARMAN_SUCCESS; +} + +static inline void _init_string(gearman_vector_st *self) +{ + self->current_size= 0; + self->end= self->string= NULL; +} + +gearman_vector_st *gearman_string_create(gearman_vector_st *self, const char *str, size_t initial_size) +{ + if (not str) + return NULL; + + self= gearman_string_create(self, initial_size); + + if (not self) + return NULL; + + if (gearman_failed(gearman_string_append(self, str, initial_size))) + { + gearman_string_free(self); + return NULL; + } + + return self; +} + +gearman_vector_st *gearman_string_create(gearman_vector_st *self, size_t initial_size) +{ + /* Saving malloc calls :) */ + if (self) + { + gearman_set_allocated(self, false); + } + else + { + self= static_cast(malloc(sizeof(gearman_vector_st))); + + if (not self) + { + return NULL; + } + + gearman_set_allocated(self, true); + } + + _init_string(self); + + if (gearman_failed(_string_check(self, initial_size))) + { + if (gearman_is_allocated(self)) + { + free(self); + } + + return NULL; + } + + if (initial_size) + self->string[0]= 0; + + return self; +} + +gearman_vector_st *gearman_string_clone(const gearman_vector_st *self) +{ + if (not self) + return NULL; + + gearman_vector_st *clone= gearman_string_create(NULL, gearman_string_length(self)); + if (not clone) + return NULL; + + if (gearman_string_length(self)) + { + if (gearman_failed(gearman_string_append(clone, gearman_string_value(self), gearman_string_length(self)))) + { + gearman_string_free(clone); + return NULL; + } + } + + return clone; +} + +gearman_return_t gearman_string_append_character(gearman_vector_st *string, char character) +{ + gearman_return_t rc; + + + if (gearman_failed(rc= _string_check(string, 1 +1))) // Null terminate + { + return rc; + } + + *string->end= character; + string->end++; + *string->end= 0; + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_string_append(gearman_vector_st *string, + const char *value, size_t length) +{ + gearman_return_t rc; + + if (gearman_failed(rc= _string_check(string, length +1))) + { + return rc; + } + + memcpy(string->end, value, length); + string->end+= length; + *string->end= 0; // Add a NULL + + return GEARMAN_SUCCESS; +} + +char *gearman_string_c_copy(gearman_vector_st *string) +{ + char *c_ptr; + + if (gearman_string_length(string) == 0) + return NULL; + + c_ptr= static_cast(malloc((gearman_string_length(string) +1) * sizeof(char))); + + if (not c_ptr) + return NULL; + + memcpy(c_ptr, gearman_string_value(string), gearman_string_length(string)); + c_ptr[gearman_string_length(string)]= 0; + + return c_ptr; +} + +void gearman_string_reset(gearman_vector_st *string) +{ + assert(string); + string->end= string->string; +} + +void gearman_string_free(gearman_vector_st *ptr) +{ + if (not ptr) + return; + + if (ptr->string) + { + free(ptr->string); + } + + if (ptr->options.is_allocated) + { + free(ptr); + } +} + +gearman_return_t gearman_string_check(gearman_vector_st *string, size_t need) +{ + return _string_check(string, need); +} + +size_t gearman_string_length(const gearman_vector_st *self) +{ + if (not self) + return 0; + + return size_t(self->end - self->string); +} + +const char *gearman_string_value(const gearman_vector_st *self) +{ + if (not self) + return NULL; + + return self->string; +} + +gearman_string_t gearman_string(const gearman_vector_st *self) +{ + assert(self); + gearman_string_t passable= { gearman_string_value(self), gearman_string_length(self) }; + return passable; +} + +gearman_string_t gearman_string_take_string(gearman_vector_st *self) +{ + assert(self); + gearman_string_t passable= gearman_string(self); + _init_string(self); + + return passable; +} diff -Nru gearmand-0.14/libgearman/vector.hpp gearmand-0.23/libgearman/vector.hpp --- gearmand-0.14/libgearman/vector.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/vector.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,105 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libgearman library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/** + vectors are always under our control so we make some assumptions about them. + + 1) is_initialized is always valid. + 2) A string once intialized will always be, until free where we + unset this flag. +*/ +struct gearman_vector_st { + char *end; + char *string; + size_t current_size; + struct { + bool is_allocated:1; + } options; +}; + +GEARMAN_LOCAL +gearman_vector_st *gearman_string_create(gearman_vector_st *string, + size_t initial_size); + +GEARMAN_LOCAL +gearman_vector_st *gearman_string_create(gearman_vector_st *self, const char *str, size_t initial_size); + +#ifdef __cplusplus +extern "C" { +#endif + + +GEARMAN_LOCAL +gearman_vector_st *gearman_string_clone(const gearman_vector_st *); + +GEARMAN_LOCAL +gearman_return_t gearman_string_check(gearman_vector_st *string, size_t need); + +GEARMAN_LOCAL +char *gearman_string_c_copy(gearman_vector_st *string); + +GEARMAN_LOCAL +gearman_return_t gearman_string_append_character(gearman_vector_st *string, + char character); +GEARMAN_LOCAL +gearman_return_t gearman_string_append(gearman_vector_st *string, + const char *value, size_t length); +GEARMAN_LOCAL +void gearman_string_reset(gearman_vector_st *string); + +GEARMAN_LOCAL +void gearman_string_free(gearman_vector_st *string); + +GEARMAN_LOCAL +size_t gearman_string_length(const gearman_vector_st *self); + +GEARMAN_LOCAL +const char *gearman_string_value(const gearman_vector_st *self); + +GEARMAN_LOCAL +char *gearman_string_value_mutable(const gearman_vector_st *self); + +GEARMAN_LOCAL +gearman_string_t gearman_string(const gearman_vector_st *self); + +GEARMAN_LOCAL +gearman_string_t gearman_string_take_string(gearman_vector_st *self); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman/version.h gearmand-0.23/libgearman/version.h --- gearmand-0.14/libgearman/version.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/version.h 2011-06-29 23:00:13.000000000 +0200 @@ -0,0 +1,42 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#pragma once + +#define LIBGEARMAN_VERSION_STRING "0.23" +#define LIBGEARMAN_VERSION_HEX 0x00023000 diff -Nru gearmand-0.14/libgearman/version.h.in gearmand-0.23/libgearman/version.h.in --- gearmand-0.14/libgearman/version.h.in 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/version.h.in 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,42 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#pragma once + +#define LIBGEARMAN_VERSION_STRING "@VERSION@" +#define LIBGEARMAN_VERSION_HEX @PANDORA_HEX_VERSION@ diff -Nru gearmand-0.14/libgearman/worker.c gearmand-0.23/libgearman/worker.c --- gearmand-0.14/libgearman/worker.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1098 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Worker Definitions - */ - -#include "common.h" - -/** - Private structure. -*/ -struct _worker_function_st -{ - struct { - bool packet_in_use:1; - bool change:1; - bool remove:1; - } options; - struct _worker_function_st *next; - struct _worker_function_st *prev; - char *function_name; - size_t function_length; - gearman_worker_fn *worker_fn; - void *context; - gearman_packet_st packet; -}; - -/** - * @addtogroup gearman_worker_static Static Worker Declarations - * @ingroup gearman_worker - * @{ - */ - -static inline struct _worker_function_st *_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length) -{ - struct _worker_function_st *function; - - for (function= worker->function_list; function != NULL; - function= function->next) - { - if (function_length == function->function_length) - { - if (! memcmp(function_name, function->function_name, function_length)) - break; - } - } - - return function; -} - -/** - * Allocate a worker structure. - */ -static gearman_worker_st *_worker_allocate(gearman_worker_st *worker, bool is_clone); - -/** - * Initialize common packets for later use. - */ -static gearman_return_t _worker_packet_init(gearman_worker_st *worker); - -/** - * Callback function used when parsing server lists. - */ -static gearman_return_t _worker_add_server(const char *host, in_port_t port, - void *context); - -/** - * Allocate and add a function to the register list. - */ -static gearman_return_t _worker_function_create(gearman_worker_st *worker, - const char *function_name, - size_t function_length, - uint32_t timeout, - gearman_worker_fn *worker_fn, - void *context); - -/** - * Free a function. - */ -static void _worker_function_free(gearman_worker_st *worker, - struct _worker_function_st *function); - - -/** @} */ - -/* - * Public Definitions - */ - -gearman_worker_st *gearman_worker_create(gearman_worker_st *worker) -{ - worker= _worker_allocate(worker, false); - - if (worker == NULL) - return NULL; - - if (_worker_packet_init(worker) != GEARMAN_SUCCESS) - { - gearman_worker_free(worker); - return NULL; - } - - return worker; -} - -gearman_worker_st *gearman_worker_clone(gearman_worker_st *worker, - const gearman_worker_st *from) -{ - gearman_universal_st *check; - - if (! from) - { - return _worker_allocate(worker, false); - } - - worker= _worker_allocate(worker, true); - - if (worker == NULL) - { - return worker; - } - - worker->options.non_blocking= from->options.non_blocking; - worker->options.grab_job_in_use= from->options.grab_job_in_use; - worker->options.pre_sleep_in_use= from->options.pre_sleep_in_use; - worker->options.work_job_in_use= from->options.work_job_in_use; - worker->options.change= from->options.change; - worker->options.grab_uniq= from->options.grab_uniq; - worker->options.timeout_return= from->options.timeout_return; - - check= gearman_universal_clone(&(worker->universal), &from->universal); - if (check == NULL) - { - gearman_worker_free(worker); - return NULL; - } - - if (_worker_packet_init(worker) != GEARMAN_SUCCESS) - { - gearman_worker_free(worker); - return NULL; - } - - return worker; -} - -void gearman_worker_free(gearman_worker_st *worker) -{ - if (worker->options.packet_init) - { - gearman_packet_free(&(worker->grab_job)); - gearman_packet_free(&(worker->pre_sleep)); - } - - if (worker->job != NULL) - gearman_job_free(worker->job); - - if (worker->options.work_job_in_use) - gearman_job_free(&(worker->work_job)); - - if (worker->work_result != NULL) - { - if ((&worker->universal)->workload_free_fn == NULL) - free(worker->work_result); - else - { - (&worker->universal)->workload_free_fn(worker->work_result, - (void *)(&worker->universal)->workload_free_context); - } - } - - while (worker->function_list != NULL) - _worker_function_free(worker, worker->function_list); - - gearman_job_free_all(worker); - - if ((&worker->universal) != NULL) - gearman_universal_free((&worker->universal)); - - if (worker->options.allocated) - free(worker); -} - -const char *gearman_worker_error(gearman_worker_st *worker) -{ - return gearman_universal_error((&worker->universal)); -} - -int gearman_worker_errno(gearman_worker_st *worker) -{ - return gearman_universal_errno((&worker->universal)); -} - -gearman_worker_options_t gearman_worker_options(const gearman_worker_st *worker) -{ - gearman_worker_options_t options; - memset(&options, 0, sizeof(gearman_worker_options_t)); - - if (worker->options.allocated) - options|= GEARMAN_WORKER_ALLOCATED; - if (worker->options.non_blocking) - options|= GEARMAN_WORKER_NON_BLOCKING; - if (worker->options.packet_init) - options|= GEARMAN_WORKER_PACKET_INIT; - if (worker->options.grab_job_in_use) - options|= GEARMAN_WORKER_GRAB_JOB_IN_USE; - if (worker->options.pre_sleep_in_use) - options|= GEARMAN_WORKER_PRE_SLEEP_IN_USE; - if (worker->options.work_job_in_use) - options|= GEARMAN_WORKER_WORK_JOB_IN_USE; - if (worker->options.change) - options|= GEARMAN_WORKER_CHANGE; - if (worker->options.grab_uniq) - options|= GEARMAN_WORKER_GRAB_UNIQ; - if (worker->options.timeout_return) - options|= GEARMAN_WORKER_TIMEOUT_RETURN; - - return options; -} - -void gearman_worker_set_options(gearman_worker_st *worker, - gearman_worker_options_t options) -{ - gearman_worker_options_t usable_options[]= { - GEARMAN_WORKER_NON_BLOCKING, - GEARMAN_WORKER_GRAB_UNIQ, - GEARMAN_WORKER_TIMEOUT_RETURN, - GEARMAN_WORKER_MAX - }; - - gearman_worker_options_t *ptr; - - - for (ptr= usable_options; *ptr != GEARMAN_WORKER_MAX ; ptr++) - { - if (options & *ptr) - { - gearman_worker_add_options(worker, *ptr); - } - else - { - gearman_worker_remove_options(worker, *ptr); - } - } -} - -void gearman_worker_add_options(gearman_worker_st *worker, - gearman_worker_options_t options) -{ - if (options & GEARMAN_WORKER_NON_BLOCKING) - { - gearman_universal_add_options((&worker->universal), GEARMAN_NON_BLOCKING); - worker->options.non_blocking= true; - } - - if (options & GEARMAN_WORKER_GRAB_UNIQ) - { - worker->grab_job.command= GEARMAN_COMMAND_GRAB_JOB_UNIQ; - (void)gearman_packet_pack_header(&(worker->grab_job)); - worker->options.grab_uniq= true; - } - - if (options & GEARMAN_WORKER_TIMEOUT_RETURN) - { - worker->options.timeout_return= true; - } -} - -void gearman_worker_remove_options(gearman_worker_st *worker, - gearman_worker_options_t options) -{ - if (options & GEARMAN_WORKER_NON_BLOCKING) - { - gearman_universal_remove_options((&worker->universal), GEARMAN_NON_BLOCKING); - worker->options.non_blocking= false; - } - - if (options & GEARMAN_WORKER_TIMEOUT_RETURN) - { - worker->options.timeout_return= false; - } - - if (options & GEARMAN_WORKER_GRAB_UNIQ) - { - worker->grab_job.command= GEARMAN_COMMAND_GRAB_JOB; - (void)gearman_packet_pack_header(&(worker->grab_job)); - worker->options.grab_uniq= false; - } -} - -int gearman_worker_timeout(gearman_worker_st *worker) -{ - return gearman_universal_timeout((&worker->universal)); -} - -void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout) -{ - gearman_worker_add_options(worker, GEARMAN_WORKER_TIMEOUT_RETURN); - gearman_universal_set_timeout((&worker->universal), timeout); -} - -void *gearman_worker_context(const gearman_worker_st *worker) -{ - return worker->context; -} - -void gearman_worker_set_context(gearman_worker_st *worker, void *context) -{ - worker->context= context; -} - -void gearman_worker_set_log_fn(gearman_worker_st *worker, - gearman_log_fn *function, void *context, - gearman_verbose_t verbose) -{ - gearman_set_log_fn((&worker->universal), function, context, verbose); -} - -void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, - gearman_malloc_fn *function, - void *context) -{ - gearman_set_workload_malloc_fn((&worker->universal), function, context); -} - -void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, - gearman_free_fn *function, - void *context) -{ - gearman_set_workload_free_fn((&worker->universal), function, context); -} - -gearman_return_t gearman_worker_add_server(gearman_worker_st *worker, - const char *host, in_port_t port) -{ - if (gearman_connection_create_args((&worker->universal), NULL, host, port) == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_worker_add_servers(gearman_worker_st *worker, - const char *servers) -{ - return gearman_parse_servers(servers, _worker_add_server, worker); -} - -void gearman_worker_remove_servers(gearman_worker_st *worker) -{ - gearman_free_all_cons((&worker->universal)); -} - -gearman_return_t gearman_worker_wait(gearman_worker_st *worker) -{ - return gearman_wait((&worker->universal)); -} - -gearman_return_t gearman_worker_register(gearman_worker_st *worker, - const char *function_name, - uint32_t timeout) -{ - return _worker_function_create(worker, function_name, strlen(function_name), timeout, NULL, NULL); -} - -bool gearman_worker_function_exist(gearman_worker_st *worker, - const char *function_name, - size_t function_length) -{ - struct _worker_function_st *function; - - function= _function_exist(worker, function_name, function_length); - - return (function && function->options.remove == false) ? true : false; -} - -static inline gearman_return_t _worker_unregister(gearman_worker_st *worker, - const char *function_name, size_t function_length) -{ - struct _worker_function_st *function; - gearman_return_t ret; - const void *args[1]; - size_t args_size[1]; - - function= _function_exist(worker, function_name, function_length); - - if (function == NULL || function->options.remove) - return GEARMAN_NO_REGISTERED_FUNCTION; - - gearman_packet_free(&(function->packet)); - - args[0]= function->function_name; - args_size[0]= function->function_length; - ret= gearman_packet_create_args((&worker->universal), &(function->packet), - GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CANT_DO, - args, args_size, 1); - if (ret != GEARMAN_SUCCESS) - { - function->options.packet_in_use= false; - return ret; - } - - function->options.change= true; - function->options.remove= true; - - worker->options.change= true; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, - const char *function_name) -{ - return _worker_unregister(worker, function_name, strlen(function_name)); -} - -gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker) -{ - gearman_return_t ret; - struct _worker_function_st *function; - uint32_t count= 0; - - if (worker->function_list == NULL) - return GEARMAN_NO_REGISTERED_FUNCTIONS; - - - /* Lets find out if we have any functions left that are valid */ - for (function= worker->function_list; function != NULL; - function= function->next) - { - if (function->options.remove == false) - count++; - } - - if (count == 0) - return GEARMAN_NO_REGISTERED_FUNCTIONS; - - gearman_packet_free(&(worker->function_list->packet)); - - ret= gearman_packet_create_args((&worker->universal), - &(worker->function_list->packet), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_RESET_ABILITIES, - NULL, NULL, 0); - if (ret != GEARMAN_SUCCESS) - { - worker->function_list->options.packet_in_use= false; - - return ret; - } - - while (worker->function_list->next != NULL) - _worker_function_free(worker, worker->function_list->next); - - worker->function_list->options.change= true; - worker->function_list->options.remove= true; - - worker->options.change= true; - - return GEARMAN_SUCCESS; -} - -gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, - gearman_job_st *job, - gearman_return_t *ret_ptr) -{ - struct _worker_function_st *function; - uint32_t active; - - while (1) - { - switch (worker->state) - { - case GEARMAN_WORKER_STATE_START: - /* If there are any new functions changes, send them now. */ - if (worker->options.change) - { - worker->function= worker->function_list; - while (worker->function != NULL) - { - if (! (worker->function->options.change)) - { - worker->function= worker->function->next; - continue; - } - - for (worker->con= (&worker->universal)->con_list; worker->con != NULL; - worker->con= worker->con->next) - { - if (worker->con->fd == -1) - continue; - - case GEARMAN_WORKER_STATE_FUNCTION_SEND: - *ret_ptr= gearman_connection_send(worker->con, &(worker->function->packet), - true); - if (*ret_ptr != GEARMAN_SUCCESS) - { - if (*ret_ptr == GEARMAN_IO_WAIT) - worker->state= GEARMAN_WORKER_STATE_FUNCTION_SEND; - else if (*ret_ptr == GEARMAN_LOST_CONNECTION) - continue; - - return NULL; - } - } - - if (worker->function->options.remove) - { - function= worker->function->prev; - _worker_function_free(worker, worker->function); - if (function == NULL) - worker->function= worker->function_list; - else - worker->function= function; - } - else - { - worker->function->options.change= false; - worker->function= worker->function->next; - } - } - - worker->options.change= false; - } - - if (worker->function_list == NULL) - { - gearman_universal_set_error((&worker->universal), "gearman_worker_grab_job", - "no functions have been registered"); - *ret_ptr= GEARMAN_NO_REGISTERED_FUNCTIONS; - return NULL; - } - - for (worker->con= (&worker->universal)->con_list; worker->con != NULL; - worker->con= worker->con->next) - { - /* If the connection to the job server is not active, start it. */ - if (worker->con->fd == -1) - { - for (worker->function= worker->function_list; - worker->function != NULL; - worker->function= worker->function->next) - { - case GEARMAN_WORKER_STATE_CONNECT: - *ret_ptr= gearman_connection_send(worker->con, &(worker->function->packet), - true); - if (*ret_ptr != GEARMAN_SUCCESS) - { - if (*ret_ptr == GEARMAN_IO_WAIT) - worker->state= GEARMAN_WORKER_STATE_CONNECT; - else if (*ret_ptr == GEARMAN_COULD_NOT_CONNECT || - *ret_ptr == GEARMAN_LOST_CONNECTION) - { - break; - } - - return NULL; - } - } - - if (*ret_ptr == GEARMAN_COULD_NOT_CONNECT) - continue; - } - - case GEARMAN_WORKER_STATE_GRAB_JOB_SEND: - if (worker->con->fd == -1) - continue; - - *ret_ptr= gearman_connection_send(worker->con, &(worker->grab_job), true); - if (*ret_ptr != GEARMAN_SUCCESS) - { - if (*ret_ptr == GEARMAN_IO_WAIT) - worker->state= GEARMAN_WORKER_STATE_GRAB_JOB_SEND; - else if (*ret_ptr == GEARMAN_LOST_CONNECTION) - continue; - - return NULL; - } - - if (worker->job == NULL) - { - worker->job= gearman_job_create(worker, job); - if (worker->job == NULL) - { - *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - } - - while (1) - { - case GEARMAN_WORKER_STATE_GRAB_JOB_RECV: - (void)gearman_connection_recv(worker->con, &(worker->job->assigned), ret_ptr, - true); - if (*ret_ptr != GEARMAN_SUCCESS) - { - if (*ret_ptr == GEARMAN_IO_WAIT) - worker->state= GEARMAN_WORKER_STATE_GRAB_JOB_RECV; - else - { - gearman_job_free(worker->job); - worker->job= NULL; - - if (*ret_ptr == GEARMAN_LOST_CONNECTION) - break; - } - - return NULL; - } - - if (worker->job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN || - worker->job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_UNIQ) - { - worker->job->options.assigned_in_use= true; - worker->job->con= worker->con; - worker->state= GEARMAN_WORKER_STATE_GRAB_JOB_SEND; - job= worker->job; - worker->job= NULL; - return job; - } - - if (worker->job->assigned.command == GEARMAN_COMMAND_NO_JOB) - { - gearman_packet_free(&(worker->job->assigned)); - break; - } - - if (worker->job->assigned.command != GEARMAN_COMMAND_NOOP) - { - gearman_universal_set_error((&worker->universal), "gearman_worker_grab_job", - "unexpected packet:%s", - gearman_command_info_list[worker->job->assigned.command].name); - gearman_packet_free(&(worker->job->assigned)); - gearman_job_free(worker->job); - worker->job= NULL; - *ret_ptr= GEARMAN_UNEXPECTED_PACKET; - return NULL; - } - - gearman_packet_free(&(worker->job->assigned)); - } - } - - case GEARMAN_WORKER_STATE_PRE_SLEEP: - for (worker->con= (&worker->universal)->con_list; worker->con != NULL; - worker->con= worker->con->next) - { - if (worker->con->fd == -1) - continue; - - *ret_ptr= gearman_connection_send(worker->con, &(worker->pre_sleep), true); - if (*ret_ptr != GEARMAN_SUCCESS) - { - if (*ret_ptr == GEARMAN_IO_WAIT) - worker->state= GEARMAN_WORKER_STATE_PRE_SLEEP; - else if (*ret_ptr == GEARMAN_LOST_CONNECTION) - continue; - - return NULL; - } - } - - worker->state= GEARMAN_WORKER_STATE_START; - - /* Set a watch on all active connections that we sent a PRE_SLEEP to. */ - active= 0; - for (worker->con= (&worker->universal)->con_list; worker->con != NULL; - worker->con= worker->con->next) - { - if (worker->con->fd == -1) - continue; - - *ret_ptr= gearman_connection_set_events(worker->con, POLLIN); - if (*ret_ptr != GEARMAN_SUCCESS) - return NULL; - - active++; - } - - if ((&worker->universal)->options.non_blocking) - { - *ret_ptr= GEARMAN_NO_JOBS; - return NULL; - } - - if (active == 0) - { - if ((&worker->universal)->timeout < 0) - usleep(GEARMAN_WORKER_WAIT_TIMEOUT * 1000); - else - { - if ((&worker->universal)->timeout > 0) - usleep((unsigned int)(&worker->universal)->timeout * 1000); - - if (worker->options.timeout_return) - { - gearman_universal_set_error((&worker->universal), "gearman_worker_grab_job", - "timeout reached"); - *ret_ptr= GEARMAN_TIMEOUT; - return NULL; - } - } - } - else - { - *ret_ptr= gearman_wait((&worker->universal)); - if (*ret_ptr != GEARMAN_SUCCESS && (*ret_ptr != GEARMAN_TIMEOUT || - worker->options.timeout_return)) - { - return NULL; - } - } - - break; - - default: - gearman_universal_set_error((&worker->universal), "gearman_worker_grab_job", - "unknown state: %u", worker->state); - *ret_ptr= GEARMAN_UNKNOWN_STATE; - return NULL; - } - } -} - -void gearman_job_free(gearman_job_st *job) -{ - if (job->options.assigned_in_use) - gearman_packet_free(&(job->assigned)); - - if (job->options.work_in_use) - gearman_packet_free(&(job->work)); - - if (job->worker->job_list == job) - job->worker->job_list= job->next; - if (job->prev != NULL) - job->prev->next= job->next; - if (job->next != NULL) - job->next->prev= job->prev; - job->worker->job_count--; - - if (job->options.allocated) - free(job); -} - -void gearman_job_free_all(gearman_worker_st *worker) -{ - while (worker->job_list != NULL) - gearman_job_free(worker->job_list); -} - -gearman_return_t gearman_worker_add_function(gearman_worker_st *worker, - const char *function_name, - uint32_t timeout, - gearman_worker_fn *worker_fn, - void *context) -{ - if (function_name == NULL) - { - gearman_universal_set_error((&worker->universal), "gearman_worker_add_function", - "function name not given"); - - return GEARMAN_INVALID_FUNCTION_NAME; - } - - if (worker_fn == NULL) - { - gearman_universal_set_error((&worker->universal), "gearman_worker_add_function", - "function not given"); - - return GEARMAN_INVALID_WORKER_FUNCTION; - } - - return _worker_function_create(worker, function_name, strlen(function_name), - timeout, worker_fn, - context); -} - -gearman_return_t gearman_worker_work(gearman_worker_st *worker) -{ - gearman_job_st *check; - gearman_return_t ret; - - switch (worker->work_state) - { - case GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB: - check= gearman_worker_grab_job(worker, &(worker->work_job), &ret); - (void)check; // @todo test this good values - - if (ret != GEARMAN_SUCCESS) - return ret; - - for (worker->work_function= worker->function_list; - worker->work_function != NULL; - worker->work_function= worker->work_function->next) - { - if (!strcmp(gearman_job_function_name(&(worker->work_job)), - worker->work_function->function_name)) - { - break; - } - } - - if (worker->work_function == NULL) - { - gearman_job_free(&(worker->work_job)); - gearman_universal_set_error((&worker->universal), "gearman_worker_work", - "function not found"); - return GEARMAN_INVALID_FUNCTION_NAME; - } - - if (worker->work_function->worker_fn == NULL) - { - gearman_job_free(&(worker->work_job)); - gearman_universal_set_error((&worker->universal), "gearman_worker_work", - "no callback function supplied"); - return GEARMAN_INVALID_FUNCTION_NAME; - } - - worker->options.work_job_in_use= true; - worker->work_result_size= 0; - - case GEARMAN_WORKER_WORK_UNIVERSAL_FUNCTION: - worker->work_result= worker->work_function->worker_fn(&(worker->work_job), - (void *)worker->work_function->context, - &(worker->work_result_size), &ret); - if (ret == GEARMAN_WORK_FAIL) - { - ret= gearman_job_send_fail(&(worker->work_job)); - if (ret != GEARMAN_SUCCESS) - { - if (ret == GEARMAN_LOST_CONNECTION) - break; - - worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_FAIL; - return ret; - } - - break; - } - - if (ret != GEARMAN_SUCCESS) - { - if (ret == GEARMAN_LOST_CONNECTION) - break; - - worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_FUNCTION; - return ret; - } - - case GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE: - ret= gearman_job_send_complete(&(worker->work_job), worker->work_result, - worker->work_result_size); - if (ret == GEARMAN_IO_WAIT) - { - worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE; - return ret; - } - - if (worker->work_result != NULL) - { - if ((&worker->universal)->workload_free_fn == NULL) - free(worker->work_result); - else - { - (&worker->universal)->workload_free_fn(worker->work_result, - (&worker->universal)->workload_free_context); - } - worker->work_result= NULL; - } - - if (ret != GEARMAN_SUCCESS) - { - if (ret == GEARMAN_LOST_CONNECTION) - break; - - return ret; - } - - break; - - case GEARMAN_WORKER_WORK_UNIVERSAL_FAIL: - ret= gearman_job_send_fail(&(worker->work_job)); - if (ret != GEARMAN_SUCCESS) - { - if (ret == GEARMAN_LOST_CONNECTION) - break; - - return ret; - } - - break; - - default: - gearman_universal_set_error((&worker->universal), "gearman_worker_work", - "unknown state: %u", worker->work_state); - return GEARMAN_UNKNOWN_STATE; - } - - gearman_job_free(&(worker->work_job)); - worker->options.work_job_in_use= false; - worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_worker_echo(gearman_worker_st *worker, - const void *workload, - size_t workload_size) -{ - return gearman_echo((&worker->universal), workload, workload_size); -} - -/* - * Static Definitions - */ - -static gearman_worker_st *_worker_allocate(gearman_worker_st *worker, bool is_clone) -{ - if (worker == NULL) - { - worker= malloc(sizeof(gearman_worker_st)); - if (worker == NULL) - return NULL; - - worker->options.allocated= true; - } - else - { - worker->options.allocated= false; - } - - worker->options.non_blocking= false; - worker->options.packet_init= false; - worker->options.grab_job_in_use= false; - worker->options.pre_sleep_in_use= false; - worker->options.work_job_in_use= false; - worker->options.change= false; - worker->options.grab_uniq= false; - worker->options.timeout_return= false; - - worker->state= 0; - worker->work_state= 0; - worker->function_count= 0; - worker->job_count= 0; - worker->work_result_size= 0; - worker->con= NULL; - worker->job= NULL; - worker->job_list= NULL; - worker->function= NULL; - worker->function_list= NULL; - worker->work_function= NULL; - worker->work_result= NULL; - - if (! is_clone) - { - gearman_universal_st *check; - - check= gearman_universal_create(&worker->universal, NULL); - if (check == NULL) - { - gearman_worker_free(worker); - return NULL; - } - - gearman_universal_set_timeout((&worker->universal), GEARMAN_WORKER_WAIT_TIMEOUT); - } - - return worker; -} - -static gearman_return_t _worker_packet_init(gearman_worker_st *worker) -{ - gearman_return_t ret; - - ret= gearman_packet_create_args((&worker->universal), &(worker->grab_job), - GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_GRAB_JOB, - NULL, NULL, 0); - if (ret != GEARMAN_SUCCESS) - return ret; - - ret= gearman_packet_create_args((&worker->universal), &(worker->pre_sleep), - GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_PRE_SLEEP, - NULL, NULL, 0); - if (ret != GEARMAN_SUCCESS) - { - gearman_packet_free(&(worker->grab_job)); - return ret; - } - - worker->options.packet_init= true; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _worker_add_server(const char *host, in_port_t port, - void *context) -{ - return gearman_worker_add_server((gearman_worker_st *)context, host, port); -} - -static gearman_return_t _worker_function_create(gearman_worker_st *worker, - const char *function_name, - size_t function_length, - uint32_t timeout, - gearman_worker_fn *worker_fn, - void *context) -{ - struct _worker_function_st *function; - gearman_return_t ret; - char timeout_buffer[11]; - const void *args[2]; - size_t args_size[2]; - - function= malloc(sizeof(struct _worker_function_st)); - if (function == NULL) - { - gearman_universal_set_error((&worker->universal), "_worker_function_create", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - function->options.packet_in_use= true; - function->options.change= true; - function->options.remove= false; - - function->function_name= strdup(function_name); - function->function_length= function_length; - if (function->function_name == NULL) - { - free(function); - gearman_universal_set_error((&worker->universal), "gearman_worker_add_function", "strdup"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - function->worker_fn= worker_fn; - function->context= context; - - if (timeout > 0) - { - snprintf(timeout_buffer, 11, "%u", timeout); - args[0]= function_name; - args_size[0]= strlen(function_name) + 1; - args[1]= timeout_buffer; - args_size[1]= strlen(timeout_buffer); - ret= gearman_packet_create_args((&worker->universal), &(function->packet), - GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CAN_DO_TIMEOUT, - args, args_size, 2); - } - else - { - args[0]= function->function_name; - args_size[0]= function->function_length= function_length; - ret= gearman_packet_create_args((&worker->universal), &(function->packet), - GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CAN_DO, - args, args_size, 1); - } - if (ret != GEARMAN_SUCCESS) - { - free(function->function_name); - free(function); - return ret; - } - - if (worker->function_list != NULL) - worker->function_list->prev= function; - function->next= worker->function_list; - function->prev= NULL; - worker->function_list= function; - worker->function_count++; - - worker->options.change= true; - - return GEARMAN_SUCCESS; -} - -static void _worker_function_free(gearman_worker_st *worker, - struct _worker_function_st *function) -{ - if (worker->function_list == function) - worker->function_list= function->next; - if (function->prev != NULL) - function->prev->next= function->next; - if (function->next != NULL) - function->next->prev= function->prev; - worker->function_count--; - - if (function->options.packet_in_use) - gearman_packet_free(&(function->packet)); - - free(function->function_name); - free(function); -} diff -Nru gearmand-0.14/libgearman/worker.cc gearmand-0.23/libgearman/worker.cc --- gearmand-0.14/libgearman/worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman/worker.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,1195 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/** + * @addtogroup gearman_worker_static Static Worker Declarations + * @ingroup gearman_worker + * @{ + */ + +static inline struct _worker_function_st *_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length) +{ + struct _worker_function_st *function; + + for (function= worker->function_list; function; + function= function->next) + { + if (function_length == function->function_length) + { + if (not memcmp(function_name, function->function_name, function_length)) + break; + } + } + + return function; +} + +/** + * Allocate a worker structure. + */ +static gearman_worker_st *_worker_allocate(gearman_worker_st *worker, bool is_clone); + +/** + * Initialize common packets for later use. + */ +static gearman_return_t _worker_packet_init(gearman_worker_st *worker); + +/** + * Callback function used when parsing server lists. + */ +static gearman_return_t _worker_add_server(const char *host, in_port_t port, void *context); + +/** + * Allocate and add a function to the register list. + */ +static gearman_return_t _worker_function_create(gearman_worker_st *worker, + const char *function_name, size_t function_length, + const gearman_function_t &function, + uint32_t timeout, + void *context); + +/** + * Free a function. + */ +static void _worker_function_free(gearman_worker_st *worker, + struct _worker_function_st *function); + + +/** @} */ + +/* + * Public Definitions + */ + +gearman_worker_st *gearman_worker_create(gearman_worker_st *worker) +{ + worker= _worker_allocate(worker, false); + + if (not worker) + return NULL; + + if (gearman_failed(_worker_packet_init(worker))) + { + gearman_worker_free(worker); + return NULL; + } + + return worker; +} + +gearman_worker_st *gearman_worker_clone(gearman_worker_st *worker, + const gearman_worker_st *from) +{ + if (not from) + { + return _worker_allocate(worker, false); + } + + worker= _worker_allocate(worker, true); + + if (not worker) + return worker; + + worker->options.non_blocking= from->options.non_blocking; + worker->options.change= from->options.change; + worker->options.grab_uniq= from->options.grab_uniq; + worker->options.grab_all= from->options.grab_all; + worker->options.timeout_return= from->options.timeout_return; + + gearman_universal_clone(worker->universal, from->universal); + + if (gearman_failed(_worker_packet_init(worker))) + { + gearman_worker_free(worker); + return NULL; + } + + return worker; +} + +void gearman_worker_free(gearman_worker_st *worker) +{ + if (not worker) + return; + + gearman_worker_unregister_all(worker); + + if (worker->options.packet_init) + { + gearman_packet_free(&worker->grab_job); + gearman_packet_free(&worker->pre_sleep); + } + + gearman_job_free(worker->job); + worker->work_job= NULL; + + if (worker->work_result) + { + gearman_free(worker->universal, worker->work_result); + } + + while (worker->function_list) + { + _worker_function_free(worker, worker->function_list); + } + + gearman_job_free_all(worker); + + gearman_universal_free(worker->universal); + + if (worker->options.allocated) + delete worker; +} + +const char *gearman_worker_error(const gearman_worker_st *worker) +{ + if (not worker) + return NULL; + + return gearman_universal_error(worker->universal); +} + +int gearman_worker_errno(gearman_worker_st *worker) +{ + if (not worker) + return 0; + + return gearman_universal_errno(worker->universal); +} + +gearman_worker_options_t gearman_worker_options(const gearman_worker_st *worker) +{ + if (not worker) + return gearman_worker_options_t(); + + int options; + memset(&options, 0, sizeof(gearman_worker_options_t)); + + if (worker->options.allocated) + options|= int(GEARMAN_WORKER_ALLOCATED); + if (worker->options.non_blocking) + options|= int(GEARMAN_WORKER_NON_BLOCKING); + if (worker->options.packet_init) + options|= int(GEARMAN_WORKER_PACKET_INIT); + if (worker->options.change) + options|= int(GEARMAN_WORKER_CHANGE); + if (worker->options.grab_uniq) + options|= int(GEARMAN_WORKER_GRAB_UNIQ); + if (worker->options.grab_all) + options|= int(GEARMAN_WORKER_GRAB_ALL); + if (worker->options.timeout_return) + options|= int(GEARMAN_WORKER_TIMEOUT_RETURN); + + return gearman_worker_options_t(options); +} + +void gearman_worker_set_options(gearman_worker_st *worker, + gearman_worker_options_t options) +{ + if (not worker) + return; + + gearman_worker_options_t usable_options[]= { + GEARMAN_WORKER_NON_BLOCKING, + GEARMAN_WORKER_GRAB_UNIQ, + GEARMAN_WORKER_GRAB_ALL, + GEARMAN_WORKER_TIMEOUT_RETURN, + GEARMAN_WORKER_MAX + }; + + gearman_worker_options_t *ptr; + + + for (ptr= usable_options; *ptr != GEARMAN_WORKER_MAX ; ptr++) + { + if (options & *ptr) + { + gearman_worker_add_options(worker, *ptr); + } + else + { + gearman_worker_remove_options(worker, *ptr); + } + } +} + +void gearman_worker_add_options(gearman_worker_st *worker, + gearman_worker_options_t options) +{ + if (not worker) + return; + + if (options & GEARMAN_WORKER_NON_BLOCKING) + { + gearman_universal_add_options(worker->universal, GEARMAN_NON_BLOCKING); + worker->options.non_blocking= true; + } + + if (options & GEARMAN_WORKER_GRAB_UNIQ) + { + worker->grab_job.command= GEARMAN_COMMAND_GRAB_JOB_UNIQ; + gearman_return_t rc= gearman_packet_pack_header(&(worker->grab_job)); + assert(gearman_success(rc)); + worker->options.grab_uniq= true; + } + + if (options & GEARMAN_WORKER_GRAB_ALL) + { + worker->grab_job.command= GEARMAN_COMMAND_GRAB_JOB_ALL; + gearman_return_t rc= gearman_packet_pack_header(&(worker->grab_job)); + assert(gearman_success(rc)); + worker->options.grab_all= true; + } + + if (options & GEARMAN_WORKER_TIMEOUT_RETURN) + { + worker->options.timeout_return= true; + } +} + +void gearman_worker_remove_options(gearman_worker_st *worker, + gearman_worker_options_t options) +{ + if (not worker) + return; + + if (options & GEARMAN_WORKER_NON_BLOCKING) + { + gearman_universal_remove_options(worker->universal, GEARMAN_NON_BLOCKING); + worker->options.non_blocking= false; + } + + if (options & GEARMAN_WORKER_TIMEOUT_RETURN) + { + worker->options.timeout_return= false; + gearman_universal_set_timeout(worker->universal, GEARMAN_WORKER_WAIT_TIMEOUT); + } + + if (options & GEARMAN_WORKER_GRAB_UNIQ) + { + worker->grab_job.command= GEARMAN_COMMAND_GRAB_JOB; + (void)gearman_packet_pack_header(&(worker->grab_job)); + worker->options.grab_uniq= false; + } + + if (options & GEARMAN_WORKER_GRAB_ALL) + { + worker->grab_job.command= GEARMAN_COMMAND_GRAB_JOB; + (void)gearman_packet_pack_header(&(worker->grab_job)); + worker->options.grab_all= false; + } +} + +int gearman_worker_timeout(gearman_worker_st *worker) +{ + if (not worker) + return 0; + + return gearman_universal_timeout(worker->universal); +} + +void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout) +{ + if (not worker) + return; + + gearman_worker_add_options(worker, GEARMAN_WORKER_TIMEOUT_RETURN); + gearman_universal_set_timeout(worker->universal, timeout); +} + +void *gearman_worker_context(const gearman_worker_st *worker) +{ + if (not worker) + return NULL; + + return worker->context; +} + +void gearman_worker_set_context(gearman_worker_st *worker, void *context) +{ + if (not worker) + return; + + worker->context= context; +} + +void gearman_worker_set_log_fn(gearman_worker_st *worker, + gearman_log_fn *function, void *context, + gearman_verbose_t verbose) +{ + gearman_set_log_fn(worker->universal, function, context, verbose); +} + +void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, + gearman_malloc_fn *function, + void *context) +{ + if (not worker) + return; + + gearman_set_workload_malloc_fn(worker->universal, function, context); +} + +void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, + gearman_free_fn *function, + void *context) +{ + if (not worker) + return; + + gearman_set_workload_free_fn(worker->universal, function, context); +} + +gearman_return_t gearman_worker_add_server(gearman_worker_st *worker, + const char *host, in_port_t port) +{ + if (not gearman_connection_create_args(worker->universal, host, port)) + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_worker_add_servers(gearman_worker_st *worker, const char *servers) +{ + return gearman_parse_servers(servers, _worker_add_server, worker); +} + +void gearman_worker_remove_servers(gearman_worker_st *worker) +{ + if (not worker) + return; + + gearman_free_all_cons(worker->universal); +} + +gearman_return_t gearman_worker_wait(gearman_worker_st *worker) +{ + if (not worker) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_wait(worker->universal); +} + +gearman_return_t gearman_worker_register(gearman_worker_st *worker, + const char *function_name, + uint32_t timeout) +{ + gearman_function_t null_func= gearman_function_create_null(); + return _worker_function_create(worker, function_name, strlen(function_name), null_func, timeout, NULL); +} + +bool gearman_worker_function_exist(gearman_worker_st *worker, + const char *function_name, + size_t function_length) +{ + struct _worker_function_st *function; + + function= _function_exist(worker, function_name, function_length); + + return (function && function->options.remove == false) ? true : false; +} + +static inline gearman_return_t _worker_unregister(gearman_worker_st *worker, + const char *function_name, size_t function_length) +{ + struct _worker_function_st *function; + gearman_return_t ret; + const void *args[1]; + size_t args_size[1]; + + function= _function_exist(worker, function_name, function_length); + + if (function == NULL || function->options.remove) + { + return GEARMAN_NO_REGISTERED_FUNCTION; + } + + gearman_packet_free(&(function->packet)); + + args[0]= function->name(); + args_size[0]= function->length(); + ret= gearman_packet_create_args(worker->universal, function->packet, + GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CANT_DO, + args, args_size, 1); + if (gearman_failed(ret)) + { + function->options.packet_in_use= false; + return ret; + } + + function->options.change= true; + function->options.remove= true; + + worker->options.change= true; + + return GEARMAN_SUCCESS; +} + +gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, + const char *function_name) +{ + return _worker_unregister(worker, function_name, strlen(function_name)); +} + +gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker) +{ + struct _worker_function_st *function; + uint32_t count= 0; + + if (not worker->function_list) + return GEARMAN_NO_REGISTERED_FUNCTIONS; + + /* Lets find out if we have any functions left that are valid */ + for (function= worker->function_list; function; + function= function->next) + { + if (function->options.remove == false) + count++; + } + + if (count == 0) + return GEARMAN_NO_REGISTERED_FUNCTIONS; + + gearman_packet_free(&(worker->function_list->packet)); + + gearman_return_t ret= gearman_packet_create_args(worker->universal, + worker->function_list->packet, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_RESET_ABILITIES, + NULL, NULL, 0); + if (gearman_failed(ret)) + { + worker->function_list->options.packet_in_use= false; + + return ret; + } + + while (worker->function_list->next) + _worker_function_free(worker, worker->function_list->next); + + worker->function_list->options.change= true; + worker->function_list->options.remove= true; + + worker->options.change= true; + + return GEARMAN_SUCCESS; +} + +gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, + gearman_job_st *job, + gearman_return_t *ret_ptr) +{ + struct _worker_function_st *function; + uint32_t active; + gearman_return_t unused; + + if (not ret_ptr) + ret_ptr= &unused; + + while (1) + { + switch (worker->state) + { + case GEARMAN_WORKER_STATE_START: + /* If there are any new functions changes, send them now. */ + if (worker->options.change) + { + worker->function= worker->function_list; + while (worker->function) + { + if (not (worker->function->options.change)) + { + worker->function= worker->function->next; + continue; + } + + for (worker->con= (&worker->universal)->con_list; worker->con; + worker->con= worker->con->next) + { + if (worker->con->fd == -1) + continue; + + case GEARMAN_WORKER_STATE_FUNCTION_SEND: + *ret_ptr= worker->con->send(worker->function->packet, true); + if (gearman_failed(*ret_ptr)) + { + if (*ret_ptr == GEARMAN_IO_WAIT) + { + worker->state= GEARMAN_WORKER_STATE_FUNCTION_SEND; + } + else if (*ret_ptr == GEARMAN_LOST_CONNECTION) + { + continue; + } + + return NULL; + } + } + + if (worker->function->options.remove) + { + function= worker->function->prev; + _worker_function_free(worker, worker->function); + if (function == NULL) + worker->function= worker->function_list; + else + worker->function= function; + } + else + { + worker->function->options.change= false; + worker->function= worker->function->next; + } + } + + worker->options.change= false; + } + + if (not worker->function_list) + { + gearman_error(worker->universal, GEARMAN_NO_REGISTERED_FUNCTIONS, "no functions have been registered"); + *ret_ptr= GEARMAN_NO_REGISTERED_FUNCTIONS; + return NULL; + } + + for (worker->con= (&worker->universal)->con_list; worker->con; + worker->con= worker->con->next) + { + /* If the connection to the job server is not active, start it. */ + if (worker->con->fd == -1) + { + for (worker->function= worker->function_list; + worker->function; + worker->function= worker->function->next) + { + case GEARMAN_WORKER_STATE_CONNECT: + *ret_ptr= worker->con->send(worker->function->packet, true); + if (gearman_failed(*ret_ptr)) + { + if (*ret_ptr == GEARMAN_IO_WAIT) + { + worker->state= GEARMAN_WORKER_STATE_CONNECT; + } + else if (*ret_ptr == GEARMAN_COULD_NOT_CONNECT or *ret_ptr == GEARMAN_LOST_CONNECTION) + { + break; + } + + return NULL; + } + } + + if (*ret_ptr == GEARMAN_COULD_NOT_CONNECT) + { + continue; + } + } + + case GEARMAN_WORKER_STATE_GRAB_JOB_SEND: + if (worker->con->fd == -1) + continue; + + *ret_ptr= worker->con->send(worker->grab_job, true); + if (gearman_failed(*ret_ptr)) + { + if (*ret_ptr == GEARMAN_IO_WAIT) + { + worker->state= GEARMAN_WORKER_STATE_GRAB_JOB_SEND; + } + else if (*ret_ptr == GEARMAN_LOST_CONNECTION) + { + continue; + } + + return NULL; + } + + if (not worker->job) + { + worker->job= gearman_job_create(worker, job); + if (not worker->job) + { + *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + } + + while (1) + { + case GEARMAN_WORKER_STATE_GRAB_JOB_RECV: + assert(worker->job); + (void)worker->con->receiving(worker->job->assigned, *ret_ptr, true); + + if (gearman_failed(*ret_ptr)) + { + if (*ret_ptr == GEARMAN_IO_WAIT) + { + worker->state= GEARMAN_WORKER_STATE_GRAB_JOB_RECV; + } + else + { + gearman_job_free(worker->job); + worker->job= NULL; + + if (*ret_ptr == GEARMAN_LOST_CONNECTION) + break; + } + + return NULL; + } + + if (worker->job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN or + worker->job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL or + worker->job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_UNIQ) + { + worker->job->options.assigned_in_use= true; + worker->job->con= worker->con; + worker->state= GEARMAN_WORKER_STATE_GRAB_JOB_SEND; + job= worker->job; + worker->job= NULL; + + return job; + } + + if (worker->job->assigned.command == GEARMAN_COMMAND_NO_JOB) + { + gearman_packet_free(&(worker->job->assigned)); + break; + } + + if (worker->job->assigned.command != GEARMAN_COMMAND_NOOP) + { + gearman_universal_set_error(worker->universal, GEARMAN_UNEXPECTED_PACKET, AT, + "unexpected packet:%s", + gearman_command_info(worker->job->assigned.command)->name); + gearman_packet_free(&(worker->job->assigned)); + gearman_job_free(worker->job); + worker->job= NULL; + *ret_ptr= GEARMAN_UNEXPECTED_PACKET; + return NULL; + } + + gearman_packet_free(&(worker->job->assigned)); + } + } + + case GEARMAN_WORKER_STATE_PRE_SLEEP: + for (worker->con= (&worker->universal)->con_list; worker->con; + worker->con= worker->con->next) + { + if (worker->con->fd == INVALID_SOCKET) + { + continue; + } + + *ret_ptr= worker->con->send(worker->pre_sleep, true); + if (gearman_failed(*ret_ptr)) + { + if (*ret_ptr == GEARMAN_IO_WAIT) + { + worker->state= GEARMAN_WORKER_STATE_PRE_SLEEP; + } + else if (*ret_ptr == GEARMAN_LOST_CONNECTION) + { + continue; + } + + return NULL; + } + } + + worker->state= GEARMAN_WORKER_STATE_START; + + /* Set a watch on all active connections that we sent a PRE_SLEEP to. */ + active= 0; + for (worker->con= worker->universal.con_list; worker->con; + worker->con= worker->con->next) + { + if (worker->con->fd == INVALID_SOCKET) + continue; + + worker->con->set_events(POLLIN); + active++; + } + + if ((&worker->universal)->options.non_blocking) + { + *ret_ptr= GEARMAN_NO_JOBS; + return NULL; + } + + if (active == 0) + { + if (worker->universal.timeout < 0) + { + usleep(GEARMAN_WORKER_WAIT_TIMEOUT * 1000); + } + else + { + if (worker->universal.timeout > 0) + { + usleep(static_cast((&worker->universal)->timeout) * 1000); + } + + if (worker->options.timeout_return) + { + gearman_error(worker->universal, GEARMAN_TIMEOUT, "Option timeout return reached"); + *ret_ptr= GEARMAN_TIMEOUT; + + return NULL; + } + } + } + else + { + *ret_ptr= gearman_wait(worker->universal); + if (gearman_failed(*ret_ptr) and (*ret_ptr != GEARMAN_TIMEOUT or worker->options.timeout_return)) + { + return NULL; + } + } + + break; + } + } +} + +void gearman_job_free_all(gearman_worker_st *worker) +{ + while (worker->job_list) + gearman_job_free(worker->job_list); +} + +gearman_return_t gearman_worker_add_function(gearman_worker_st *worker, + const char *function_name, + uint32_t timeout, + gearman_worker_fn *worker_fn, + void *context) +{ + if (not worker) + return GEARMAN_INVALID_ARGUMENT; + + if (not function_name) + { + return gearman_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "function name not given"); + } + + if (not worker_fn) + { + return gearman_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "function not given"); + } + gearman_function_t local= gearman_function_create_v1(worker_fn); + + return _worker_function_create(worker, + function_name, strlen(function_name), + local, + timeout, + context); +} + +gearman_return_t gearman_worker_define_function(gearman_worker_st *worker, + const char *function_name, const size_t function_name_length, + const gearman_function_t function, + const uint32_t timeout, + void *context) +{ + if (not worker) + { + return GEARMAN_INVALID_ARGUMENT; + } + + if (not function_name or function_name_length == 0) + { + return gearman_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "function name not given"); + } + + return _worker_function_create(worker, + function_name, function_name_length, + function, + timeout, + context); + + return GEARMAN_INVALID_ARGUMENT; +} + +gearman_return_t gearman_worker_work(gearman_worker_st *worker) +{ + bool shutdown= false; + + if (not worker) + { + return GEARMAN_INVALID_ARGUMENT; + } + + switch (worker->work_state) + { + case GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB: + { + gearman_return_t ret; + worker->work_job= gearman_worker_grab_job(worker, NULL, &ret); + + if (gearman_failed(ret)) + { + if (ret == GEARMAN_COULD_NOT_CONNECT) + { + gearman_reset(worker->universal); + } + return ret; + } + assert(worker->work_job); + + for (worker->work_function= worker->function_list; + worker->work_function; + worker->work_function= worker->work_function->next) + { + if (not strcmp(gearman_job_function_name(worker->work_job), + worker->work_function->function_name)) + { + break; + } + } + + if (not worker->work_function) + { + gearman_job_free(worker->work_job); + worker->work_job= NULL; + return gearman_error(worker->universal, GEARMAN_INVALID_FUNCTION_NAME, "Function not found"); + } + + if (not worker->work_function->has_callback()) + { + gearman_job_free(worker->work_job); + worker->work_job= NULL; + return gearman_error(worker->universal, GEARMAN_INVALID_FUNCTION_NAME, "Neither a gearman_worker_fn, or gearman_function_fn callback was supplied"); + } + + worker->work_result_size= 0; + } + + case GEARMAN_WORKER_WORK_UNIVERSAL_FUNCTION: + { + switch (worker->work_function->callback(worker->work_job, + static_cast(worker->work_function->context))) + { + case GEARMAN_FUNCTION_INVALID_ARGUMENT: + worker->work_job->error_code= GEARMAN_INVALID_ARGUMENT; + case GEARMAN_FUNCTION_FATAL: + if (gearman_job_send_fail_fin(worker->work_job) == GEARMAN_LOST_CONNECTION) // If we fail this, we have no connection, @note this causes us to lose the current error + { + worker->work_job->error_code= GEARMAN_LOST_CONNECTION; + break; + } + worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_FAIL; + return worker->work_job->error_code; + + case GEARMAN_FUNCTION_ERROR: // retry + worker->work_job->error_code= GEARMAN_LOST_CONNECTION; + break; + + case GEARMAN_FUNCTION_SHUTDOWN: + shutdown= true; + + case GEARMAN_FUNCTION_SUCCESS: + break; + } + + if (worker->work_job->error_code == GEARMAN_LOST_CONNECTION) + break; + } + + case GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE: + { + worker->work_job->error_code= gearman_job_send_complete_fin(worker->work_job, + worker->work_result, worker->work_result_size); + if (worker->work_job->error_code == GEARMAN_IO_WAIT) + { + worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE; + return gearman_error(worker->universal, worker->work_job->error_code, + "A failure occurred after worker had successful complete, unless gearman_job_send_complete() was called directly by worker, client has not been informed of success."); + } + + if (worker->work_result) + { + gearman_free(worker->universal, worker->work_result); + worker->work_result= NULL; + } + + // If we lost the connection, we retry the work, otherwise we error + if (worker->work_job->error_code == GEARMAN_LOST_CONNECTION) + { + break; + } + else if (gearman_failed(worker->work_job->error_code)) + { + worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_FAIL; + + return worker->work_job->error_code; + } + } + break; + + case GEARMAN_WORKER_WORK_UNIVERSAL_FAIL: + { + if (gearman_failed(worker->work_job->error_code= gearman_job_send_fail_fin(worker->work_job))) + { + if (worker->work_job->error_code == GEARMAN_LOST_CONNECTION) + { + break; + } + + return worker->work_job->error_code; + } + } + break; + } + + gearman_job_free(worker->work_job); + worker->work_job= NULL; + + worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB; + + return shutdown ? GEARMAN_SHUTDOWN : GEARMAN_SUCCESS; +} + +gearman_return_t gearman_worker_echo(gearman_worker_st *worker, + const void *workload, + size_t workload_size) +{ + if (not worker) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_echo(worker->universal, workload, workload_size); +} + +/* + * Static Definitions + */ + +static gearman_worker_st *_worker_allocate(gearman_worker_st *worker, bool is_clone) +{ + if (not worker) + { + worker= new (std::nothrow) gearman_worker_st; + if (worker == NULL) + { + gearman_perror(worker->universal, "gearman_worker_st new"); + return NULL; + } + + worker->options.allocated= true; + } + else + { + worker->options.allocated= false; + } + + worker->options.non_blocking= false; + worker->options.packet_init= false; + worker->options.change= false; + worker->options.grab_uniq= true; + worker->options.grab_all= true; + worker->options.timeout_return= false; + + worker->state= GEARMAN_WORKER_STATE_START; + worker->work_state= GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB; + worker->function_count= 0; + worker->job_count= 0; + worker->work_result_size= 0; + worker->context= NULL; + worker->con= NULL; + worker->job= NULL; + worker->job_list= NULL; + worker->function= NULL; + worker->function_list= NULL; + worker->work_function= NULL; + worker->work_result= NULL; + + if (not is_clone) + { + gearman_universal_initialize(worker->universal); +#if 0 + gearman_universal_set_timeout(worker->universal, GEARMAN_WORKER_WAIT_TIMEOUT); +#endif + } + + return worker; +} + +static gearman_return_t _worker_packet_init(gearman_worker_st *worker) +{ + gearman_return_t ret= gearman_packet_create_args(worker->universal, worker->grab_job, + GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_GRAB_JOB_ALL, + NULL, NULL, 0); + if (gearman_failed(ret)) + return ret; + + ret= gearman_packet_create_args(worker->universal, worker->pre_sleep, + GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_PRE_SLEEP, + NULL, NULL, 0); + if (gearman_failed(ret)) + { + gearman_packet_free(&(worker->grab_job)); + return ret; + } + + worker->options.packet_init= true; + + return GEARMAN_SUCCESS; +} + +static gearman_return_t _worker_add_server(const char *host, in_port_t port, void *context) +{ + return gearman_worker_add_server(static_cast(context), host, port); +} + +static gearman_return_t _worker_function_create(gearman_worker_st *worker, + const char *function_name, size_t function_length, + const gearman_function_t &function_arg, + uint32_t timeout, + void *context) +{ + const void *args[2]; + size_t args_size[2]; + + _worker_function_st *function= make(worker->universal._namespace, function_name, function_length, function_arg, context); + + if (not function) + { + gearman_perror(worker->universal, "_worker_function_st::new()"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + gearman_return_t ret; + if (timeout > 0) + { + char timeout_buffer[11]; + snprintf(timeout_buffer, sizeof(timeout_buffer), "%u", timeout); + args[0]= function->name(); + args_size[0]= function->length() + 1; + args[1]= timeout_buffer; + args_size[1]= strlen(timeout_buffer); + ret= gearman_packet_create_args(worker->universal, function->packet, + GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_CAN_DO_TIMEOUT, + args, args_size, 2); + } + else + { + args[0]= function->name(); + args_size[0]= function->length(); + ret= gearman_packet_create_args(worker->universal, function->packet, + GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CAN_DO, + args, args_size, 1); + } + + if (gearman_failed(ret)) + { + delete function; + + return ret; + } + + if (worker->function_list) + worker->function_list->prev= function; + + function->next= worker->function_list; + function->prev= NULL; + worker->function_list= function; + worker->function_count++; + + worker->options.change= true; + + return GEARMAN_SUCCESS; +} + +static void _worker_function_free(gearman_worker_st *worker, + struct _worker_function_st *function) +{ + if (worker->function_list == function) + worker->function_list= function->next; + if (function->prev) + function->prev->next= function->next; + if (function->next) + function->next->prev= function->prev; + worker->function_count--; + + delete function; +} + +gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st *worker, + gearman_malloc_fn *malloc_fn, + gearman_free_fn *free_fn, + gearman_realloc_fn *realloc_fn, + gearman_calloc_fn *calloc_fn, + void *context) +{ + if (not worker) + return GEARMAN_INVALID_ARGUMENT; + + return gearman_set_memory_allocator(worker->universal.allocator, malloc_fn, free_fn, realloc_fn, calloc_fn, context); +} + +bool gearman_worker_set_server_option(gearman_worker_st *self, const char *option_arg, size_t option_arg_size) +{ + gearman_string_t option= { option_arg, option_arg_size }; + + return gearman_request_option(self->universal, option); +} + +void gearman_worker_set_namespace(gearman_worker_st *self, const char *namespace_key, size_t namespace_key_size) +{ + if (not self) + return; + + gearman_universal_set_namespace(self->universal, namespace_key, namespace_key_size); +} diff -Nru gearmand-0.14/libgearman/worker.h gearmand-0.23/libgearman/worker.h --- gearmand-0.14/libgearman/worker.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman/worker.h 2011-06-22 17:48:39.000000000 +0200 @@ -1,9 +1,39 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ /** @@ -11,15 +41,9 @@ * @brief Worker Declarations */ -#ifndef __GEARMAN_WORKER_H__ -#define __GEARMAN_WORKER_H__ +#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_worker Worker Declarations +/** @addtogroup gearman_worker Worker Declarations * * This is the interface gearman workers should use. * @@ -27,36 +51,38 @@ * @{ */ -/** - * @ingroup gearman_worker - */ -struct gearman_worker_st -{ - struct { - bool allocated LIBGEARMAN_BITFIELD; - bool non_blocking LIBGEARMAN_BITFIELD; - bool packet_init LIBGEARMAN_BITFIELD; - bool grab_job_in_use LIBGEARMAN_BITFIELD; - bool pre_sleep_in_use LIBGEARMAN_BITFIELD; - bool work_job_in_use LIBGEARMAN_BITFIELD; - bool change LIBGEARMAN_BITFIELD; - bool grab_uniq LIBGEARMAN_BITFIELD; - bool timeout_return LIBGEARMAN_BITFIELD; - } options; - enum { + enum gearman_worker_state_t { GEARMAN_WORKER_STATE_START, GEARMAN_WORKER_STATE_FUNCTION_SEND, GEARMAN_WORKER_STATE_CONNECT, GEARMAN_WORKER_STATE_GRAB_JOB_SEND, GEARMAN_WORKER_STATE_GRAB_JOB_RECV, GEARMAN_WORKER_STATE_PRE_SLEEP - } state; - enum { + }; + + enum gearman_worker_universal_t { GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB, GEARMAN_WORKER_WORK_UNIVERSAL_FUNCTION, GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE, GEARMAN_WORKER_WORK_UNIVERSAL_FAIL - } work_state; + }; + +/** + * @ingroup gearman_worker + */ +struct gearman_worker_st +{ + struct { + bool allocated; + bool non_blocking; + bool packet_init; + bool change; + bool grab_uniq; + bool grab_all; + bool timeout_return; + } options; + enum gearman_worker_state_t state; + enum gearman_worker_universal_t work_state; uint32_t function_count; uint32_t job_count; size_t work_result_size; @@ -68,12 +94,22 @@ struct _worker_function_st *function_list; struct _worker_function_st *work_function; void *work_result; - gearman_universal_st universal; + struct gearman_universal_st universal; gearman_packet_st grab_job; gearman_packet_st pre_sleep; - gearman_job_st work_job; + gearman_job_st *work_job; }; +#ifdef __cplusplus +#define gearman_has_reducer(A) (A) ? static_cast((A)->reducer.final_fn) : false +#else +#define gearman_has_reducer(A) (A) ? (bool)((A)->reducer.final_fn) : false +#endif + +#ifdef __cplusplus +extern "C" { +#endif + /** * Initialize a worker structure. Always check the return value even if passing @@ -111,7 +147,7 @@ * See gearman_error() for details. */ GEARMAN_API -const char *gearman_worker_error(gearman_worker_st *worker); +const char *gearman_worker_error(const gearman_worker_st *worker); /** * See gearman_errno() for details. @@ -244,7 +280,7 @@ * SERVER[:PORT][,SERVER[:PORT]]... * Some examples are: * 10.0.0.1,10.0.0.2,10.0.0.3 - * localhost LIBGEARMAN_BITFIELD234,jobserver2.domain.com:7003,10.0.0.3 + * localhost234,jobserver2.domain.com:7003,10.0.0.3 * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). @@ -370,11 +406,18 @@ * @return Standard gearman return value. */ GEARMAN_API -gearman_return_t gearman_worker_add_function(gearman_worker_st *worker, - const char *function_name, - uint32_t timeout, - gearman_worker_fn *function, - void *context); + gearman_return_t gearman_worker_add_function(gearman_worker_st *worker, + const char *function_name, + uint32_t timeout, + gearman_worker_fn *function, + void *context); + +GEARMAN_API + gearman_return_t gearman_worker_define_function(gearman_worker_st *worker, + const char *function_name, const size_t function_name_length, + const gearman_function_t function, + const uint32_t timeout, + void *context); /** * Wait for a job and call the appropriate callback function when it gets one. @@ -401,10 +444,22 @@ const void *workload, size_t workload_size); +GEARMAN_API + gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st *, + gearman_malloc_fn *malloc_fn, + gearman_free_fn *free_fn, + gearman_realloc_fn *realloc_fn, + gearman_calloc_fn *calloc_fn, + void *context); + +GEARMAN_API +bool gearman_worker_set_server_option(gearman_worker_st *self, const char *option_arg, size_t option_arg_size); + +GEARMAN_API +void gearman_worker_set_namespace(gearman_worker_st *self, const char *namespace_key, size_t namespace_key_size); + /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_WORKER_H__ */ diff -Nru gearmand-0.14/libgearman-server/byte.h gearmand-0.23/libgearman-server/byte.h --- gearmand-0.14/libgearman-server/byte.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/byte.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,78 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +namespace gearmand_internal { + +class Byte { +public: + Byte () : + _array() + { } + + Byte (size_t arg): + _array(arg) + { } + + inline const char *c_str() const + { + return &_array[0]; + } + + inline char *c_str() + { + return &_array[0]; + } + + inline size_t size() const + { + return _array.size(); + } + + inline void resize(size_t arg) + { + _array.resize(arg); + } + +private: + std::vector _array; +}; + +} //namespace gearmand_internal diff -Nru gearmand-0.14/libgearman-server/byteorder.cc gearmand-0.23/libgearman-server/byteorder.cc --- gearmand-0.14/libgearman-server/byteorder.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/byteorder.cc 2011-04-10 00:15:48.000000000 +0200 @@ -0,0 +1,50 @@ +/* + Taken from libmemcached. + */ + +/* LibMemcached + * Copyright (C) 2006-2009 Brian Aker + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + * + * Summary: + * + */ + +#include + +#include + +#ifndef swap64 +/* Byte swap a 64-bit number. */ +static inline uint64_t swap64(uint64_t in) +{ + #ifndef WORDS_BIGENDIAN + /* Little endian, flip the bytes around until someone makes a faster/better + * way to do this. */ + uint64_t rv= 0; + uint8_t x= 0; + for(x= 0; x < 8; x++) + { + rv= (rv << 8) | (in & 0xff); + in >>= 8; + } + return rv; + #else + /* big-endian machines don't need byte swapping */ + return in; + #endif +} +#endif + +uint64_t ntohll(uint64_t value) +{ + return swap64(value); +} + +uint64_t htonll(uint64_t value) +{ + return swap64(value); +} diff -Nru gearmand-0.14/libgearman-server/byteorder.h gearmand-0.23/libgearman-server/byteorder.h --- gearmand-0.14/libgearman-server/byteorder.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/byteorder.h 2011-04-10 00:15:48.000000000 +0200 @@ -0,0 +1,67 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * Taken from libmemcached. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifndef HAVE_HTONLL + +#ifdef __cplusplus +extern "C" { +#endif + +uint64_t ntohll(uint64_t); + +uint64_t htonll(uint64_t); + +#ifdef __cplusplus +} +#endif + +#endif + +#ifdef linux +/* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to + * optimize the conversion functions, but the prototypes generate warnings + * from gcc. The conversion methods isn't the bottleneck for my app, so + * just remove the warnings by undef'ing the optimization .. + */ +#undef ntohs +#undef ntohl +#undef htons +#undef htonl +#endif diff -Nru gearmand-0.14/libgearman-server/client.c gearmand-0.23/libgearman-server/client.c --- gearmand-0.14/libgearman-server/client.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/client.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,96 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Server client definitions - */ - -#include "common.h" - -/* - * Public definitions - */ - -gearman_server_client_st * -gearman_server_client_add(gearman_server_con_st *con) -{ - gearman_server_client_st *client; - - client= gearman_server_client_create(con, NULL); - if (client == NULL) - return NULL; - - return client; -} - -gearman_server_client_st * -gearman_server_client_create(gearman_server_con_st *con, - gearman_server_client_st *client) -{ - gearman_server_st *server= con->thread->server; - - if (client == NULL) - { - if (server->free_client_count > 0) - { - client= server->free_client_list; - GEARMAN_LIST_DEL(server->free_client, client, con_) - } - else - { - client= (gearman_server_client_st *)malloc(sizeof(gearman_server_client_st)); - if (client == NULL) - { - gearman_log_error(con->thread->gearman, "gearman_server_client_create", "malloc"); - return NULL; - } - } - - client->options.allocated= true; - } - else - { - client->options.allocated= false; - } - - client->con= con; - GEARMAN_LIST_ADD(con->client, client, con_) - client->job= NULL; - client->job_next= NULL; - client->job_prev= NULL; - - return client; -} - -void gearman_server_client_free(gearman_server_client_st *client) -{ - gearman_server_st *server= client->con->thread->server; - - GEARMAN_LIST_DEL(client->con->client, client, con_) - - if (client->job != NULL) - { - GEARMAN_LIST_DEL(client->job->client, client, job_) - - /* If this was a foreground job and is now abandoned, mark to not run. */ - if (client->job->client_list == NULL) - { - client->job->ignore_job= true; - client->job->job_queued= false; - } - } - - if (client->options.allocated) - { - if (server->free_client_count < GEARMAN_MAX_FREE_SERVER_CLIENT) - GEARMAN_LIST_ADD(server->free_client, client, con_) - else - free(client); - } -} diff -Nru gearmand-0.14/libgearman-server/client.cc gearmand-0.23/libgearman-server/client.cc --- gearmand-0.14/libgearman-server/client.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/client.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,86 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Server client definitions + */ + +#include +#include + +/* + * Public definitions + */ + +gearman_server_client_st * +gearman_server_client_add(gearman_server_con_st *con) +{ + gearman_server_client_st *client; + + if (Server->free_client_count > 0) + { + client= Server->free_client_list; + GEARMAN_LIST_DEL(Server->free_client, client, con_) + } + else + { + client= static_cast(malloc(sizeof(gearman_server_client_st))); + if (not client) + { + gearmand_merror("malloc", gearman_server_client_st, 0); + return NULL; + } + } + assert(client); + + if (not client) + { + gearmand_error("In gearman_server_client_add() we failed to either allocorate of find a free one"); + return NULL; + } + + client->con= con; + GEARMAN_LIST_ADD(con->client, client, con_) + + client->job= NULL; + client->job_next= NULL; + client->job_prev= NULL; + + return client; +} + +void gearman_server_client_free(gearman_server_client_st *client) +{ + if (not client) + return; + + GEARMAN_LIST_DEL(client->con->client, client, con_) + + if (client->job) + { + GEARMAN_LIST_DEL(client->job->client, client, job_) + + /* If this was a foreground job and is now abandoned, mark to not run. */ + if (client->job->client_list == NULL) + { + client->job->ignore_job= true; + client->job->job_queued= false; + } + } + + if (Server->free_client_count < GEARMAN_MAX_FREE_SERVER_CLIENT) + { + GEARMAN_LIST_ADD(Server->free_client, client, con_) + } + else + { + gearmand_crazy("free"); + free(client); + } +} diff -Nru gearmand-0.14/libgearman-server/client.h gearmand-0.23/libgearman-server/client.h --- gearmand-0.14/libgearman-server/client.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/client.h 2011-06-03 04:13:30.000000000 +0200 @@ -11,6 +11,7 @@ * @brief Client Declarations */ +#pragma once #ifndef __GEARMAN_SERVER_CLIENT_H__ #define __GEARMAN_SERVER_CLIENT_H__ @@ -23,9 +24,6 @@ */ struct gearman_server_client_st { - struct { - bool allocated; - } options; gearman_server_con_st *con; gearman_server_client_st *con_next; gearman_server_client_st *con_prev; @@ -52,14 +50,6 @@ gearman_server_client_add(gearman_server_con_st *con); /** - * Initialize a server client structure. - */ -GEARMAN_API -gearman_server_client_st * -gearman_server_client_create(gearman_server_con_st *con, - gearman_server_client_st *client); - -/** * Free a server client structure. */ GEARMAN_API diff -Nru gearmand-0.14/libgearman-server/common.h gearmand-0.23/libgearman-server/common.h --- gearmand-0.14/libgearman-server/common.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/common.h 2011-06-08 08:01:33.000000000 +0200 @@ -11,26 +11,16 @@ * @brief System Include Files */ -#ifndef __GEARMAN_SERVER_COMMON_H__ -#define __GEARMAN_SERVER_COMMON_H__ +#pragma once -#include "config.h" +#include -#define GEARMAN_CORE -#include "gearmand.h" +#include +#include -#ifdef HAVE_ASSERT_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif #ifdef HAVE_FCNTL_H #include #endif -#ifdef HAVE_GETOPT_H -#include -#endif #ifdef HAVE_PTHREAD #include #endif @@ -40,15 +30,6 @@ #ifdef HAVE_STDDEF_H #include #endif -#ifdef HAVE_STDIO_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif #ifdef HAVE_STRINGS_H #include #endif @@ -166,6 +147,8 @@ __hash ## _count--; \ } +#define gearmand_array_size(__object) (sizeof((__object)) / sizeof(*(__object))) + /* All thread-safe libevent functions are not in libevent 1.3x, and this is the common package version. Make this work for these earlier versions. */ #ifndef HAVE_EVENT_BASE_NEW @@ -183,5 +166,3 @@ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_SERVER_COMMON_H__ */ diff -Nru gearmand-0.14/libgearman-server/conf.c gearmand-0.23/libgearman-server/conf.c --- gearmand-0.14/libgearman-server/conf.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/conf.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,266 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2009 Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman conf definitions - */ - -#include "common.h" - -/* - * Public definitions - */ - -gearman_conf_st *gearman_conf_create(gearman_conf_st *conf) -{ - if (conf == NULL) - { - conf= (gearman_conf_st *)malloc(sizeof(gearman_conf_st)); - if (conf == NULL) - return NULL; - - conf->options.allocated= true; - } - else - { - conf->options.allocated= false; - } - - conf->last_return= GEARMAN_SUCCESS; - conf->last_errno= 0; - conf->module_count= 0; - conf->option_count= 0; - conf->short_count= 0; - conf->module_list= NULL; - conf->option_list= NULL; - conf->option_short[0]= 0; - conf->last_error[0]= 0; - - /* We always need a NULL terminated getopt list. */ - conf->option_getopt= (struct option *)malloc(sizeof(struct option)); - if (conf->option_getopt == NULL) - { - gearman_conf_free(conf); - return NULL; - } - - memset(conf->option_getopt, 0, sizeof(sizeof(struct option))); - - return conf; -} - -void gearman_conf_free(gearman_conf_st *conf) -{ - uint32_t x; - - for (x= 0; x < conf->module_count; x++) - gearman_conf_module_free(conf->module_list[x]); - - for (x= 0; x < conf->option_count; x++) - { - free((char *)conf->option_getopt[x].name); - - if (conf->option_list[x].value_list != NULL) - free(conf->option_list[x].value_list); - } - - if (conf->module_list != NULL) - free(conf->module_list); - - if (conf->option_list != NULL) - free(conf->option_list); - - if (conf->option_getopt != NULL) - free(conf->option_getopt); - - if (conf->options.allocated) - free(conf); -} - -gearman_return_t gearman_conf_return(gearman_conf_st *conf) -{ - return conf->last_return; -} - -const char *gearman_conf_error(gearman_conf_st *conf) -{ - return (const char *)(conf->last_error); -} - -int gearman_conf_errno(gearman_conf_st *conf) -{ - return conf->last_errno; -} - -gearman_return_t gearman_conf_parse_args(gearman_conf_st *conf, int argc, - char *argv[]) -{ - int c; - int opt_index; - gearman_conf_option_st *option; - char **value_list; - - /* This will supress errors being printed to stderr. */ - opterr= 0; - - while (1) - { - c= getopt_long(argc, argv, conf->option_short, conf->option_getopt, - &opt_index); - if (c == -1) - break; - - switch (c) - { - case 0: - /* We have a long option, use index. */ - break; - - default: - /* Find the long option index that matches the short character. */ - for (opt_index= 0; opt_index < (int)conf->option_count; opt_index++) - { - if (conf->option_getopt[opt_index].val == c) - break; - } - - if (opt_index == (int)conf->option_count) - { - gearman_conf_error_set(conf, "ERROR", " Unknown option: %s", argv[optind - 1]); - return GEARMAN_UNKNOWN_OPTION; - } - } - - option= &conf->option_list[opt_index]; - value_list= (char **)realloc(option->value_list, - sizeof(char *) * (option->value_count + 1)); - if (value_list == NULL) - { - gearman_conf_error_set(conf, "gearman_conf_parse_args", " realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - option->value_list= value_list; - option->value_list[option->value_count]= optarg; - option->value_count++; - } - - if (optind < argc) - { - gearman_conf_error_set(conf, "gearman_conf_parse_args", "Unknown option: %s", argv[optind]); - return GEARMAN_UNKNOWN_OPTION; - } - - return GEARMAN_SUCCESS; -} - -void gearman_conf_usage(gearman_conf_st *conf) -{ - uint32_t x; - uint32_t y; - gearman_conf_module_st *module; - gearman_conf_option_st *option; - bool print_header; - char display[GEARMAN_CONF_DISPLAY_WIDTH]; - size_t max_length; - size_t new_length; - const char *help_start; - const char *help_next; - - for (x= 0; x < conf->module_count; x++) - { - module= conf->module_list[x]; - print_header= true; - - /* Find the maximum option length for this module. */ - max_length= 0; - - for (y= 0; y < conf->option_count; y++) - { - if (module != conf->option_list[y].module) - continue; - - new_length= strlen(conf->option_getopt[y].name); - - if (conf->option_list[y].value_name != NULL) - new_length+= strlen(conf->option_list[y].value_name) + 1; - - if (new_length > max_length) - max_length= new_length; - } - - /* Truncate option length if it's too long. */ - max_length+= 8; - if (max_length > GEARMAN_CONF_DISPLAY_WIDTH - 2) - max_length= GEARMAN_CONF_DISPLAY_WIDTH - 2; - - /* Print out all options.allocated for this module. */ - for (y= 0; y < conf->option_count; y++) - { - option= &conf->option_list[y]; - - if (option->module != module) - continue; - - if (print_header) - { - printf("\n%s Options:\n\n", - module->name == NULL ? "Main" : module->name); - print_header= false; - } - - /* Build string with possible short option. */ - snprintf(display, GEARMAN_CONF_DISPLAY_WIDTH, " --%s%s%s%80s", - conf->option_getopt[y].name, - option->value_name == NULL ? "" : "=", - option->value_name == NULL ? "" : option->value_name, ""); - display[max_length - 1]= ' '; - display[max_length]= 0; - - if (conf->option_getopt[y].val != 0) - { - display[1]= '-'; - display[2]= (signed char)conf->option_getopt[y].val; - display[3]= ','; - } - - /* If there is no help, just print the option. */ - if (option->help == NULL) - { - printf("%s\n", display); - continue; - } - - /* Make sure the help string is properly wrapped. */ - help_start= option->help; - - while (strlen(help_start) > (GEARMAN_CONF_DISPLAY_WIDTH - max_length)) - { - help_next= help_start + (GEARMAN_CONF_DISPLAY_WIDTH - max_length); - while (help_next != help_start && *help_next != ' ') - help_next--; - - if (help_next == help_start) - help_next= strchr(help_start, ' '); - - if (help_next == NULL) - break; - - printf("%s%.*s\n", display, (int)(help_next - help_start), help_start); - memset(display, ' ', max_length - 1); - - help_start= help_next + 1; - } - - printf("%s%s\n", display, help_start); - } - } - - printf("\n\n"); -} diff -Nru gearmand-0.14/libgearman-server/conf.h gearmand-0.23/libgearman-server/conf.h --- gearmand-0.14/libgearman-server/conf.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/conf.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,103 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2009 Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Configuration Declarations - */ - -#ifndef __GEARMAN_SERVER_CONF_H__ -#define __GEARMAN_SERVER_CONF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_conf Configuration Declarations - * @ingroup gearman_server - * @{ - */ - -struct gearman_conf_option_st -{ - size_t value_count; - gearman_conf_module_st *module; - const char *name; - const char *value_name; - const char *help; - char **value_list; -}; - -struct gearman_conf_st -{ - struct { - bool allocated; - } options; - gearman_return_t last_return; - int last_errno; - size_t module_count; - size_t option_count; - size_t short_count; - gearman_conf_module_st **module_list; - gearman_conf_option_st *option_list; - struct option *option_getopt; - char option_short[GEARMAN_CONF_MAX_OPTION_SHORT]; - char last_error[GEARMAN_MAX_ERROR_SIZE]; -}; - -/** - * Initialize a gearman conf structure. - */ -GEARMAN_API -gearman_conf_st *gearman_conf_create(gearman_conf_st *conf); - -/** - * Free a gearman conf structure. - */ -GEARMAN_API -void gearman_conf_free(gearman_conf_st *conf); - -/** - * Return an return code for the last library error encountered. - */ -GEARMAN_API -gearman_return_t gearman_conf_return(gearman_conf_st *conf); - -/** - * Return an error string for last library error encountered. - */ -GEARMAN_API -const char *gearman_conf_error(gearman_conf_st *conf); - -/** - * Value of errno in the case of a GEARMAN_ERRNO return value. - */ -GEARMAN_API -int gearman_conf_errno(gearman_conf_st *conf); - -/** - * Parse command line arguments. - */ -GEARMAN_API -gearman_return_t gearman_conf_parse_args(gearman_conf_st *conf, int argc, - char *argv[]); - -/** - * Print usage information to stdout. - */ -GEARMAN_API -void gearman_conf_usage(gearman_conf_st *conf); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_SERVER_CONF_H__ */ diff -Nru gearmand-0.14/libgearman-server/conf_module.c gearmand-0.23/libgearman-server/conf_module.c --- gearmand-0.14/libgearman-server/conf_module.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/conf_module.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,206 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2009 Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman conf module definitions - */ - -#include "common.h" - -/* - * Public definitions - */ - -gearman_conf_module_st *gearman_conf_module_create(gearman_conf_st *conf, - gearman_conf_module_st *module, - const char *name) -{ - gearman_conf_module_st **module_list; - - if (module == NULL) - { - module= (gearman_conf_module_st *)malloc(sizeof(gearman_conf_module_st)); - if (module == NULL) - { - gearman_conf_error_set(conf, "gearman_conf_module_create", "malloc"); - return NULL; - } - - module->options.allocated= true; - } - else - { - module->options.allocated= false; - } - - module->current_option= 0; - module->current_value= 0; - module->conf= conf; - module->name= name; - - module_list= (gearman_conf_module_st **)realloc(conf->module_list, sizeof(gearman_conf_module_st *) * - (conf->module_count + 1)); - if (module_list == NULL) - { - gearman_conf_module_free(module); - gearman_conf_error_set(conf, "gearman_conf_module_create", "realloc"); - return NULL; - } - - conf->module_list= module_list; - conf->module_list[conf->module_count]= module; - conf->module_count++; - - return module; -} - -void gearman_conf_module_free(gearman_conf_module_st *module) -{ - if (module->options.allocated) - free(module); -} - -gearman_conf_module_st *gearman_conf_module_find(gearman_conf_st *conf, - const char *name) -{ - for (uint32_t x= 0; x < conf->module_count; x++) - { - if (name == NULL || conf->module_list[x]->name == NULL) - { - if (name == conf->module_list[x]->name) - return conf->module_list[x]; - } - else if (!strcmp(name, conf->module_list[x]->name)) - return conf->module_list[x]; - } - - return NULL; -} - -void gearman_conf_module_add_option(gearman_conf_module_st *module, - const char *name, int short_name, - const char *value_name, const char *help) -{ - gearman_conf_st *conf= module->conf; - gearman_conf_option_st *option_list; - struct option *option_getopt; - - /* Unset short_name if it's already in use. */ - for (uint32_t x= 0; x < conf->option_count && short_name != 0; x++) - { - if (conf->option_getopt[x].val == short_name) - short_name= 0; - } - - /* Make room in option lists. */ - option_list= (gearman_conf_option_st *)realloc(conf->option_list, sizeof(gearman_conf_option_st) * - (conf->option_count + 1)); - if (option_list == NULL) - { - gearman_conf_error_set(conf, "gearman_conf_module_add_option", "realloc"); - conf->last_return= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return; - } - - conf->option_list= option_list; - option_list= &conf->option_list[conf->option_count]; - - option_getopt= (struct option *)realloc(conf->option_getopt, - sizeof(struct option) * (conf->option_count + 2)); - if (option_getopt == NULL) - { - gearman_conf_error_set(conf, "gearman_conf_module_add_option", "realloc"); - conf->last_return= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return; - } - - conf->option_getopt= option_getopt; - option_getopt= &conf->option_getopt[conf->option_count]; - - conf->option_count++; - memset(&conf->option_getopt[conf->option_count], 0, - sizeof(sizeof(struct option))); - - option_list->module= module; - option_list->name= name; - option_list->value_name= value_name; - option_list->help= help; - option_list->value_list= NULL; - option_list->value_count= 0; - - if (module->name == NULL) - { - /* Allocate this one as well so we can always free option_getopt->name. */ - option_getopt->name= strdup(name); - if (option_getopt->name == NULL) - { - gearman_conf_error_set(conf, "gearman_conf_module_add_option", "strdup"); - conf->last_return= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return; - } - } - else - { - // 2 is the - plus null for the const char string - size_t option_string_length= strlen(module->name) + strlen(name) + 2; - char *option_string= (char *) malloc(option_string_length * sizeof(char)); - - if (option_string == NULL) - { - gearman_conf_error_set(conf, "gearman_conf_module_add_option", "malloc"); - conf->last_return= GEARMAN_MEMORY_ALLOCATION_FAILURE; - return; - } - - snprintf(option_string, option_string_length, "%s-%s", module->name, name); - - option_getopt->name= option_string; - } - - option_getopt->has_arg= value_name == NULL ? 0 : 1; - option_getopt->flag= NULL; - option_getopt->val= short_name; - - /* Add short_name to the short option list. */ - if (short_name != 0 && - conf->short_count < (GEARMAN_CONF_MAX_OPTION_SHORT - 2)) - { - conf->option_short[conf->short_count++]= (char)short_name; - if (value_name != NULL) - conf->option_short[conf->short_count++]= ':'; - conf->option_short[conf->short_count]= '0'; - } -} - -bool gearman_conf_module_value(gearman_conf_module_st *module, - const char **name, const char **value) -{ - gearman_conf_option_st *option; - - for (; module->current_option < module->conf->option_count; - module->current_option++) - { - option= &module->conf->option_list[module->current_option]; - if (option->module != module) - continue; - - if (module->current_value < option->value_count) - { - *name= option->name; - *value= option->value_list[module->current_value++]; - return true; - } - - module->current_value= 0; - } - - module->current_option= 0; - - return false; -} diff -Nru gearmand-0.14/libgearman-server/conf_module.h gearmand-0.23/libgearman-server/conf_module.h --- gearmand-0.14/libgearman-server/conf_module.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/conf_module.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,80 +0,0 @@ -/* Module configuration library - * Copyright (C) 2009 Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Configuration Module Declarations - */ - -#ifndef __GEARMAN_SERVER_CONF_MODULE_H__ -#define __GEARMAN_SERVER_CONF_MODULE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_conf_module Configuration Module Declarations - * @ingroup gearman_server - * @{ - */ - -struct gearman_conf_module_st -{ - struct { - bool allocated; - } options; - size_t current_option; - size_t current_value; - gearman_conf_st *conf; - const char *name; -}; - -/** - * Initialize a gearman conf module structure. - */ -GEARMAN_API -gearman_conf_module_st *gearman_conf_module_create(gearman_conf_st *conf, - gearman_conf_module_st *module, - const char *name); - -/** - * Free a gearman conf module structure. - */ -GEARMAN_API -void gearman_conf_module_free(gearman_conf_module_st *module); - -/** - * Find a gearman conf module structure by name. - */ -GEARMAN_API -gearman_conf_module_st *gearman_conf_module_find(gearman_conf_st *conf, - const char *name); - -/** - * Add option for a module. - */ -GEARMAN_API -void gearman_conf_module_add_option(gearman_conf_module_st *module, - const char *name, int short_name, - const char *value_name, const char *help); - -/** - * Loop through all values that were given for a set of module options. - */ -GEARMAN_API -bool gearman_conf_module_value(gearman_conf_module_st *module, - const char **name, const char **value); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_SERVER_CONF_MODULE_H__ */ diff -Nru gearmand-0.14/libgearman-server/connection.c gearmand-0.23/libgearman-server/connection.c --- gearmand-0.14/libgearman-server/connection.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/connection.c 2011-04-11 07:46:47.000000000 +0200 @@ -11,33 +11,38 @@ * @brief Server connection definitions */ -#include "common.h" +#include +#include +#include +#include + +static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread, gearmand_con_st *dcon, + gearmand_error_t *ret); /* * Public definitions */ -gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, - int fd, void *data) +gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon, gearmand_error_t *ret) { gearman_server_con_st *con; - gearman_return_t ret; - con= gearman_server_con_create(thread); + con= _server_con_create(thread, dcon, ret); if (con == NULL) + { return NULL; + } - if (gearman_connection_set_fd(&(con->con), fd) != GEARMAN_SUCCESS) + if ((*ret= gearman_io_set_fd(&(con->con), dcon->fd)) != GEARMAN_SUCCESS) { gearman_server_con_free(con); return NULL; } - con->con.context= data; - - ret= gearman_connection_set_events(&(con->con), POLLIN); - if (ret != GEARMAN_SUCCESS) + *ret= gearmand_io_set_events(con, POLLIN); + if (*ret != GEARMAN_SUCCESS) { + gearmand_gerror("gearmand_io_set_events", *ret); gearman_server_con_free(con); return NULL; } @@ -45,8 +50,8 @@ return con; } -gearman_server_con_st * -gearman_server_con_create(gearman_server_thread_st *thread) +static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread, gearmand_con_st *dcon, + gearmand_error_t *ret) { gearman_server_con_st *con; @@ -60,18 +65,24 @@ con= (gearman_server_con_st *)malloc(sizeof(gearman_server_con_st)); if (con == NULL) { - gearman_log_error(thread->gearman, "gearman_server_con_create", "malloc"); + gearmand_perror("malloc"); + *ret= GEARMAN_MEMORY_ALLOCATION_FAILURE; return NULL; } } - - gearman_connection_options_t options[] = { GEARMAN_CON_IGNORE_LOST_CONNECTION, GEARMAN_CON_MAX }; - if (gearman_connection_create(thread->gearman, &(con->con), options) == NULL) + assert(con); + if (!con) { - free(con); + gearmand_error("Neigther an allocated gearman_server_con_st() or free listed could be found"); + *ret= GEARMAN_MEMORY_ALLOCATION_FAILURE; return NULL; } + gearmand_connection_options_t options[] = { GEARMAND_CON_MAX }; + gearmand_connection_init(thread->gearman, &(con->con), dcon, options); + + con->con.root= con; + con->is_sleeping= false; con->is_exceptions= false; con->is_dead= false; @@ -97,13 +108,31 @@ con->proc_prev= NULL; con->worker_list= NULL; con->client_list= NULL; - con->host= NULL; - con->port= NULL; + con->_host= dcon->host; + con->_port= dcon->port; strcpy(con->id, "-"); - (void) pthread_mutex_lock(&thread->lock); - GEARMAN_LIST_ADD(thread->con, con,) - (void) pthread_mutex_unlock(&thread->lock); + con->protocol.context= NULL; + con->protocol.context_free_fn= NULL; + con->protocol.packet_pack_fn= gearmand_packet_pack; + con->protocol.packet_unpack_fn= gearmand_packet_unpack; + + int error; + if (! (error= pthread_mutex_lock(&thread->lock))) + { + GEARMAN_LIST_ADD(thread->con, con,); + (void) pthread_mutex_unlock(&thread->lock); + } + else + { + errno= error; + gearmand_perror("pthread_mutex_lock"); + gearman_server_con_free(con); + + *ret= GEARMAN_ERRNO; + return NULL; + } + return con; } @@ -113,11 +142,10 @@ gearman_server_thread_st *thread= con->thread; gearman_server_packet_st *packet; - con->host= NULL; - con->port= NULL; + con->_host= NULL; + con->_port= NULL; - if (thread->server->flags.threaded && - !(con->proc_removed) && !(thread->server->proc_shutdown)) + if (Server->flags.threaded && !(con->proc_removed) && !(Server->proc_shutdown)) { con->is_dead= true; con->is_sleeping= false; @@ -127,79 +155,76 @@ return; } - gearman_connection_free(&(con->con)); + gearmand_io_free(&(con->con)); + + if (con->protocol.context != NULL && con->protocol.context_free_fn != NULL) + { + con->protocol.context_free_fn(con, (void *)con->protocol.context); + } + if (con->proc_list) + { gearman_server_con_proc_remove(con); + } if (con->io_list) + { gearman_server_con_io_remove(con); + } if (con->packet != NULL) { if (&(con->packet->packet) != con->con.recv_packet) - gearman_packet_free(&(con->packet->packet)); + { + gearmand_packet_free(&(con->packet->packet)); + } + gearman_server_packet_free(con->packet, con->thread, true); } while (con->io_packet_list != NULL) + { gearman_server_io_packet_remove(con); + } while (con->proc_packet_list != NULL) { packet= gearman_server_proc_packet_remove(con); - gearman_packet_free(&(packet->packet)); + gearmand_packet_free(&(packet->packet)); gearman_server_packet_free(packet, con->thread, true); } gearman_server_con_free_workers(con); while (con->client_list != NULL) + { gearman_server_client_free(con->client_list); + } (void) pthread_mutex_lock(&thread->lock); GEARMAN_LIST_DEL(con->thread->con, con,) (void) pthread_mutex_unlock(&thread->lock); if (thread->free_con_count < GEARMAN_MAX_FREE_SERVER_CON) + { GEARMAN_LIST_ADD(thread->free_con, con,) + } else + { + gearmand_crazy("free"); free(con); + } } -gearman_connection_st *gearman_server_con_con(gearman_server_con_st *con) +gearmand_io_st *gearman_server_con_con(gearman_server_con_st *con) { return &con->con; } -const void *gearman_server_con_data(const gearman_server_con_st *con) -{ - return gearman_connection_context(&(con->con)); -} - -void gearman_server_con_set_data(gearman_server_con_st *con, void *data) -{ - gearman_connection_set_context(&(con->con), data); -} - -const char *gearman_server_con_host(gearman_server_con_st *con) -{ - return con->host; -} - -void gearman_server_con_set_host(gearman_server_con_st *con, const char *host) -{ - con->host= host; -} - -const char *gearman_server_con_port(gearman_server_con_st *con) +gearmand_con_st *gearman_server_con_data(gearman_server_con_st *con) { - return con->port; -} - -void gearman_server_con_set_port(gearman_server_con_st *con, const char *port) -{ - con->port= port; + return gearman_io_context(&(con->con)); } const char *gearman_server_con_id(gearman_server_con_st *con) @@ -309,13 +334,12 @@ con->proc_list= true; (void) pthread_mutex_unlock(&con->thread->lock); - if (! (con->thread->server->proc_shutdown) && - !(con->thread->server->proc_wakeup)) + if (! (Server->proc_shutdown) && !(Server->proc_wakeup)) { - (void) pthread_mutex_lock(&(con->thread->server->proc_lock)); - con->thread->server->proc_wakeup= true; - (void) pthread_cond_signal(&(con->thread->server->proc_cond)); - (void) pthread_mutex_unlock(&(con->thread->server->proc_lock)); + (void) pthread_mutex_lock(&(Server->proc_lock)); + Server->proc_wakeup= true; + (void) pthread_cond_signal(&(Server->proc_cond)); + (void) pthread_mutex_unlock(&(Server->proc_lock)); } } @@ -355,3 +379,22 @@ return con; } + +void gearmand_connection_set_protocol(gearman_server_con_st *connection, void *context, + gearmand_connection_protocol_context_free_fn *free_fn, + gearmand_packet_pack_fn *pack, + gearmand_packet_unpack_fn *unpack) +{ + connection->protocol.context= context; + connection->protocol.context_free_fn= free_fn; + connection->protocol.packet_pack_fn= pack; + connection->protocol.packet_unpack_fn= unpack; +} + +void *gearmand_connection_protocol_context(const gearman_server_con_st *connection) +{ + return connection->protocol.context; +} + + + diff -Nru gearmand-0.14/libgearman-server/connection.h gearmand-0.23/libgearman-server/connection.h --- gearmand-0.14/libgearman-server/connection.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/connection.h 2011-06-03 04:13:30.000000000 +0200 @@ -14,10 +14,62 @@ #ifndef __GEARMAN_SERVER_CON_H__ #define __GEARMAN_SERVER_CON_H__ +#include +#include + #ifdef __cplusplus extern "C" { #endif +struct gearmand_io_st +{ + struct { + bool ready; + bool packet_in_use; + bool external_fd; + bool ignore_lost_connection; + bool close_after_flush; + } options; + enum { + GEARMAND_CON_UNIVERSAL_INVALID, + GEARMAND_CON_UNIVERSAL_CONNECTED + } _state; + enum { + GEARMAND_CON_SEND_STATE_NONE, + GEARMAND_CON_SEND_UNIVERSAL_PRE_FLUSH, + GEARMAND_CON_SEND_UNIVERSAL_FORCE_FLUSH, + GEARMAND_CON_SEND_UNIVERSAL_FLUSH, + GEARMAND_CON_SEND_UNIVERSAL_FLUSH_DATA + } send_state; + enum { + GEARMAND_CON_RECV_UNIVERSAL_NONE, + GEARMAND_CON_RECV_UNIVERSAL_READ, + GEARMAND_CON_RECV_STATE_READ_DATA + } recv_state; + short events; + short revents; + int fd; + uint32_t created_id; + uint32_t created_id_next; + size_t send_buffer_size; + size_t send_data_size; + size_t send_data_offset; + size_t recv_buffer_size; + size_t recv_data_size; + size_t recv_data_offset; + gearmand_connection_list_st *universal; + gearmand_io_st *next; + gearmand_io_st *prev; + gearmand_con_st *context; + char *send_buffer_ptr; + gearmand_packet_st *recv_packet; + char *recv_buffer_ptr; + gearmand_packet_st packet; + gearman_server_con_st *root; + char send_buffer[GEARMAN_SEND_BUFFER_SIZE]; + char recv_buffer[GEARMAN_RECV_BUFFER_SIZE]; +}; + /** * @addtogroup gearman_server_con Connection Declarations * @ingroup gearman_server @@ -28,14 +80,17 @@ * @{ */ +/* + Free list for these are stored in gearman_server_thread_st[], otherwise they are owned by gearmand_con_st[] + */ struct gearman_server_con_st { - gearman_connection_st con; /* This must be the first struct member. */ + gearmand_io_st con; bool is_sleeping; bool is_exceptions; bool is_dead; bool is_noop_sent; - gearman_return_t ret; + gearmand_error_t ret; bool io_list; bool proc_list; bool proc_removed; @@ -55,32 +110,31 @@ gearman_server_con_st *io_prev; gearman_server_con_st *proc_next; gearman_server_con_st *proc_prev; - gearman_server_worker_st *worker_list; - gearman_server_client_st *client_list; - const char *host; - const char *port; + struct gearman_server_worker_st *worker_list; + struct gearman_server_client_st *client_list; + const char *_host; // client host + const char *_port; // client port char id[GEARMAN_SERVER_CON_ID_SIZE]; + struct { + void *context; + gearmand_connection_protocol_context_free_fn *context_free_fn; + gearmand_packet_pack_fn *packet_pack_fn; + gearmand_packet_unpack_fn *packet_unpack_fn; + } protocol; }; /** * Add a connection to a server thread. This goes into a list of connections * that is used later with server_thread_run, no socket I/O happens here. * @param thread Thread structure previously initialized with - * gearman_server_thread_create. + * gearman_server_thread_init. * @param fd File descriptor for a newly accepted connection. * @param data Application data pointer. * @return Gearman server connection pointer. */ GEARMAN_API -gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, - int fd, void *data); - -/** - * Initialize a server connection structure. - */ -GEARMAN_API -gearman_server_con_st * -gearman_server_con_create(gearman_server_thread_st *thread); +gearman_server_con_st *gearman_server_con_add(gearman_server_thread_st *thread, gearmand_con_st *dcon, + gearmand_error_t *ret); /** * Free a server connection structure. @@ -92,43 +146,13 @@ * Get gearman connection pointer the server connection uses. */ GEARMAN_API -gearman_connection_st *gearman_server_con_con(gearman_server_con_st *con); +gearmand_io_st *gearman_server_con_con(gearman_server_con_st *con); /** * Get application data pointer. */ GEARMAN_API -const void *gearman_server_con_data(const gearman_server_con_st *con); - -/** - * Set application data pointer. - */ -GEARMAN_API -void gearman_server_con_set_data(gearman_server_con_st *con, void *data); - -/** - * Get client host. - */ -GEARMAN_API -const char *gearman_server_con_host(gearman_server_con_st *con); - -/** - * Set client host. - */ -GEARMAN_API -void gearman_server_con_set_host(gearman_server_con_st *con, const char *host); - -/** - * Get client port. - */ -GEARMAN_API -const char *gearman_server_con_port(gearman_server_con_st *con); - -/** - * Set client port. - */ -GEARMAN_API -void gearman_server_con_set_port(gearman_server_con_st *con, const char *port); +gearmand_con_st *gearman_server_con_data(gearman_server_con_st *con); /** * Get client id. @@ -195,6 +219,19 @@ gearman_server_con_st * gearman_server_con_proc_next(gearman_server_thread_st *thread); +/** + * Set protocol context pointer. + */ +GEARMAN_INTERNAL_API +void gearmand_connection_set_protocol(gearman_server_con_st *connection, + void *context, + gearmand_connection_protocol_context_free_fn *free_fn, + gearmand_packet_pack_fn *pack, + gearmand_packet_unpack_fn *unpack); + +GEARMAN_INTERNAL_API +void *gearmand_connection_protocol_context(const gearman_server_con_st *connection); + /** @} */ #ifdef __cplusplus diff -Nru gearmand-0.14/libgearman-server/connection_list.cc gearmand-0.23/libgearman-server/connection_list.cc --- gearmand-0.14/libgearman-server/connection_list.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/connection_list.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,49 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include +#include +#include +#include +#include +#include +#include + +void gearmand_connection_list_init(gearmand_connection_list_st *universal, + gearmand_event_watch_fn *watch_fn, void *watch_context) +{ + assert(universal); + + universal->con_count= 0; + universal->con_list= NULL; + universal->event_watch_fn= watch_fn; + universal->event_watch_context= watch_context; +} + +void gearman_connection_list_free(gearmand_connection_list_st *universal) +{ + while (universal->con_list) + gearmand_io_free(universal->con_list); +} + +gearman_server_con_st *gearmand_ready(gearmand_connection_list_st *universal) +{ + /* We can't keep universal between calls since connections may be removed during + processing. If this list ever gets big, we may want something faster. */ + + for (gearmand_io_st *con= universal->con_list; con; con= con->next) + { + if (con->options.ready) + { + con->options.ready= false; + return con->root; + } + } + + return NULL; +} diff -Nru gearmand-0.14/libgearman-server/connection_list.h gearmand-0.23/libgearman-server/connection_list.h --- gearmand-0.14/libgearman-server/connection_list.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/connection_list.h 2011-03-30 19:34:07.000000000 +0200 @@ -0,0 +1,41 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +struct gearmand_io_st; + +#ifdef __cplusplus +extern "C" { +#endif + +struct gearmand_connection_list_st +{ + uint32_t con_count; + gearmand_io_st *con_list; + gearmand_event_watch_fn *event_watch_fn; // Function to be called when events need to be watched + void *event_watch_context; +}; + +typedef struct gearmand_connection_list_st gearmand_connection_list_st; + +GEARMAN_INTERNAL_API +void gearmand_connection_list_init(gearmand_connection_list_st *source, gearmand_event_watch_fn *watch_fn, void *watch_context); + +GEARMAN_INTERNAL_API +void gearman_connection_list_free(gearmand_connection_list_st *gearman); + +/* + Get next connection that is ready for I/O. +*/ +GEARMAN_INTERNAL_API +gearman_server_con_st *gearmand_ready(gearmand_connection_list_st *gearman); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/constants.h gearmand-0.23/libgearman-server/constants.h --- gearmand-0.14/libgearman-server/constants.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/constants.h 2011-06-03 04:13:30.000000000 +0200 @@ -11,11 +11,12 @@ * @brief Defines, typedefs, and enums */ -#ifndef __GEARMAN_SERVER_CONSTANTS_H__ -#define __GEARMAN_SERVER_CONSTANTS_H__ +#pragma once #ifdef __cplusplus -extern "C" { +#include +#else +#include #endif /** @@ -25,86 +26,154 @@ */ /* Defines. */ +#define GEARMAN_ARGS_BUFFER_SIZE 128 +#define GEARMAN_CONF_DISPLAY_WIDTH 80 +#define GEARMAN_CONF_MAX_OPTION_SHORT 128 #define GEARMAN_DEFAULT_BACKLOG 64 #define GEARMAN_DEFAULT_MAX_QUEUE_SIZE 0 -#define GEARMAN_SERVER_CON_ID_SIZE 128 -#define GEARMAN_JOB_HASH_SIZE 383 +#define GEARMAN_DEFAULT_SOCKET_RECV_SIZE 32768 +#define GEARMAN_DEFAULT_SOCKET_SEND_SIZE 32768 +#define GEARMAN_DEFAULT_SOCKET_TIMEOUT 10 +#define GEARMAND_JOB_HANDLE_SIZE 64 +#define GEARMAND_JOB_HASH_SIZE 383 +#define GEARMAN_MAX_COMMAND_ARGS 8 +#define GEARMAN_MAX_ERROR_SIZE 2048 +#define GEARMAN_MAX_FREE_SERVER_CLIENT 1000 #define GEARMAN_MAX_FREE_SERVER_CON 1000 -#define GEARMAN_MAX_FREE_SERVER_PACKET 2000 #define GEARMAN_MAX_FREE_SERVER_JOB 1000 -#define GEARMAN_MAX_FREE_SERVER_CLIENT 1000 +#define GEARMAN_MAX_FREE_SERVER_PACKET 2000 #define GEARMAN_MAX_FREE_SERVER_WORKER 1000 -#define GEARMAN_TEXT_RESPONSE_SIZE 8192 +#define GEARMAN_OPTION_SIZE 64 +#define GEARMAN_PACKET_HEADER_SIZE 12 #define GEARMAN_PIPE_BUFFER_SIZE 256 -#define GEARMAN_CONF_MAX_OPTION_SHORT 128 -#define GEARMAN_CONF_DISPLAY_WIDTH 80 +#define GEARMAN_RECV_BUFFER_SIZE 8192 +#define GEARMAN_SEND_BUFFER_SIZE 8192 +#define GEARMAN_SERVER_CON_ID_SIZE 128 +#define GEARMAN_TEXT_RESPONSE_SIZE 8192 +#define GEARMAN_UNIQUE_SIZE 64 /** @} */ /** - * @ingroup gearmand - * Wakeup events for gearmand_st. + * @ingroup gearman_job + * Priority levels for a job. */ typedef enum { - GEARMAND_WAKEUP_PAUSE, - GEARMAND_WAKEUP_SHUTDOWN, - GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL, - GEARMAND_WAKEUP_CON, - GEARMAND_WAKEUP_RUN -} gearmand_wakeup_t; - + GEARMAND_JOB_PRIORITY_HIGH, + GEARMAND_JOB_PRIORITY_NORMAL, + GEARMAND_JOB_PRIORITY_LOW, + GEARMAND_JOB_PRIORITY_MAX /* Always add new commands before this. */ +} gearmand_job_priority_t; /** - * @addtogroup gearman_server_types Types - * @ingroup gearman_server - * @{ + * Verbosity levels. */ +typedef enum +{ + GEARMAND_VERBOSE_NEVER, + GEARMAND_VERBOSE_FATAL, + GEARMAND_VERBOSE_ERROR, + GEARMAND_VERBOSE_INFO, + GEARMAND_VERBOSE_DEBUG, + GEARMAND_VERBOSE_CRAZY, + GEARMAND_VERBOSE_MAX +} gearmand_verbose_t; -/* Types. */ -typedef struct gearman_server_st gearman_server_st; -typedef struct gearman_server_thread_st gearman_server_thread_st; +/** @} */ + +typedef enum +{ + GEARMAND_CON_READY, + GEARMAND_CON_PACKET_IN_USE, + GEARMAND_CON_EXTERNAL_FD, + GEARMAND_CON_CLOSE_AFTER_FLUSH, + GEARMAND_CON_MAX +} gearmand_connection_options_t; + + +#ifdef __cplusplus + +struct gearman_server_thread_st; +struct gearman_server_st; +struct gearman_server_con_st; +struct gearmand_io_st; + +#else /* Types. */ + +typedef struct gearman_server_client_st gearman_server_client_st; typedef struct gearman_server_con_st gearman_server_con_st; -typedef struct gearman_server_packet_st gearman_server_packet_st; typedef struct gearman_server_function_st gearman_server_function_st; -typedef struct gearman_server_client_st gearman_server_client_st; -typedef struct gearman_server_worker_st gearman_server_worker_st; typedef struct gearman_server_job_st gearman_server_job_st; -typedef struct gearmand_st gearmand_st; -typedef struct gearmand_port_st gearmand_port_st; +typedef struct gearman_server_packet_st gearman_server_packet_st; +typedef struct gearman_server_st gearman_server_st; +typedef struct gearman_server_thread_st gearman_server_thread_st; +typedef struct gearman_server_worker_st gearman_server_worker_st; typedef struct gearmand_con_st gearmand_con_st; +typedef struct gearmand_io_st gearmand_io_st; +typedef struct gearmand_port_st gearmand_port_st; +typedef struct gearmand_st gearmand_st; typedef struct gearmand_thread_st gearmand_thread_st; -typedef struct gearman_conf_st gearman_conf_st; -typedef struct gearman_conf_option_st gearman_conf_option_st; -typedef struct gearman_conf_module_st gearman_conf_module_st; + +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* Function types. */ typedef void (gearman_server_thread_run_fn)(gearman_server_thread_st *thread, void *context); -typedef gearman_return_t (gearman_queue_add_fn)(gearman_server_st *server, +typedef gearmand_error_t (gearman_queue_add_fn)(gearman_server_st *server, void *context, - const void *unique, + const char *unique, size_t unique_size, - const void *function_name, + const char *function_name, size_t function_name_size, const void *data, size_t data_size, - gearman_job_priority_t priority); -typedef gearman_return_t (gearman_queue_flush_fn)(gearman_server_st *server, - void *context); -typedef gearman_return_t (gearman_queue_done_fn)(gearman_server_st *server, + gearmand_job_priority_t priority, + int64_t when); + +typedef gearmand_error_t (gearman_queue_flush_fn)(gearman_server_st *server, + void *context); + +typedef gearmand_error_t (gearman_queue_done_fn)(gearman_server_st *server, void *context, - const void *unique, + const char *unique, size_t unique_size, - const void *function_name, + const char *function_name, size_t function_name_size); -typedef gearman_return_t (gearman_queue_replay_fn)(gearman_server_st *server, +typedef gearmand_error_t (gearman_queue_replay_fn)(gearman_server_st *server, void *context, gearman_queue_add_fn *add_fn, void *add_context); -typedef gearman_return_t (gearman_connection_add_fn)(gearman_connection_st *con); +typedef gearmand_error_t (gearmand_connection_add_fn)(gearman_server_con_st *con); + +typedef void (gearman_log_server_fn)(const char *line, gearmand_verbose_t verbose, + struct gearmand_thread_st *context); + +typedef gearmand_error_t (gearmand_event_watch_fn)(gearmand_io_st *con, + short events, void *context); + +typedef struct gearmand_packet_st gearmand_packet_st; + +typedef size_t (gearmand_packet_pack_fn)(const gearmand_packet_st *packet, + gearman_server_con_st *con, + void *data, size_t data_size, + gearmand_error_t *ret_ptr); +typedef size_t (gearmand_packet_unpack_fn)(gearmand_packet_st *packet, + gearman_server_con_st *con, const void *data, + size_t data_size, + gearmand_error_t *ret_ptr); +typedef void (gearmand_connection_protocol_context_free_fn)(gearman_server_con_st *con, + void *context); + +typedef void (gearmand_log_fn)(const char *line, gearmand_verbose_t verbose, + void *context); + /** @} */ @@ -121,5 +190,3 @@ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_SERVER_CONSTANTS_H__ */ diff -Nru gearmand-0.14/libgearman-server/error/include.am gearmand-0.23/libgearman-server/error/include.am --- gearmand-0.14/libgearman-server/error/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/error/include.am 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,11 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential + +libgearman_server_libgearman_server_la_SOURCES+= \ + libgearman-server/error/strerror.cc + +noinst_HEADERS+= \ + libgearman-server/error.h \ + libgearman-server/error/strerror.h \ + libgearman-server/error/type.h diff -Nru gearmand-0.14/libgearman-server/error/strerror.cc gearmand-0.23/libgearman-server/error/strerror.cc --- gearmand-0.14/libgearman-server/error/strerror.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/error/strerror.cc 2011-03-08 07:00:29.000000000 +0100 @@ -0,0 +1,123 @@ +/* Gearman server and library + * Copyright (C) 2010 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief gearman_strerror() + */ + +#include +#include + +const char *gearmand_strerror(gearmand_error_t rc) +{ + switch (rc) + { + case GEARMAN_SUCCESS: + return "SUCCESS"; + case GEARMAN_IO_WAIT: + return "IO_WAIT"; + case GEARMAN_SHUTDOWN: + return "SHUTDOWN"; + case GEARMAN_SHUTDOWN_GRACEFUL: + return "SHUTDOWN_GRACEFUL"; + case GEARMAN_ERRNO: + return "ERRNO"; + case GEARMAN_EVENT: + return "EVENT"; + case GEARMAN_TOO_MANY_ARGS: + return "TOO_MANY_ARGS"; + case GEARMAN_NO_ACTIVE_FDS: + return "NO_ACTIVE_FDS"; + case GEARMAN_INVALID_MAGIC: + return "INVALID_MAGIC"; + case GEARMAN_INVALID_COMMAND: + return "INVALID_COMMAND"; + case GEARMAN_INVALID_PACKET: + return "INVALID_PACKET"; + case GEARMAN_UNEXPECTED_PACKET: + return "UNEXPECTED_PACKET"; + case GEARMAN_GETADDRINFO: + return "GETADDRINFO"; + case GEARMAN_NO_SERVERS: + return "NO_SERVERS"; + case GEARMAN_LOST_CONNECTION: + return "LOST_CONNECTION"; + case GEARMAN_MEMORY_ALLOCATION_FAILURE: + return "MEMORY_ALLOCATION_FAILURE"; + case GEARMAN_JOB_EXISTS: + return "JOB_EXISTS"; + case GEARMAN_JOB_QUEUE_FULL: + return "JOB_JOB_QUEUE_FULL"; + case GEARMAN_SERVER_ERROR: + return "SERVER_ERROR"; + case GEARMAN_WORK_ERROR: + return "WORK_ERROR"; + case GEARMAN_WORK_DATA: + return "WORK_DATA"; + case GEARMAN_WORK_WARNING: + return "WORK_WARNING"; + case GEARMAN_WORK_STATUS: + return "WORK_STATUS"; + case GEARMAN_WORK_EXCEPTION: + return "WORK_EXCEPTION"; + case GEARMAN_WORK_FAIL: + return "WORK_FAIL"; + case GEARMAN_NOT_CONNECTED: + return "NOT_CONNECTED"; + case GEARMAN_COULD_NOT_CONNECT: + return "COULD_NOT_CONNECT"; + case GEARMAN_SEND_IN_PROGRESS: + return "SEND_IN_PROGRESS"; + case GEARMAN_RECV_IN_PROGRESS: + return "RECV_IN_PROGRESS"; + case GEARMAN_NOT_FLUSHING: + return "NOT_FLUSHING"; + case GEARMAN_DATA_TOO_LARGE: + return "DATA_TOO_LARGE"; + case GEARMAN_INVALID_FUNCTION_NAME: + return "INVALID_FUNCTION_NAME"; + case GEARMAN_INVALID_WORKER_FUNCTION: + return "INVALID_WORKER_FUNCTION"; + case GEARMAN_NO_REGISTERED_FUNCTION: + return "NO_REGISTERED_FUNCTION"; + case GEARMAN_NO_REGISTERED_FUNCTIONS: + return "NO_REGISTERED_FUNCTIONS"; + case GEARMAN_NO_JOBS: + return "NO_JOBS"; + case GEARMAN_ECHO_DATA_CORRUPTION: + return "ECHO_DATA_CORRUPTION"; + case GEARMAN_NEED_WORKLOAD_FN: + return "NEED_WORKLOAD_FN"; + case GEARMAN_PAUSE: + return "PAUSE"; + case GEARMAN_UNKNOWN_STATE: + return "UNKNOWN_STATE"; + case GEARMAN_PTHREAD: + return "PTHREAD"; + case GEARMAN_PIPE_EOF: + return "PIPE_EOF"; + case GEARMAN_QUEUE_ERROR: + return "QUEUE_ERROR"; + case GEARMAN_FLUSH_DATA: + return "FLUSH_DATA"; + case GEARMAN_SEND_BUFFER_TOO_SMALL: + return "SEND_BUFFER_TOO_SMALL"; + case GEARMAN_IGNORE_PACKET: + return "IGNORE_PACKET"; + case GEARMAN_UNKNOWN_OPTION: + return "UNKNOWN_OPTION"; + case GEARMAN_TIMEOUT: + return "TIMEOUT"; + case GEARMAN_ARGUMENT_TOO_LARGE: + return "The argument was too large for Gearman to handle."; + case GEARMAN_MAX_RETURN: + default: + return "Gibberish returned!"; + } +} diff -Nru gearmand-0.14/libgearman-server/error/strerror.h gearmand-0.23/libgearman-server/error/strerror.h --- gearmand-0.14/libgearman-server/error/strerror.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/error/strerror.h 2011-03-08 21:55:27.000000000 +0100 @@ -0,0 +1,23 @@ +/* Gearman server and library + * Copyright (C) 2011 Data Differential + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_API +const char *gearmand_strerror(gearmand_error_t rc); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/error/type.h gearmand-0.23/libgearman-server/error/type.h --- gearmand-0.14/libgearman-server/error/type.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/error/type.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,99 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +/** + * Error codes. + */ +typedef enum +{ + GEARMAN_SUCCESS, + GEARMAN_IO_WAIT, + GEARMAN_SHUTDOWN, + GEARMAN_SHUTDOWN_GRACEFUL, + GEARMAN_ERRNO, + GEARMAN_EVENT, + GEARMAN_TOO_MANY_ARGS, + GEARMAN_NO_ACTIVE_FDS, + GEARMAN_INVALID_MAGIC, + GEARMAN_INVALID_COMMAND, + GEARMAN_INVALID_PACKET, + GEARMAN_UNEXPECTED_PACKET, + GEARMAN_GETADDRINFO, + GEARMAN_NO_SERVERS, + GEARMAN_LOST_CONNECTION, // Valid for worker return + GEARMAN_MEMORY_ALLOCATION_FAILURE, + GEARMAN_JOB_EXISTS, + GEARMAN_JOB_QUEUE_FULL, + GEARMAN_SERVER_ERROR, + GEARMAN_WORK_ERROR, + GEARMAN_WORK_DATA, + GEARMAN_WORK_WARNING, + GEARMAN_WORK_STATUS, + GEARMAN_WORK_EXCEPTION, + GEARMAN_WORK_FAIL, + GEARMAN_NOT_CONNECTED, + GEARMAN_COULD_NOT_CONNECT, + GEARMAN_SEND_IN_PROGRESS, + GEARMAN_RECV_IN_PROGRESS, + GEARMAN_NOT_FLUSHING, + GEARMAN_DATA_TOO_LARGE, + GEARMAN_INVALID_FUNCTION_NAME, + GEARMAN_INVALID_WORKER_FUNCTION, + GEARMAN_NO_REGISTERED_FUNCTION, + GEARMAN_NO_REGISTERED_FUNCTIONS, + GEARMAN_NO_JOBS, + GEARMAN_ECHO_DATA_CORRUPTION, + GEARMAN_NEED_WORKLOAD_FN, + GEARMAN_PAUSE, + GEARMAN_UNKNOWN_STATE, + GEARMAN_PTHREAD, + GEARMAN_PIPE_EOF, + GEARMAN_QUEUE_ERROR, + GEARMAN_FLUSH_DATA, + GEARMAN_SEND_BUFFER_TOO_SMALL, + GEARMAN_IGNORE_PACKET, + GEARMAN_UNKNOWN_OPTION, + GEARMAN_TIMEOUT, + GEARMAN_ARGUMENT_TOO_LARGE, + GEARMAN_MAX_RETURN /* Always add new error code before */ +} gearmand_error_t; + +#define gearmand_success(X) ((X) == GEARMAN_SUCCESS) +#define gearmand_failed(X) ((X) != GEARMAN_SUCCESS) diff -Nru gearmand-0.14/libgearman-server/error.h gearmand-0.23/libgearman-server/error.h --- gearmand-0.14/libgearman-server/error.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/error.h 2011-03-15 00:38:19.000000000 +0100 @@ -0,0 +1,41 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include diff -Nru gearmand-0.14/libgearman-server/fifo.c gearmand-0.23/libgearman-server/fifo.c --- gearmand-0.14/libgearman-server/fifo.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/fifo.c 2011-03-30 19:34:07.000000000 +0200 @@ -0,0 +1,65 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +void gearmand_server_con_fifo_add(gearman_server_con_st *con, + gearman_server_packet_st *server_packet) +{ + GEARMAN_FIFO_ADD(con->io_packet, server_packet,); +} + +void gearmand_server_con_fifo_free(gearman_server_con_st *con, + gearman_server_packet_st *server_packet) +{ + GEARMAN_FIFO_DEL(con->io_packet, server_packet,); +} + +void gearmand_server_con_fifo_proc_add(gearman_server_con_st *con, + gearman_server_packet_st *packet) +{ + GEARMAN_FIFO_ADD(con->proc_packet, packet,); +} + +void gearmand_server_con_fifo_proc_free(gearman_server_con_st *con, + gearman_server_packet_st *packet) +{ + GEARMAN_FIFO_DEL(con->proc_packet, packet,); +} diff -Nru gearmand-0.14/libgearman-server/fifo.h gearmand-0.23/libgearman-server/fifo.h --- gearmand-0.14/libgearman-server/fifo.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/fifo.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,62 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_INTERNAL_API +void gearmand_server_con_fifo_add(gearman_server_con_st *con, + gearman_server_packet_st *server_packet); + +GEARMAN_INTERNAL_API +void gearmand_server_con_fifo_free(gearman_server_con_st *con, + gearman_server_packet_st *server_packet); + +GEARMAN_INTERNAL_API + void gearmand_server_con_fifo_proc_add(gearman_server_con_st *con, + gearman_server_packet_st *packet); + +GEARMAN_INTERNAL_API + void gearmand_server_con_fifo_proc_free(gearman_server_con_st *con, + gearman_server_packet_st *server_packet); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/function.c gearmand-0.23/libgearman-server/function.c --- gearmand-0.14/libgearman-server/function.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/function.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,99 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Server function definitions - */ - -#include "common.h" - -/* - * Public definitions - */ - -gearman_server_function_st * -gearman_server_function_get(gearman_server_st *server, - const char *function_name, - size_t function_name_size) -{ - gearman_server_function_st *function; - - for (function= server->function_list; function != NULL; - function= function->next) - { - if (function->function_name_size == function_name_size && - !memcmp(function->function_name, function_name, function_name_size)) - { - return function; - } - } - - function= gearman_server_function_create(server, NULL); - if (function == NULL) - return NULL; - - function->function_name= (char *)malloc(function_name_size + 1); - if (function->function_name == NULL) - { - gearman_server_function_free(function); - return NULL; - } - - memcpy(function->function_name, function_name, function_name_size); - function->function_name[function_name_size]= 0; - function->function_name_size= function_name_size; - - return function; -} - -gearman_server_function_st * -gearman_server_function_create(gearman_server_st *server, - gearman_server_function_st *function) -{ - if (function == NULL) - { - function= (gearman_server_function_st *)malloc(sizeof(gearman_server_function_st)); - if (function == NULL) - return NULL; - - function->options.allocated= true; - } - else - { - function->options.allocated= false; - } - - function->worker_count= 0; - function->job_count= 0; - function->job_total= 0; - function->job_running= 0; - function->max_queue_size= GEARMAN_DEFAULT_MAX_QUEUE_SIZE; - function->function_name_size= 0; - function->server= server; - GEARMAN_LIST_ADD(server->function, function,) - function->function_name= NULL; - function->worker_list= NULL; - memset(function->job_list, 0, - sizeof(gearman_server_job_st *) * GEARMAN_JOB_PRIORITY_MAX); - memset(function->job_end, 0, - sizeof(gearman_server_job_st *) * GEARMAN_JOB_PRIORITY_MAX); - - return function; -} - -void gearman_server_function_free(gearman_server_function_st *function) -{ - if (function->function_name != NULL) - free(function->function_name); - - GEARMAN_LIST_DEL(function->server->function, function,) - - if (function->options.allocated) - free(function); -} diff -Nru gearmand-0.14/libgearman-server/function.cc gearmand-0.23/libgearman-server/function.cc --- gearmand-0.14/libgearman-server/function.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/function.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,106 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Server function definitions + */ + +#include +#include + +#include + +/* + * Public definitions + */ + +static gearman_server_function_st * gearman_server_function_create(gearman_server_st *server); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +gearman_server_function_st * +gearman_server_function_get(gearman_server_st *server, + const char *function_name, + size_t function_name_size) +{ + gearman_server_function_st *function; + + for (function= server->function_list; function != NULL; + function= function->next) + { + if (function->function_name_size == function_name_size && + !memcmp(function->function_name, function_name, function_name_size)) + { + return function; + } + } + + function= gearman_server_function_create(server); + if (not function) + return NULL; + + function->function_name= (char *)malloc(function_name_size +1); + if (not function->function_name) + { + gearmand_merror("malloc", char, function_name_size +1); + gearman_server_function_free(server, function); + return NULL; + } + + memcpy(function->function_name, function_name, function_name_size); + function->function_name[function_name_size]= 0; + function->function_name_size= function_name_size; + + return function; +} + +static gearman_server_function_st * gearman_server_function_create(gearman_server_st *server) +{ + gearman_server_function_st *function; + + function= (gearman_server_function_st *)malloc(sizeof(gearman_server_function_st)); + + if (function == NULL) + { + gearmand_merror("malloc", gearman_server_function_st, 0); + return NULL; + } + + function->worker_count= 0; + function->job_count= 0; + function->job_total= 0; + function->job_running= 0; + function->max_queue_size= GEARMAN_DEFAULT_MAX_QUEUE_SIZE; + function->function_name_size= 0; + gearmand_server_list_add(server, function); + function->function_name= NULL; + function->worker_list= NULL; + memset(function->job_list, 0, + sizeof(gearman_server_job_st *) * GEARMAND_JOB_PRIORITY_MAX); + memset(function->job_end, 0, + sizeof(gearman_server_job_st *) * GEARMAND_JOB_PRIORITY_MAX); + + return function; +} + +void gearman_server_function_free(gearman_server_st *server, gearman_server_function_st *function) +{ + if (function->function_name != NULL) + { + gearmand_crazy("free"); + free(function->function_name); + } + + gearmand_server_list_free(server, function); + + gearmand_crazy("free"); + free(function); +} diff -Nru gearmand-0.14/libgearman-server/function.h gearmand-0.23/libgearman-server/function.h --- gearmand-0.14/libgearman-server/function.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/function.h 2011-06-03 04:13:30.000000000 +0200 @@ -11,8 +11,7 @@ * @brief Function Declarations */ -#ifndef __GEARMAN_SERVER_FUNCTION_H__ -#define __GEARMAN_SERVER_FUNCTION_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -33,22 +32,18 @@ */ struct gearman_server_function_st { - struct { - bool allocated; - } options; uint32_t worker_count; uint32_t job_count; uint32_t job_total; uint32_t job_running; uint32_t max_queue_size; size_t function_name_size; - gearman_server_st *server; gearman_server_function_st *next; gearman_server_function_st *prev; char *function_name; gearman_server_worker_st *worker_list; - gearman_server_job_st *job_list[GEARMAN_JOB_PRIORITY_MAX]; - gearman_server_job_st *job_end[GEARMAN_JOB_PRIORITY_MAX]; + struct gearman_server_job_st *job_list[GEARMAND_JOB_PRIORITY_MAX]; + gearman_server_job_st *job_end[GEARMAND_JOB_PRIORITY_MAX]; }; /** @@ -61,23 +56,13 @@ size_t function_name_size); /** - * Initialize a server function structure. - */ -GEARMAN_API -gearman_server_function_st * -gearman_server_function_create(gearman_server_st *server, - gearman_server_function_st *function); - -/** * Free a server function structure. */ GEARMAN_API -void gearman_server_function_free(gearman_server_function_st *function); +void gearman_server_function_free(gearman_server_st *server, gearman_server_function_st *function); /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_SERVER_FUNCTION_H__ */ diff -Nru gearmand-0.14/libgearman-server/gearmand.c gearmand-0.23/libgearman-server/gearmand.c --- gearmand-0.14/libgearman-server/gearmand.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/gearmand.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,725 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearmand Definitions - */ - -#include "common.h" -#include "gearmand.h" - -/* - * Private declarations - */ - -/** - * @addtogroup gearmand_private Private Gearman Daemon Functions - * @ingroup gearmand - * @{ - */ - -static void _log(const char *line, gearman_verbose_t verbose, void *context); - -static gearman_return_t _listen_init(gearmand_st *gearmand); -static void _listen_close(gearmand_st *gearmand); -static gearman_return_t _listen_watch(gearmand_st *gearmand); -static void _listen_clear(gearmand_st *gearmand); -static void _listen_event(int fd, short events, void *arg); - -static gearman_return_t _wakeup_init(gearmand_st *gearmand); -static void _wakeup_close(gearmand_st *gearmand); -static gearman_return_t _wakeup_watch(gearmand_st *gearmand); -static void _wakeup_clear(gearmand_st *gearmand); -static void _wakeup_event(int fd, short events, void *arg); - -static gearman_return_t _watch_events(gearmand_st *gearmand); -static void _clear_events(gearmand_st *gearmand); -static void _close_events(gearmand_st *gearmand); - -/** @} */ - -/* - * Public definitions - */ - -gearmand_st *gearmand_create(const char *host, in_port_t port) -{ - gearmand_st *gearmand; - - gearmand= (gearmand_st *)malloc(sizeof(gearmand_st)); - if (gearmand == NULL) - return NULL; - - if (gearman_server_create(&(gearmand->server)) == NULL) - { - free(gearmand); - return NULL; - } - - gearmand->is_listen_event= false; - gearmand->is_wakeup_event= false; - gearmand->verbose= 0; - gearmand->ret= 0; - gearmand->backlog= GEARMAN_DEFAULT_BACKLOG; - gearmand->threads= 0; - gearmand->port_count= 0; - gearmand->thread_count= 0; - gearmand->free_dcon_count= 0; - gearmand->max_thread_free_dcon_count= 0; - gearmand->wakeup_fd[0]= -1; - gearmand->wakeup_fd[1]= -1; - gearmand->host= host; - gearmand->log_fn= NULL; - gearmand->log_context= NULL; - gearmand->base= NULL; - gearmand->port_list= NULL; - gearmand->thread_list= NULL; - gearmand->thread_add_next= NULL; - gearmand->free_dcon_list= NULL; - - if (port == 0) - port= GEARMAN_DEFAULT_TCP_PORT; - - if (gearmand_port_add(gearmand, port, NULL) != GEARMAN_SUCCESS) - { - gearmand_free(gearmand); - return NULL; - } - - return gearmand; -} - -void gearmand_free(gearmand_st *gearmand) -{ - gearmand_con_st *dcon; - uint32_t x; - - _close_events(gearmand); - - if (gearmand->threads > 0) - gearmand_log_info(gearmand, "Shutting down all threads"); - - while (gearmand->thread_list != NULL) - gearmand_thread_free(gearmand->thread_list); - - while (gearmand->free_dcon_list != NULL) - { - dcon= gearmand->free_dcon_list; - gearmand->free_dcon_list= dcon->next; - free(dcon); - } - - if (gearmand->base != NULL) - event_base_free(gearmand->base); - - gearman_server_free(&(gearmand->server)); - - for (x= 0; x < gearmand->port_count; x++) - { - if (gearmand->port_list[x].listen_fd != NULL) - free(gearmand->port_list[x].listen_fd); - - if (gearmand->port_list[x].listen_event != NULL) - free(gearmand->port_list[x].listen_event); - } - - if (gearmand->port_list != NULL) - free(gearmand->port_list); - - gearmand_log_info(gearmand, "Shutdown complete"); - - free(gearmand); -} - -void gearmand_set_backlog(gearmand_st *gearmand, int backlog) -{ - gearmand->backlog= backlog; -} - -void gearmand_set_job_retries(gearmand_st *gearmand, uint8_t job_retries) -{ - gearman_server_set_job_retries(&(gearmand->server), job_retries); -} - -void gearmand_set_worker_wakeup(gearmand_st *gearmand, uint8_t worker_wakeup) -{ - gearman_server_set_worker_wakeup(&(gearmand->server), worker_wakeup); -} - -void gearmand_set_threads(gearmand_st *gearmand, uint32_t threads) -{ - gearmand->threads= threads; -} - -void gearmand_set_log_fn(gearmand_st *gearmand, gearman_log_fn *function, - void *context, gearman_verbose_t verbose) -{ - gearman_server_set_log_fn(&(gearmand->server), _log, gearmand, verbose); - gearmand->log_fn= function; - gearmand->log_context= context; - gearmand->verbose= verbose; -} - -gearman_return_t gearmand_port_add(gearmand_st *gearmand, in_port_t port, - gearman_connection_add_fn *function) -{ - gearmand_port_st *port_list; - - port_list= (gearmand_port_st *)realloc(gearmand->port_list, - sizeof(gearmand_port_st) * (gearmand->port_count + 1)); - if (port_list == NULL) - { - gearmand_log_fatal(gearmand, "gearmand_port_add:realloc:NULL"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - port_list[gearmand->port_count].port= port; - port_list[gearmand->port_count].listen_count= 0; - port_list[gearmand->port_count].gearmand= gearmand; - port_list[gearmand->port_count].add_fn= function; - port_list[gearmand->port_count].listen_fd= NULL; - port_list[gearmand->port_count].listen_event= NULL; - - gearmand->port_list= port_list; - gearmand->port_count++; - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearmand_run(gearmand_st *gearmand) -{ - uint32_t x; - - /* Initialize server components. */ - if (gearmand->base == NULL) - { - gearmand_log_info(gearmand, "Starting up"); - - if (gearmand->threads > 0) - { -#ifndef HAVE_EVENT_BASE_NEW - gearmand_log_fatal(gearmand, "Multi-threaded gearmand requires libevent 1.4 or later, libevent 1.3 does not provided a " - "thread-safe interface."); - return GEARMAN_EVENT; -#else - /* Set the number of free connection structures each thread should keep - around before the main thread is forced to take them. We compute this - here so we don't need to on every new connection. */ - gearmand->max_thread_free_dcon_count= ((GEARMAN_MAX_FREE_SERVER_CON / - gearmand->threads) / 2); -#endif - } - - gearmand_log_debug(gearmand, "Initializing libevent for main thread"); - - gearmand->base= event_base_new(); - if (gearmand->base == NULL) - { - gearmand_log_fatal(gearmand, "gearmand_run:event_base_new:NULL"); - return GEARMAN_EVENT; - } - - gearmand_log_debug(gearmand, "Method for libevent: %s", - event_base_get_method(gearmand->base)); - - gearmand->ret= _listen_init(gearmand); - if (gearmand->ret != GEARMAN_SUCCESS) - return gearmand->ret; - - gearmand->ret= _wakeup_init(gearmand); - if (gearmand->ret != GEARMAN_SUCCESS) - return gearmand->ret; - - gearmand_log_debug(gearmand, "Creating %u threads", gearmand->threads); - - /* If we have 0 threads we still need to create a fake one for context. */ - x= 0; - do - { - gearmand->ret= gearmand_thread_create(gearmand); - if (gearmand->ret != GEARMAN_SUCCESS) - return gearmand->ret; - x++; - } - while (x < gearmand->threads); - - gearmand->ret= gearman_server_queue_replay(&(gearmand->server)); - if (gearmand->ret != GEARMAN_SUCCESS) - return gearmand->ret; - } - - gearmand->ret= _watch_events(gearmand); - if (gearmand->ret != GEARMAN_SUCCESS) - return gearmand->ret; - - gearmand_log_info(gearmand, "Entering main event loop"); - - if (event_base_loop(gearmand->base, 0) == -1) - { - gearmand_log_fatal(gearmand, "gearmand_run:event_base_loop:-1"); - return GEARMAN_EVENT; - } - - gearmand_log_info(gearmand, "Exited main event loop"); - - return gearmand->ret; -} - -void gearmand_wakeup(gearmand_st *gearmand, gearmand_wakeup_t wakeup) -{ - uint8_t buffer= wakeup; - - /* If this fails, there is not much we can really do. This should never fail - though if the main gearmand thread is still active. */ - if (write(gearmand->wakeup_fd[1], &buffer, 1) != 1) - gearmand_log_error(gearmand, "gearmand_wakeup:write:%d", errno); -} - -void gearmand_set_round_robin(gearmand_st *gearmand, bool round_robin) -{ - gearmand->server.flags.round_robin= round_robin; -} - - -/* - * Private definitions - */ - -static void _log(const char *line, gearman_verbose_t verbose, void *context) -{ - gearmand_st *gearmand= (gearmand_st *)context; - (*gearmand->log_fn)(line, verbose, (void *)gearmand->log_context); -} - -static gearman_return_t _listen_init(gearmand_st *gearmand) -{ - for (uint32_t x= 0; x < gearmand->port_count; x++) - { - int ret; - struct gearmand_port_st *port; - char port_str[NI_MAXSERV]; - struct addrinfo ai; - struct addrinfo *addrinfo; - - port= &gearmand->port_list[x]; - - snprintf(port_str, NI_MAXSERV, "%u", (uint32_t)(port->port)); - - memset(&ai, 0, sizeof(struct addrinfo)); - ai.ai_flags = AI_PASSIVE; - ai.ai_family = AF_UNSPEC; - ai.ai_socktype = SOCK_STREAM; - ai.ai_protocol= IPPROTO_TCP; - - ret= getaddrinfo(gearmand->host, port_str, &ai, &addrinfo); - if (ret != 0) - { - gearmand_log_fatal(gearmand, "_listen_init:getaddrinfo:%s", gai_strerror(ret)); - return GEARMAN_ERRNO; - } - - for (struct addrinfo *addrinfo_next= addrinfo; addrinfo_next != NULL; - addrinfo_next= addrinfo_next->ai_next) - { - int opt; - int fd; - char host[NI_MAXHOST]; - - ret= getnameinfo(addrinfo_next->ai_addr, addrinfo_next->ai_addrlen, host, - NI_MAXHOST, port_str, NI_MAXSERV, - NI_NUMERICHOST | NI_NUMERICSERV); - if (ret != 0) - { - gearmand_log_error(gearmand, "_listen_init:getnameinfo:%s", gai_strerror(ret)); - strcpy(host, "-"); - strcpy(port_str, "-"); - } - - gearmand_log_debug(gearmand, "Trying to listen on %s:%s", host, port_str); - - /* Call to socket() can fail for some getaddrinfo results, try another. */ - fd= socket(addrinfo_next->ai_family, addrinfo_next->ai_socktype, - addrinfo_next->ai_protocol); - if (fd == -1) - { - gearmand_log_error(gearmand, "Failed to listen on %s:%s", host, port_str); - continue; - } - - opt= 1; - ret= setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); - if (ret == -1) - { - close(fd); - gearmand_log_fatal(gearmand, "_listen_init:setsockopt:%d", errno); - return GEARMAN_ERRNO; - } - - ret= bind(fd, addrinfo_next->ai_addr, addrinfo_next->ai_addrlen); - if (ret == -1) - { - close(fd); - if (errno == EADDRINUSE) - { - if (port->listen_fd == NULL) - { - gearmand_log_error(gearmand, "Address already in use %s:%s", host, port_str); - } - - continue; - } - - gearmand_log_fatal(gearmand, "_listen_init:bind:%d", errno); - return GEARMAN_ERRNO; - } - - if (listen(fd, gearmand->backlog) == -1) - { - close(fd); - gearmand_log_fatal(gearmand, "_listen_init:listen:%d", errno); - return GEARMAN_ERRNO; - } - - // Scoping note for eventual transformation - { - int *fd_list; - - fd_list= (int *)realloc(port->listen_fd, sizeof(int) * (port->listen_count + 1)); - if (fd_list == NULL) - { - close(fd); - gearmand_log_fatal(gearmand, "_listen_init:realloc:%d", errno); - return GEARMAN_ERRNO; - } - - port->listen_fd= fd_list; - } - - port->listen_fd[port->listen_count]= fd; - port->listen_count++; - - gearmand_log_info(gearmand, "Listening on %s:%s (%d)", host, port_str, fd); - } - - freeaddrinfo(addrinfo); - - /* Report last socket() error if we couldn't find an address to bind. */ - if (port->listen_fd == NULL) - { - gearmand_log_fatal(gearmand, "_listen_init:Could not bind/listen to any addresses"); - return GEARMAN_ERRNO; - } - - port->listen_event= (struct event *)malloc(sizeof(struct event) * port->listen_count); - if (port->listen_event == NULL) - { - gearmand_log_fatal(gearmand, "_listen_init:malloc:%d", errno); - return GEARMAN_ERRNO; - } - - for (uint32_t y= 0; y < port->listen_count; y++) - { - event_set(&(port->listen_event[y]), port->listen_fd[y], - EV_READ | EV_PERSIST, _listen_event, port); - event_base_set(gearmand->base, &(port->listen_event[y])); - } - } - - return GEARMAN_SUCCESS; -} - -static void _listen_close(gearmand_st *gearmand) -{ - _listen_clear(gearmand); - - for (uint32_t x= 0; x < gearmand->port_count; x++) - { - for (uint32_t y= 0; y < gearmand->port_list[x].listen_count; y++) - { - if (gearmand->port_list[x].listen_fd[y] >= 0) - { - gearmand_log_info(gearmand, "Closing listening socket (%d)", gearmand->port_list[x].listen_fd[y]); - close(gearmand->port_list[x].listen_fd[y]); - gearmand->port_list[x].listen_fd[y]= -1; - } - } - } -} - -static gearman_return_t _listen_watch(gearmand_st *gearmand) -{ - if (gearmand->is_listen_event) - return GEARMAN_SUCCESS; - - for (uint32_t x= 0; x < gearmand->port_count; x++) - { - for (uint32_t y= 0; y < gearmand->port_list[x].listen_count; y++) - { - gearmand_log_info(gearmand, "Adding event for listening socket (%d)", - gearmand->port_list[x].listen_fd[y]); - - if (event_add(&(gearmand->port_list[x].listen_event[y]), NULL) == -1) - { - gearmand_log_fatal(gearmand, "_listen_watch:event_add:-1"); - return GEARMAN_EVENT; - } - } - } - - gearmand->is_listen_event= true; - return GEARMAN_SUCCESS; -} - -static void _listen_clear(gearmand_st *gearmand) -{ - if (! (gearmand->is_listen_event)) - return; - - int del_ret= 0; - for (uint32_t x= 0; x < gearmand->port_count; x++) - { - for (uint32_t y= 0; y < gearmand->port_list[x].listen_count; y++) - { - gearmand_log_info(gearmand, "Clearing event for listening socket (%d)", - gearmand->port_list[x].listen_fd[y]); - del_ret= event_del(&(gearmand->port_list[x].listen_event[y])); - assert(del_ret == 0); - } - } - - gearmand->is_listen_event= false; -} - -static void _listen_event(int fd, short events __attribute__ ((unused)), - void *arg) -{ - gearmand_port_st *port= (gearmand_port_st *)arg; - struct sockaddr sa; - socklen_t sa_len; - char host[NI_MAXHOST]; - char port_str[NI_MAXSERV]; - int ret; - - sa_len= sizeof(sa); - fd= accept(fd, &sa, &sa_len); - if (fd == -1) - { - if (errno == EINTR) - return; - else if (errno == EMFILE) - { - gearmand_log_error(port->gearmand, "_listen_event:accept:too many open files"); - return; - } - - _clear_events(port->gearmand); - gearmand_log_fatal(port->gearmand, "_listen_event:accept:%d", errno); - port->gearmand->ret= GEARMAN_ERRNO; - return; - } - - /* Since this is numeric, it should never fail. Even if it did we don't want - to really error from it. */ - ret= getnameinfo(&sa, sa_len, host, NI_MAXHOST, port_str, NI_MAXSERV, - NI_NUMERICHOST | NI_NUMERICSERV); - if (ret != 0) - { - gearmand_log_error(port->gearmand, "_listen_event:getnameinfo:%s", gai_strerror(ret)); - strcpy(host, "-"); - strcpy(port_str, "-"); - } - - gearmand_log_info(port->gearmand, "Accepted connection from %s:%s", host, port_str); - - port->gearmand->ret= gearmand_con_create(port->gearmand, fd, host, port_str, - port->add_fn); - if (port->gearmand->ret != GEARMAN_SUCCESS) - _clear_events(port->gearmand); -} - -static gearman_return_t _wakeup_init(gearmand_st *gearmand) -{ - int ret; - - gearmand_log_info(gearmand, "Creating wakeup pipe"); - - ret= pipe(gearmand->wakeup_fd); - if (ret == -1) - { - gearmand_log_fatal(gearmand, "_wakeup_init:pipe:%d", errno); - return GEARMAN_ERRNO; - } - - ret= fcntl(gearmand->wakeup_fd[0], F_GETFL, 0); - if (ret == -1) - { - gearmand_log_fatal(gearmand, "_wakeup_init:fcntl:F_GETFL:%d", errno); - return GEARMAN_ERRNO; - } - - ret= fcntl(gearmand->wakeup_fd[0], F_SETFL, ret | O_NONBLOCK); - if (ret == -1) - { - gearmand_log_fatal(gearmand, "_wakeup_init:fcntl:F_SETFL:%d", errno); - return GEARMAN_ERRNO; - } - - event_set(&(gearmand->wakeup_event), gearmand->wakeup_fd[0], - EV_READ | EV_PERSIST, _wakeup_event, gearmand); - event_base_set(gearmand->base, &(gearmand->wakeup_event)); - - return GEARMAN_SUCCESS; -} - -static void _wakeup_close(gearmand_st *gearmand) -{ - _wakeup_clear(gearmand); - - if (gearmand->wakeup_fd[0] >= 0) - { - gearmand_log_info(gearmand, "Closing wakeup pipe"); - close(gearmand->wakeup_fd[0]); - gearmand->wakeup_fd[0]= -1; - close(gearmand->wakeup_fd[1]); - gearmand->wakeup_fd[1]= -1; - } -} - -static gearman_return_t _wakeup_watch(gearmand_st *gearmand) -{ - if (gearmand->is_wakeup_event) - return GEARMAN_SUCCESS; - - gearmand_log_info(gearmand, "Adding event for wakeup pipe"); - - if (event_add(&(gearmand->wakeup_event), NULL) == -1) - { - gearmand_log_fatal(gearmand, "_wakeup_watch:event_add:-1"); - return GEARMAN_EVENT; - } - - gearmand->is_wakeup_event= true; - return GEARMAN_SUCCESS; -} - -static void _wakeup_clear(gearmand_st *gearmand) -{ - if (gearmand->is_wakeup_event) - { - gearmand_log_info(gearmand, "Clearing event for wakeup pipe"); - int del_ret= event_del(&(gearmand->wakeup_event)); - assert(del_ret == 0); - gearmand->is_wakeup_event= false; - } -} - -static void _wakeup_event(int fd, short events __attribute__ ((unused)), - void *arg) -{ - gearmand_st *gearmand= (gearmand_st *)arg; - uint8_t buffer[GEARMAN_PIPE_BUFFER_SIZE]; - ssize_t ret; - gearmand_thread_st *thread; - - while (1) - { - ret= read(fd, buffer, GEARMAN_PIPE_BUFFER_SIZE); - if (ret == 0) - { - _clear_events(gearmand); - gearmand_log_fatal(gearmand, "_wakeup_event:read:EOF"); - gearmand->ret= GEARMAN_PIPE_EOF; - return; - } - else if (ret == -1) - { - if (errno == EINTR) - continue; - - if (errno == EAGAIN) - break; - - _clear_events(gearmand); - gearmand_log_fatal(gearmand, "_wakeup_event:read:%d", errno); - gearmand->ret= GEARMAN_ERRNO; - return; - } - - for (ssize_t x= 0; x < ret; x++) - { - switch ((gearmand_wakeup_t)buffer[x]) - { - case GEARMAND_WAKEUP_PAUSE: - gearmand_log_info(gearmand, "Received PAUSE wakeup event"); - _clear_events(gearmand); - gearmand->ret= GEARMAN_PAUSE; - break; - - case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: - gearmand_log_info(gearmand, "Received SHUTDOWN_GRACEFUL wakeup event"); - _listen_close(gearmand); - - for (thread= gearmand->thread_list; thread != NULL; - thread= thread->next) - { - gearmand_thread_wakeup(thread, GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL); - } - - gearmand->ret= GEARMAN_SHUTDOWN_GRACEFUL; - break; - - case GEARMAND_WAKEUP_SHUTDOWN: - gearmand_log_info(gearmand, "Received SHUTDOWN wakeup event"); - _clear_events(gearmand); - gearmand->ret= GEARMAN_SHUTDOWN; - break; - - case GEARMAND_WAKEUP_CON: - case GEARMAND_WAKEUP_RUN: - default: - gearmand_log_fatal(gearmand, "Received unknown wakeup event (%u)", buffer[x]); - _clear_events(gearmand); - gearmand->ret= GEARMAN_UNKNOWN_STATE; - break; - } - } - } -} - -static gearman_return_t _watch_events(gearmand_st *gearmand) -{ - gearman_return_t ret; - - ret= _listen_watch(gearmand); - if (ret != GEARMAN_SUCCESS) - return ret; - - ret= _wakeup_watch(gearmand); - if (ret != GEARMAN_SUCCESS) - return ret; - - return GEARMAN_SUCCESS; -} - -static void _clear_events(gearmand_st *gearmand) -{ - _listen_clear(gearmand); - _wakeup_clear(gearmand); - - /* If we are not threaded, tell the fake thread to shutdown now to clear - connections. Otherwise we will never exit the libevent loop. */ - if (gearmand->threads == 0 && gearmand->thread_list != NULL) - gearmand_thread_wakeup(gearmand->thread_list, GEARMAND_WAKEUP_SHUTDOWN); -} - -static void _close_events(gearmand_st *gearmand) -{ - _listen_close(gearmand); - _wakeup_close(gearmand); -} diff -Nru gearmand-0.14/libgearman-server/gearmand.cc gearmand-0.23/libgearman-server/gearmand.cc --- gearmand-0.14/libgearman-server/gearmand.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/gearmand.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,1032 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Gearmand Definitions + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +using namespace gearmand; + +/* + * Private declarations + */ + +/** + * @addtogroup gearmand_private Private Gearman Daemon Functions + * @ingroup gearmand + * @{ + */ + +static gearmand_error_t _listen_init(gearmand_st *gearmand); +static void _listen_close(gearmand_st *gearmand); +static gearmand_error_t _listen_watch(gearmand_st *gearmand); +static void _listen_clear(gearmand_st *gearmand); +static void _listen_event(int fd, short events, void *arg); + +static gearmand_error_t _wakeup_init(gearmand_st *gearmand); +static void _wakeup_close(gearmand_st *gearmand); +static gearmand_error_t _wakeup_watch(gearmand_st *gearmand); +static void _wakeup_clear(gearmand_st *gearmand); +static void _wakeup_event(int fd, short events, void *arg); + +static gearmand_error_t _watch_events(gearmand_st *gearmand); +static void _clear_events(gearmand_st *gearmand); +static void _close_events(gearmand_st *gearmand); + +static bool gearman_server_create(gearman_server_st *server, + uint8_t job_retries, + uint8_t worker_wakeup, + bool round_robin); +static void gearman_server_free(gearman_server_st *server); +static void gearmand_set_log_fn(gearmand_st *gearmand, gearmand_log_fn *function, + void *context, const gearmand_verbose_t verbose); + +/** @} */ + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/* + * Public definitions + */ + +static gearmand_st *_global_gearmand= NULL; + +gearmand_st *Gearmand(void) +{ + if (!_global_gearmand) + { + gearmand_error("Gearmand() was called before it was allocated"); + assert(! "Gearmand() was called before it was allocated"); + } + assert(_global_gearmand); + return _global_gearmand; +} + +gearmand_st *gearmand_create(const char *host_arg, + const char *port, + uint32_t threads_arg, + int backlog_arg, + uint8_t job_retries, + uint8_t worker_wakeup, + gearmand_log_fn *log_function, void *log_context, const gearmand_verbose_t verbose_arg, + bool round_robin) +{ + gearmand_st *gearmand; + + assert(_global_gearmand == NULL); + + if (_global_gearmand) + { + gearmand_error("You have called gearmand_create() twice within your application."); + _exit(EXIT_FAILURE); + } + + gearmand= (gearmand_st *)malloc(sizeof(gearmand_st)); + if (gearmand == NULL) + { + gearmand_merror("malloc", gearmand_st, 0); + return NULL; + } + + if (! gearman_server_create(&(gearmand->server), job_retries, worker_wakeup, round_robin)) + { + gearmand_crazy("free"); + free(gearmand); + return NULL; + } + + gearmand->is_listen_event= false; + gearmand->is_wakeup_event= false; + gearmand->verbose= verbose_arg; + gearmand->timeout= -1; + gearmand->ret= GEARMAN_SUCCESS; + gearmand->backlog= backlog_arg; + gearmand->threads= threads_arg; + gearmand->port_count= 0; + gearmand->thread_count= 0; + gearmand->free_dcon_count= 0; + gearmand->max_thread_free_dcon_count= 0; + gearmand->wakeup_fd[0]= -1; + gearmand->wakeup_fd[1]= -1; + gearmand->host= host_arg; + gearmand->log_fn= NULL; + gearmand->log_context= NULL; + gearmand->base= NULL; + gearmand->port_list= NULL; + gearmand->thread_list= NULL; + gearmand->thread_add_next= NULL; + gearmand->free_dcon_list= NULL; + + gearmand_error_t rc; + if (port && port[0] == 0) + { + struct servent *gearman_servent= getservbyname(GEARMAN_DEFAULT_TCP_SERVICE, NULL); + + if (gearman_servent && gearman_servent->s_name) + { + rc= gearmand_port_add(gearmand, gearman_servent->s_name, NULL); + } + else + { + rc= gearmand_port_add(gearmand, GEARMAN_DEFAULT_TCP_PORT_STRING, NULL); + } + } + else + { + rc= gearmand_port_add(gearmand, port, NULL); + } + + if (rc != GEARMAN_SUCCESS) + { + gearmand_free(gearmand); + return NULL; + } + + _global_gearmand= gearmand; + + gearmand_set_log_fn(gearmand, log_function, log_context, verbose_arg); + + return gearmand; +} + +void gearmand_free(gearmand_st *gearmand) +{ + _close_events(gearmand); + + if (gearmand->threads > 0) + { + gearmand_info("Shutting down all threads"); + } + + while (gearmand->thread_list != NULL) + { + gearmand_thread_free(gearmand->thread_list); + } + + while (gearmand->free_dcon_list != NULL) + { + gearmand_con_st *dcon; + + dcon= gearmand->free_dcon_list; + gearmand->free_dcon_list= dcon->next; + gearmand_crazy("free"); + free(dcon); + } + + if (gearmand->base != NULL) + { + event_base_free(gearmand->base); + } + + gearman_server_free(&(gearmand->server)); + + for (uint32_t x= 0; x < gearmand->port_count; x++) + { + if (gearmand->port_list[x].listen_fd != NULL) + { + gearmand_crazy("free"); + free(gearmand->port_list[x].listen_fd); + } + + if (gearmand->port_list[x].listen_event != NULL) + { + gearmand_crazy("free"); + free(gearmand->port_list[x].listen_event); + } + } + + if (gearmand->port_list != NULL) + { + gearmand_crazy("free"); + free(gearmand->port_list); + } + + gearmand_info("Shutdown complete"); + + gearmand_crazy("free"); + free(gearmand); +} + +static void gearmand_set_log_fn(gearmand_st *gearmand, gearmand_log_fn *function, + void *context, const gearmand_verbose_t verbose) +{ + gearmand->log_fn= function; + gearmand->log_context= context; + gearmand->verbose= verbose; +} + +gearmand_error_t gearmand_port_add(gearmand_st *gearmand, const char *port, + gearmand_connection_add_fn *function) +{ + gearmand_port_st *port_list; + + port_list= (gearmand_port_st *)realloc(gearmand->port_list, + sizeof(gearmand_port_st) * (gearmand->port_count + 1)); + if (port_list == NULL) + { + gearmand_perror("realloc"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + strncpy(port_list[gearmand->port_count].port, port, NI_MAXSERV); + port_list[gearmand->port_count].listen_count= 0; + port_list[gearmand->port_count].add_fn= function; + port_list[gearmand->port_count].listen_fd= NULL; + port_list[gearmand->port_count].listen_event= NULL; + + gearmand->port_list= port_list; + gearmand->port_count++; + + return GEARMAN_SUCCESS; +} + +gearman_server_st *gearmand_server(gearmand_st *gearmand) +{ + return &gearmand->server; +} + +gearmand_error_t gearmand_run(gearmand_st *gearmand) +{ + uint32_t x; + + /* Initialize server components. */ + if (gearmand->base == NULL) + { + gearmand_info("Starting up"); + + if (gearmand->threads > 0) + { +#ifndef HAVE_EVENT_BASE_NEW + gearmand_fatal("Multi-threaded gearmand requires libevent 1.4 or later, libevent 1.3 does not provided a " + "thread-safe interface."); + return GEARMAN_EVENT; +#else + /* Set the number of free connection structures each thread should keep + around before the main thread is forced to take them. We compute this + here so we don't need to on every new connection. */ + gearmand->max_thread_free_dcon_count= ((GEARMAN_MAX_FREE_SERVER_CON / + gearmand->threads) / 2); +#endif + } + + gearmand_debug("Initializing libevent for main thread"); + + gearmand->base= static_cast(event_base_new()); + if (gearmand->base == NULL) + { + gearmand_fatal("event_base_new(NULL)"); + return GEARMAN_EVENT; + } + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Method for libevent: %s", event_base_get_method(gearmand->base)); + + gearmand->ret= _listen_init(gearmand); + if (gearmand->ret != GEARMAN_SUCCESS) + return gearmand->ret; + + gearmand->ret= _wakeup_init(gearmand); + if (gearmand->ret != GEARMAN_SUCCESS) + return gearmand->ret; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Creating %u threads", gearmand->threads); + + /* If we have 0 threads we still need to create a fake one for context. */ + x= 0; + do + { + gearmand->ret= gearmand_thread_create(gearmand); + if (gearmand->ret != GEARMAN_SUCCESS) + return gearmand->ret; + x++; + } + while (x < gearmand->threads); + + gearmand->ret= gearman_server_queue_replay(&(gearmand->server)); + if (gearmand->ret != GEARMAN_SUCCESS) + return gearmand->ret; + } + + gearmand->ret= _watch_events(gearmand); + if (gearmand->ret != GEARMAN_SUCCESS) + return gearmand->ret; + + gearmand_info("Entering main event loop"); + + if (event_base_loop(gearmand->base, 0) == -1) + { + gearmand_fatal("event_base_loop(-1)"); + return GEARMAN_EVENT; + } + + gearmand_info("Exited main event loop"); + + return gearmand->ret; +} + +void gearmand_wakeup(gearmand_st *gearmand, gearmand_wakeup_t wakeup) +{ + uint8_t buffer= wakeup; + + /* If this fails, there is not much we can really do. This should never fail + though if the main gearmand thread is still active. */ + ssize_t written; + if ((written= write(gearmand->wakeup_fd[1], &buffer, 1)) != 1) + { + if (written < 0) + { + gearmand_perror(gearmand_strwakeup(wakeup)); + } + else + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "gearmand_wakeup() incorrectly wrote %lu bytes of data.", (unsigned long)written); + } + } +} + + +/* + * Private definitions + */ + +static const uint32_t bind_timeout= 6; // Number is not special, but look at INFO messages if you decide to change it. + +static gearmand_error_t _listen_init(gearmand_st *gearmand) +{ + for (uint32_t x= 0; x < gearmand->port_count; x++) + { + int ret; + struct linger ling= {0, 0}; + struct gearmand_port_st *port; + struct addrinfo hints; + struct addrinfo *addrinfo; + + port= &gearmand->port_list[x]; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_flags = AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + + ret= getaddrinfo(gearmand->host, port->port, &hints, &addrinfo); + if (ret != 0) + { + char buffer[1024]; + + snprintf(buffer, sizeof(buffer), "%s:%s", gearmand->host ? gearmand->host : "", port->port); + gearmand_gai_error(buffer, ret); + return GEARMAN_ERRNO; + } + + for (struct addrinfo *addrinfo_next= addrinfo; addrinfo_next != NULL; + addrinfo_next= addrinfo_next->ai_next) + { + int fd; + char host[NI_MAXHOST]; + + ret= getnameinfo(addrinfo_next->ai_addr, addrinfo_next->ai_addrlen, host, + NI_MAXHOST, port->port, NI_MAXSERV, + NI_NUMERICHOST | NI_NUMERICSERV); + if (ret != 0) + { + gearmand_gai_error("getaddrinfo", ret); + strcpy(host, "-"); + strcpy(port->port, "-"); + } + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Trying to listen on %s:%s", host, port->port); + + /* Call to socket() can fail for some getaddrinfo results, try another. */ + fd= socket(addrinfo_next->ai_family, addrinfo_next->ai_socktype, + addrinfo_next->ai_protocol); + if (fd == -1) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Failed to listen on %s:%s", host, port->port); + continue; + } + + int flags= 1; +#ifdef IPV6_V6ONLY + if (addrinfo_next->ai_family == AF_INET6) + { + flags= 1; + ret= setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flags, sizeof(flags)); + if (ret != 0) + { + gearmand_perror("setsockopt(IPV6_V6ONLY)"); + return GEARMAN_ERRNO; + } + } +#endif + + ret= fcntl(fd, F_SETFD, FD_CLOEXEC); + if (ret != 0 || !(fcntl(fd, F_GETFD, 0) & FD_CLOEXEC)) + { + gearmand_perror("fcntl(FD_CLOEXEC)"); + return GEARMAN_ERRNO; + } + + ret= setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags)); + if (ret != 0) + { + gearmand_perror("setsockopt(SO_REUSEADDR)"); + return GEARMAN_ERRNO; + } + + ret= setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags)); + if (ret != 0) + { + gearmand_perror("setsockopt(SO_KEEPALIVE)"); + return GEARMAN_ERRNO; + } + + ret= setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)); + if (ret != 0) + { + gearmand_perror("setsockopt(SO_LINGER)"); + return GEARMAN_ERRNO; + } + + ret= setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags)); + if (ret != 0) + { + gearmand_perror("setsockopt(TCP_NODELAY)"); + return GEARMAN_ERRNO; + } + + /* + @note logic for this pulled from Drizzle. + + Sometimes the port is not released fast enough when stopping and + restarting the server. This happens quite often with the test suite + on busy Linux systems. Retry to bind the address at these intervals: + Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ... + Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ... + Limit the sequence by drizzled_bind_timeout. + */ + uint32_t waited; + uint32_t this_wait; + uint32_t retry; + for (waited= 0, retry= 1; ; retry++, waited+= this_wait) + { + if (((ret= bind(fd, addrinfo_next->ai_addr, addrinfo_next->ai_addrlen)) == 0) or + (errno != EADDRINUSE) || (waited >= bind_timeout)) + { + break; + } + + // We are in single user threads, so strerror() is fine. + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Retrying bind(%s) on %s:%s %u >= %u", strerror(ret), host, port->port, + waited, bind_timeout); + this_wait= retry * retry / 3 + 1; + sleep(this_wait); + } + + if (ret < 0) + { + gearmand_perror("bind"); + + gearmand_sockfd_close(fd); + + if (errno == EADDRINUSE) + { + if (not port->listen_fd) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Address already in use %s:%s", host, port->port); + } + + continue; + } + + gearmand_perror("bind"); + return GEARMAN_ERRNO; + } + + if (listen(fd, gearmand->backlog) == -1) + { + gearmand_perror("listen"); + + gearmand_sockfd_close(fd); + + return GEARMAN_ERRNO; + } + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Listening on %s:%s", host, port->port); + + // Scoping note for eventual transformation + { + int *fd_list; + + fd_list= (int *)realloc(port->listen_fd, sizeof(int) * (port->listen_count + 1)); + if (fd_list == NULL) + { + gearmand_perror("realloc"); + + gearmand_sockfd_close(fd); + + return GEARMAN_ERRNO; + } + + port->listen_fd= fd_list; + } + + port->listen_fd[port->listen_count]= fd; + port->listen_count++; + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Listening on %s:%s (%d)", host, port->port, fd); + } + + freeaddrinfo(addrinfo); + + /* Report last socket() error if we couldn't find an address to bind. */ + if (port->listen_fd == NULL) + { + gearmand_fatal("Could not bind/listen to any addresses"); + return GEARMAN_ERRNO; + } + + port->listen_event= (struct event *)malloc(sizeof(struct event) * port->listen_count); + if (port->listen_event == NULL) + { + return gearmand_merror("malloc", struct event, port->listen_count); + } + + for (uint32_t y= 0; y < port->listen_count; y++) + { + event_set(&(port->listen_event[y]), port->listen_fd[y], + EV_READ | EV_PERSIST, _listen_event, port); + event_base_set(gearmand->base, &(port->listen_event[y])); + } + } + + return GEARMAN_SUCCESS; +} + +static void _listen_close(gearmand_st *gearmand) +{ + _listen_clear(gearmand); + + for (uint32_t x= 0; x < gearmand->port_count; x++) + { + for (uint32_t y= 0; y < gearmand->port_list[x].listen_count; y++) + { + if (gearmand->port_list[x].listen_fd[y] >= 0) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Closing listening socket (%d)", gearmand->port_list[x].listen_fd[y]); + gearmand_sockfd_close(gearmand->port_list[x].listen_fd[y]); + gearmand->port_list[x].listen_fd[y]= -1; + } + } + } +} + +static gearmand_error_t _listen_watch(gearmand_st *gearmand) +{ + if (gearmand->is_listen_event) + return GEARMAN_SUCCESS; + + for (uint32_t x= 0; x < gearmand->port_count; x++) + { + for (uint32_t y= 0; y < gearmand->port_list[x].listen_count; y++) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Adding event for listening socket (%d)", + gearmand->port_list[x].listen_fd[y]); + + if (event_add(&(gearmand->port_list[x].listen_event[y]), NULL) < 0) + { + gearmand_perror("event_add"); + return GEARMAN_EVENT; + } + } + } + + gearmand->is_listen_event= true; + return GEARMAN_SUCCESS; +} + +static void _listen_clear(gearmand_st *gearmand) +{ + if (! (gearmand->is_listen_event)) + return; + + for (uint32_t x= 0; x < gearmand->port_count; x++) + { + for (uint32_t y= 0; y < gearmand->port_list[x].listen_count; y++) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, + "Clearing event for listening socket (%d)", + gearmand->port_list[x].listen_fd[y]); + + if (event_del(&(gearmand->port_list[x].listen_event[y])) < 0) + { + gearmand_perror("We tried to event_del() an event which no longer existed"); + assert(! "We tried to event_del() an event which no longer existed"); + } + } + } + + gearmand->is_listen_event= false; +} + +static void _listen_event(int fd, short events __attribute__ ((unused)), void *arg) +{ + gearmand_port_st *port= (gearmand_port_st *)arg; + struct sockaddr sa; + socklen_t sa_len; + char host[NI_MAXHOST]; + char port_str[NI_MAXSERV]; + + sa_len= sizeof(sa); + fd= accept(fd, &sa, &sa_len); + if (fd == -1) + { + if (errno == EINTR) + { + return; + } + else if (errno == EMFILE) + { + gearmand_perror("accept"); + return; + } + + _clear_events(Gearmand()); + gearmand_perror("accept"); + Gearmand()->ret= GEARMAN_ERRNO; + return; + } + + /* + Since this is numeric, it should never fail. Even if it did we don't want to really error from it. + */ + int error; + error= getnameinfo(&sa, sa_len, host, NI_MAXHOST, port_str, NI_MAXSERV, + NI_NUMERICHOST | NI_NUMERICSERV); + if (error != 0) + { + gearmand_gai_error("getnameinfo", error); + strcpy(host, "-"); + strcpy(port_str, "-"); + } + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Accepted connection from %s:%s", host, port_str); + + gearmand_error_t ret; + ret= gearmand_con_create(Gearmand(), fd, host, port_str, port->add_fn); + if (ret == GEARMAN_MEMORY_ALLOCATION_FAILURE) + { + gearmand_sockfd_close(fd); + return; + } + else if (ret != GEARMAN_SUCCESS) + { + Gearmand()->ret= ret; + _clear_events(Gearmand()); + } +} + +static gearmand_error_t _wakeup_init(gearmand_st *gearmand) +{ + gearmand_info("Creating wakeup pipe"); + + if (pipe(gearmand->wakeup_fd) < 0) + { + gearmand_perror("pipe"); + return GEARMAN_ERRNO; + } + + int returned_flags; + if ((returned_flags= fcntl(gearmand->wakeup_fd[0], F_GETFL, 0)) < 0) + { + gearmand_perror("fcntl:F_GETFL"); + return GEARMAN_ERRNO; + } + + if (fcntl(gearmand->wakeup_fd[0], F_SETFL, returned_flags | O_NONBLOCK) < 0) + + { + gearmand_perror("F_SETFL"); + return GEARMAN_ERRNO; + } + + event_set(&(gearmand->wakeup_event), gearmand->wakeup_fd[0], + EV_READ | EV_PERSIST, _wakeup_event, gearmand); + event_base_set(gearmand->base, &(gearmand->wakeup_event)); + + return GEARMAN_SUCCESS; +} + +static void _wakeup_close(gearmand_st *gearmand) +{ + _wakeup_clear(gearmand); + + if (gearmand->wakeup_fd[0] >= 0) + { + gearmand_info("Closing wakeup pipe"); + gearmand_pipe_close(gearmand->wakeup_fd[0]); + gearmand->wakeup_fd[0]= -1; + gearmand_pipe_close(gearmand->wakeup_fd[1]); + gearmand->wakeup_fd[1]= -1; + } +} + +static gearmand_error_t _wakeup_watch(gearmand_st *gearmand) +{ + if (gearmand->is_wakeup_event) + return GEARMAN_SUCCESS; + + gearmand_info("Adding event for wakeup pipe"); + + if (event_add(&(gearmand->wakeup_event), NULL) < 0) + { + gearmand_perror("event_add"); + return GEARMAN_EVENT; + } + + gearmand->is_wakeup_event= true; + return GEARMAN_SUCCESS; +} + +static void _wakeup_clear(gearmand_st *gearmand) +{ + if (gearmand->is_wakeup_event) + { + gearmand_info("Clearing event for wakeup pipe"); + if (event_del(&(gearmand->wakeup_event)) < 0) + { + gearmand_perror("We tried to event_del() an event which no longer existed"); + assert(! "We tried to event_del() an event which no longer existed"); + } + gearmand->is_wakeup_event= false; + } +} + +static void _wakeup_event(int fd, short events __attribute__ ((unused)), + void *arg) +{ + gearmand_st *gearmand= (gearmand_st *)arg; + uint8_t buffer[GEARMAN_PIPE_BUFFER_SIZE]; + gearmand_thread_st *thread; + + while (1) + { + ssize_t ret; + ret= read(fd, buffer, GEARMAN_PIPE_BUFFER_SIZE); + if (ret == 0) + { + _clear_events(gearmand); + gearmand_fatal("read(EOF)"); + gearmand->ret= GEARMAN_PIPE_EOF; + return; + } + else if (ret == -1) + { + if (errno == EINTR) + continue; + + if (errno == EAGAIN) + break; + + _clear_events(gearmand); + gearmand_perror("_wakeup_event:read"); + gearmand->ret= GEARMAN_ERRNO; + return; + } + + for (ssize_t x= 0; x < ret; x++) + { + switch ((gearmand_wakeup_t)buffer[x]) + { + case GEARMAND_WAKEUP_PAUSE: + gearmand_info("Received PAUSE wakeup event"); + _clear_events(gearmand); + gearmand->ret= GEARMAN_PAUSE; + break; + + case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: + gearmand_info("Received SHUTDOWN_GRACEFUL wakeup event"); + _listen_close(gearmand); + + for (thread= gearmand->thread_list; thread != NULL; + thread= thread->next) + { + gearmand_thread_wakeup(thread, GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL); + } + + gearmand->ret= GEARMAN_SHUTDOWN_GRACEFUL; + break; + + case GEARMAND_WAKEUP_SHUTDOWN: + gearmand_info("Received SHUTDOWN wakeup event"); + _clear_events(gearmand); + gearmand->ret= GEARMAN_SHUTDOWN; + break; + + case GEARMAND_WAKEUP_CON: + case GEARMAND_WAKEUP_RUN: + gearmand_log_fatal(GEARMAN_DEFAULT_LOG_PARAM, "Received unknown wakeup event (%u)", buffer[x]); + _clear_events(gearmand); + gearmand->ret= GEARMAN_UNKNOWN_STATE; + break; + } + } + } +} + +static gearmand_error_t _watch_events(gearmand_st *gearmand) +{ + gearmand_error_t ret; + + ret= _listen_watch(gearmand); + if (ret != GEARMAN_SUCCESS) + return ret; + + ret= _wakeup_watch(gearmand); + if (ret != GEARMAN_SUCCESS) + return ret; + + return GEARMAN_SUCCESS; +} + +static void _clear_events(gearmand_st *gearmand) +{ + _listen_clear(gearmand); + _wakeup_clear(gearmand); + + /* + If we are not threaded, tell the fake thread to shutdown now to clear + connections. Otherwise we will never exit the libevent loop. + */ + if (gearmand->threads == 0 && gearmand->thread_list != NULL) + gearmand_thread_wakeup(gearmand->thread_list, GEARMAND_WAKEUP_SHUTDOWN); +} + +static void _close_events(gearmand_st *gearmand) +{ + _listen_close(gearmand); + _wakeup_close(gearmand); +} + +static const char *_verbose_name[GEARMAND_VERBOSE_MAX]= +{ + "NEVER", + "FATAL", + "ERROR", + "INFO", + "DEBUG", + "CRAZY" +}; + +/** @} */ + +/* + * Public Definitions + */ + +const char *gearmand_version(void) +{ + return PACKAGE_VERSION; +} + +const char *gearmand_bugreport(void) +{ + return PACKAGE_BUGREPORT; +} + +const char *gearmand_verbose_name(gearmand_verbose_t verbose) +{ + if (verbose >= GEARMAND_VERBOSE_MAX) + return "UNKNOWN"; + + return _verbose_name[verbose]; +} + +static bool gearman_server_create(gearman_server_st *server, + uint8_t job_retries_arg, + uint8_t worker_wakeup_arg, + bool round_robin_arg) +{ + struct utsname un; + assert(server); + + server->state.queue_startup= false; + server->flags.round_robin= round_robin_arg; + server->flags.threaded= false; + server->shutdown= false; + server->shutdown_graceful= false; + server->proc_wakeup= false; + server->proc_shutdown= false; + server->job_retries= job_retries_arg; + server->worker_wakeup= worker_wakeup_arg; + server->thread_count= 0; + server->free_packet_count= 0; + server->function_count= 0; + server->job_count= 0; + server->unique_count= 0; + server->free_job_count= 0; + server->free_client_count= 0; + server->free_worker_count= 0; + server->thread_list= NULL; + server->free_packet_list= NULL; + server->function_list= NULL; + server->free_job_list= NULL; + server->free_client_list= NULL; + server->free_worker_list= NULL; + server->queue._context= NULL; + server->queue._add_fn= NULL; + server->queue._flush_fn= NULL; + server->queue._done_fn= NULL; + server->queue._replay_fn= NULL; + memset(server->job_hash, 0, + sizeof(gearman_server_job_st *) * GEARMAND_JOB_HASH_SIZE); + memset(server->unique_hash, 0, + sizeof(gearman_server_job_st *) * GEARMAND_JOB_HASH_SIZE); + + if (uname(&un) == -1) + { + gearman_server_free(server); + return false; + } + + int checked_length= snprintf(server->job_handle_prefix, GEARMAND_JOB_HANDLE_SIZE, "H:%s", un.nodename); + if (checked_length >= GEARMAND_JOB_HANDLE_SIZE || checked_length < 0) + { + gearman_server_free(server); + return false; + } + + server->job_handle_count= 1; + + return true; +} + +static void gearman_server_free(gearman_server_st *server) +{ + uint32_t key; + gearman_server_packet_st *packet; + gearman_server_job_st *job; + gearman_server_client_st *client; + gearman_server_worker_st *worker; + + /* All threads should be cleaned up before calling this. */ + assert(server->thread_list == NULL); + + for (key= 0; key < GEARMAND_JOB_HASH_SIZE; key++) + { + while (server->job_hash[key] != NULL) + gearman_server_job_free(server->job_hash[key]); + } + + while (server->function_list != NULL) + { + gearman_server_function_free(server, server->function_list); + } + + while (server->free_packet_list != NULL) + { + packet= server->free_packet_list; + server->free_packet_list= packet->next; + free(packet); + } + + while (server->free_job_list != NULL) + { + job= server->free_job_list; + server->free_job_list= job->next; + free(job); + } + + while (server->free_client_list != NULL) + { + client= server->free_client_list; + server->free_client_list= client->con_next; + free(client); + } + + while (server->free_worker_list != NULL) + { + worker= server->free_worker_list; + server->free_worker_list= worker->con_next; + free(worker); + } +} diff -Nru gearmand-0.14/libgearman-server/gearmand_con.c gearmand-0.23/libgearman-server/gearmand_con.c --- gearmand-0.14/libgearman-server/gearmand_con.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/gearmand_con.c 2011-06-03 04:13:30.000000000 +0200 @@ -11,8 +11,13 @@ * @brief Gearmand Connection Definitions */ -#include "common.h" -#include "gearmand.h" +#include +#include +#include + +#include +#include +#include /* * Private declarations @@ -26,7 +31,7 @@ static void _con_ready(int fd, short events, void *arg); -static gearman_return_t _con_add(gearmand_thread_st *thread, +static gearmand_error_t _con_add(gearmand_thread_st *thread, gearmand_con_st *con); /** @} */ @@ -35,13 +40,11 @@ * Public definitions */ -gearman_return_t gearmand_con_create(gearmand_st *gearmand, int fd, +gearmand_error_t gearmand_con_create(gearmand_st *gearmand, int fd, const char *host, const char *port, - gearman_connection_add_fn *add_fn) + gearmand_connection_add_fn *add_fn) { gearmand_con_st *dcon; - gearmand_con_st *free_dcon_list; - uint32_t free_dcon_count; if (gearmand->free_dcon_count > 0) { @@ -53,10 +56,13 @@ dcon= (gearmand_con_st *)malloc(sizeof(gearmand_con_st)); if (dcon == NULL) { - close(fd); - gearmand_log_fatal(gearmand, "gearmand_con_create:malloc"); + gearmand_perror("malloc"); + gearmand_sockfd_close(fd); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; } + + memset(&dcon->event, 0, sizeof(struct event)); } dcon->last_events= 0; @@ -64,7 +70,6 @@ dcon->next= NULL; dcon->prev= NULL; dcon->server_con= NULL; - dcon->con= NULL; dcon->add_fn= NULL; strncpy(dcon->host, host, NI_MAXHOST - 1); strncpy(dcon->port, port, NI_MAXSERV - 1); @@ -92,6 +97,9 @@ } else { + uint32_t free_dcon_count; + gearmand_con_st *free_dcon_list; + (void ) pthread_mutex_lock(&(dcon->thread->lock)); GEARMAN_LIST_ADD(dcon->thread->dcon_add, dcon,) @@ -126,41 +134,74 @@ void gearmand_con_free(gearmand_con_st *dcon) { - int del_ret= event_del(&(dcon->event)); - assert(del_ret == 0); + if (event_initialized(&(dcon->event))) + { + if (event_del(&(dcon->event)) < 0) + { + gearmand_perror("event_del"); + } + else + { + /* This gets around a libevent bug when both POLLIN and POLLOUT are set. */ + event_set(&(dcon->event), dcon->fd, EV_READ, _con_ready, dcon); + event_base_set(dcon->thread->base, &(dcon->event)); + + if (event_add(&(dcon->event), NULL) < 0) + { + gearmand_perror("event_add"); + } + else + { + if (event_del(&(dcon->event)) < 0) + { + gearmand_perror("event_del"); + } + } + } + } - /* This gets around a libevent bug when both POLLIN and POLLOUT are set. */ - event_set(&(dcon->event), dcon->fd, EV_READ, _con_ready, dcon); - event_base_set(dcon->thread->base, &(dcon->event)); - event_add(&(dcon->event), NULL); - del_ret= event_del(&(dcon->event)); - assert(del_ret == 0); + // @note server_con could be null if we failed to complete the initial + // connection. + if (dcon->server_con) + { + gearman_server_con_free(dcon->server_con); + } - gearman_server_con_free(dcon->server_con); GEARMAN_LIST_DEL(dcon->thread->dcon, dcon,) - close(dcon->fd); + gearmand_sockfd_close(dcon->fd); - if (dcon->thread->gearmand->free_dcon_count < GEARMAN_MAX_FREE_SERVER_CON) + if (Gearmand()->free_dcon_count < GEARMAN_MAX_FREE_SERVER_CON) { - if (dcon->thread->gearmand->threads == 0) - GEARMAN_LIST_ADD(dcon->thread->gearmand->free_dcon, dcon,) + if (Gearmand()->threads == 0) + { + GEARMAN_LIST_ADD(Gearmand()->free_dcon, dcon,) + } else { /* Lock here because the main thread may be emptying this. */ - (void ) pthread_mutex_lock(&(dcon->thread->lock)); - GEARMAN_LIST_ADD(dcon->thread->free_dcon, dcon,) - (void ) pthread_mutex_unlock(&(dcon->thread->lock)); + int error; + if (not (error= pthread_mutex_lock(&(dcon->thread->lock)))) + { + GEARMAN_LIST_ADD(dcon->thread->free_dcon, dcon,); + (void ) pthread_mutex_unlock(&(dcon->thread->lock)); + } + else + { + errno= error; + gearmand_perror("pthread_mutex_lock"); + } } } else + { + gearmand_crazy("free"); free(dcon); + } } void gearmand_con_check_queue(gearmand_thread_st *thread) { - gearmand_con_st *dcon; - /* Dirty check is fine here, wakeup is always sent after add completes. */ if (thread->dcon_add_count == 0) return; @@ -169,25 +210,45 @@ walk the thread's dcon_list while holding the lock. */ while (thread->dcon_add_list != NULL) { - (void ) pthread_mutex_lock(&(thread->lock)); - dcon= thread->dcon_add_list; - GEARMAN_LIST_DEL(thread->dcon_add, dcon,) - (void ) pthread_mutex_unlock(&(thread->lock)); + int error; + if (not (error= pthread_mutex_lock(&(thread->lock)))) + { + gearmand_con_st *dcon= thread->dcon_add_list; + GEARMAN_LIST_DEL(thread->dcon_add, dcon,); - if (_con_add(thread, dcon) != GEARMAN_SUCCESS) - gearmand_wakeup(thread->gearmand, GEARMAND_WAKEUP_SHUTDOWN); + if ((error= pthread_mutex_unlock(&(thread->lock))) != 0) + { + errno= error; + gearmand_perror("pthread_mutex_unlock"); + gearmand_fatal("Error in locking forcing a shutdown"); + gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); + } + + gearmand_error_t rc; + if ((rc= _con_add(thread, dcon)) != GEARMAN_SUCCESS) + { + gearmand_gerror("_con_add() has failed, please report any crashes that occur immediatly after this.", rc); + gearmand_con_free(dcon); + } + } + else + { + errno= error; + gearmand_perror("pthread_mutex_lock"); + gearmand_fatal("Lock could not be taken on thread->, shutdown to occur"); + gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); + } } } -gearman_return_t gearmand_connection_watch(gearman_connection_st *con, short events, - void *context __attribute__ ((unused))) +gearmand_error_t gearmand_connection_watch(gearmand_io_st *con, short events, + void *context __attribute__ ((unused))) { (void) context; gearmand_con_st *dcon; short set_events= 0; - dcon= (gearmand_con_st *)gearman_connection_context(con); - dcon->con= con; + dcon= (gearmand_con_st *)gearman_io_context(con); if (events & POLLIN) set_events|= EV_READ; @@ -196,26 +257,29 @@ if (dcon->last_events != set_events) { - if (dcon->last_events != 0) + if (dcon->last_events) { - int del_ret= event_del(&(dcon->event)); - assert(del_ret == 0); + if (event_del(&(dcon->event)) < 0) + { + gearmand_perror("event_del"); + assert(! "event_del"); + } } - event_set(&(dcon->event), dcon->fd, set_events | EV_PERSIST, _con_ready, - dcon); + event_set(&(dcon->event), dcon->fd, set_events | EV_PERSIST, _con_ready, dcon); event_base_set(dcon->thread->base, &(dcon->event)); - if (event_add(&(dcon->event), NULL) == -1) + if (event_add(&(dcon->event), NULL) < 0) { - gearmand_log_fatal(dcon->thread->gearmand, "_con_watch:event_add:-1"); + gearmand_perror("event_add"); return GEARMAN_EVENT; } dcon->last_events= set_events; } - gearmand_log_crazy(dcon->thread->gearmand, "[%4u] %15s:%5s Watching %6s %s", - dcon->thread->count, dcon->host, dcon->port, + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, + "%15s:%5s Watching %6s %s", + dcon->host, dcon->port, events & POLLIN ? "POLLIN" : "", events & POLLOUT ? "POLLOUT" : ""); @@ -231,59 +295,58 @@ { gearmand_con_st *dcon= (gearmand_con_st *)arg; short revents= 0; - gearman_return_t ret; if (events & EV_READ) revents|= POLLIN; if (events & EV_WRITE) revents|= POLLOUT; - ret= gearman_connection_set_revents(dcon->con, revents); - if (ret != GEARMAN_SUCCESS) + gearmand_error_t ret= gearmand_io_set_revents(dcon->server_con, revents); + if (gearmand_failed(ret)) { + gearmand_gerror("gearmand_io_set_revents", ret); gearmand_con_free(dcon); return; } - gearmand_log_crazy(dcon->thread->gearmand, "[%4u] %15s:%5s Ready %6s %s", - dcon->thread->count, dcon->host, dcon->port, + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, + "%15:%5 Ready %6s %s", + dcon->host, dcon->port, revents & POLLIN ? "POLLIN" : "", revents & POLLOUT ? "POLLOUT" : ""); gearmand_thread_run(dcon->thread); } -static gearman_return_t _con_add(gearmand_thread_st *thread, +static gearmand_error_t _con_add(gearmand_thread_st *thread, gearmand_con_st *dcon) { - gearman_return_t ret; + gearmand_error_t ret= GEARMAN_SUCCESS; + dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon, &ret); - dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon->fd, - dcon); - if (dcon->server_con == NULL) + assert(dcon->server_con || ret != GEARMAN_SUCCESS); + assert(! dcon->server_con || ret == GEARMAN_SUCCESS); + + if (not dcon->server_con) { - close(dcon->fd); - free(dcon); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } + gearmand_sockfd_close(dcon->fd); - gearman_server_con_set_host(dcon->server_con, dcon->host); - gearman_server_con_set_port(dcon->server_con, dcon->port); + return ret; + } - if (dcon->add_fn != NULL) + if (dcon->add_fn) { - ret= (*dcon->add_fn)(gearman_server_con_con(dcon->server_con)); - if (ret != GEARMAN_SUCCESS) + ret= (*dcon->add_fn)(dcon->server_con); + if (gearmand_failed(ret)) { gearman_server_con_free(dcon->server_con); - close(dcon->fd); - free(dcon); + + gearmand_sockfd_close(dcon->fd); + return ret; } } - gearmand_log_info(thread->gearmand, "[%4u] %15s:%5s Connected", thread->count, dcon->host, dcon->port); - GEARMAN_LIST_ADD(thread->dcon, dcon,) return GEARMAN_SUCCESS; diff -Nru gearmand-0.14/libgearman-server/gearmand_con.h gearmand-0.23/libgearman-server/gearmand_con.h --- gearmand-0.14/libgearman-server/gearmand_con.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/gearmand_con.h 2011-03-08 07:00:29.000000000 +0100 @@ -14,6 +14,10 @@ #ifndef __GEARMAND_CON_H__ #define __GEARMAND_CON_H__ +#include +#include +#include + #ifdef __cplusplus extern "C" { #endif @@ -35,8 +39,7 @@ gearmand_con_st *next; gearmand_con_st *prev; gearman_server_con_st *server_con; - gearman_connection_st *con; - gearman_connection_add_fn *add_fn; + gearmand_connection_add_fn *add_fn; struct event event; char host[NI_MAXHOST]; char port[NI_MAXSERV]; @@ -54,9 +57,9 @@ * @return Pointer to an allocated gearmand structure. */ GEARMAN_API -gearman_return_t gearmand_con_create(gearmand_st *gearmand, int fd, +gearmand_error_t gearmand_con_create(gearmand_st *gearmand, int fd, const char *host, const char *port, - gearman_connection_add_fn *add_fn); + gearmand_connection_add_fn *add_fn); /** * Free resources used by a connection. @@ -75,8 +78,8 @@ * Callback function used for setting events in libevent. */ GEARMAN_API -gearman_return_t gearmand_connection_watch(gearman_connection_st *con, short events, - void *context); +gearmand_error_t gearmand_connection_watch(gearmand_io_st *con, short events, + void *context); /** @} */ diff -Nru gearmand-0.14/libgearman-server/gearmand.h gearmand-0.23/libgearman-server/gearmand.h --- gearmand-0.14/libgearman-server/gearmand.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/gearmand.h 2011-06-03 04:13:30.000000000 +0200 @@ -1,28 +1,69 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ + /** * @file * @brief Gearmand Declarations */ -#ifndef __GEARMAND_H__ -#define __GEARMAND_H__ +#pragma once + +#include +#include +#include +#include +#include -#include #include +#include +#include + +#include + #include +#include +#include +#include #include -#include -#include -#include #include +#include #include #include #include @@ -32,35 +73,14 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearmand Gearmand Declarations - * - * This is a server implementation using the gearman_server interface. - * - * @{ - */ - -struct gearmand_port_st -{ - in_port_t port; - uint32_t listen_count; - gearmand_st *gearmand; - gearman_connection_add_fn *add_fn; - int *listen_fd; - struct event *listen_event; -}; - struct gearmand_st { - gearman_verbose_t verbose; - gearman_return_t ret; - int backlog; + gearmand_verbose_t verbose; + gearmand_error_t ret; + int backlog; // Set socket backlog for listening connection bool is_listen_event; bool is_wakeup_event; + int timeout; uint32_t port_count; uint32_t threads; uint32_t thread_count; @@ -68,10 +88,10 @@ uint32_t max_thread_free_dcon_count; int wakeup_fd[2]; const char *host; - gearman_log_fn *log_fn; + gearmand_log_fn *log_fn; void *log_context; struct event_base *base; - gearmand_port_st *port_list; + struct gearmand_port_st *port_list; gearmand_thread_st *thread_list; gearmand_thread_st *thread_add_next; gearmand_con_st *free_dcon_list; @@ -79,70 +99,50 @@ struct event wakeup_event; }; -/** - * Create a server instance. - * @param host Host for the server to listen on. - * @param port Port for the server to listen on. - * @return Pointer to an allocated gearmand structure. - */ -GEARMAN_API -gearmand_st *gearmand_create(const char *host, in_port_t port); +#ifdef __cplusplus +extern "C" { +#endif /** - * Free resources used by a server instace. - * @param gearmand Server instance structure previously initialized with - * gearmand_create. + * @addtogroup gearmand Gearmand Declarations + * + * This is a server implementation using the gearman_server interface. + * + * @{ */ -GEARMAN_API -void gearmand_free(gearmand_st *gearmand); -/** - * Set socket backlog for listening connection. - * @param gearmand Server instance structure previously initialized with - * gearmand_create. - * @param backlog Number of backlog connections to set during listen. - */ GEARMAN_API -void gearmand_set_backlog(gearmand_st *gearmand, int backlog); +gearmand_st *Gearmand(void); -/** - * Set maximum job retry count. - * @param gearmand Server instance structure previously initialized with - * gearmand_create. - * @param job_retries Number of job attempts. - */ -GEARMAN_API -void gearmand_set_job_retries(gearmand_st *gearmand, uint8_t job_retries); +#define Server (&(Gearmand()->server)) /** - * Set maximum number of workers to wake up per job. - * @param gearmand Server instance structure previously initialized with - * gearmand_create. - * @param worker_wakeup Number of workers to wake up. + * Create a server instance. + * @param host Host for the server to listen on. + * @param port Port for the server to listen on. + * @return Pointer to an allocated gearmand structure. */ GEARMAN_API -void gearmand_set_worker_wakeup(gearmand_st *gearmand, uint8_t worker_wakeup); +gearmand_st *gearmand_create(const char *host, + const char *port, + uint32_t threads, + int backlog, + uint8_t job_retries, + uint8_t worker_wakeup, + gearmand_log_fn *function, void *log_context, const gearmand_verbose_t verbose, + bool round_robin); /** - * Set number of I/O threads for server to use. + * Free resources used by a server instace. * @param gearmand Server instance structure previously initialized with * gearmand_create. - * @param threads Number of threads. */ GEARMAN_API -void gearmand_set_threads(gearmand_st *gearmand, uint32_t threads); +void gearmand_free(gearmand_st *gearmand); + -/** - * Set logging callback for server instance. - * @param gearmand Server instance structure previously initialized with - * gearmand_create. - * @param function Function to call when there is a logging message. - * @param context Argument to pass into the log callback function. - * @param verbose Verbosity level. - */ GEARMAN_API -void gearmand_set_log_fn(gearmand_st *gearmand, gearman_log_fn *function, - void *context, gearman_verbose_t verbose); +gearman_server_st *gearmand_server(gearmand_st *gearmand); /** * Add a port to listen on when starting server with optional callback. @@ -154,8 +154,9 @@ * @return Standard gearman return value. */ GEARMAN_API -gearman_return_t gearmand_port_add(gearmand_st *gearmand, in_port_t port, - gearman_connection_add_fn *function); +gearmand_error_t gearmand_port_add(gearmand_st *gearmand, + const char *port, + gearmand_connection_add_fn *function); /** * Run the server instance. @@ -164,7 +165,7 @@ * @return Standard gearman return value. */ GEARMAN_API -gearman_return_t gearmand_run(gearmand_st *gearmand); +gearmand_error_t gearmand_run(gearmand_st *gearmand); /** * Interrupt a running gearmand server from another thread. You should only @@ -177,20 +178,17 @@ GEARMAN_API void gearmand_wakeup(gearmand_st *gearmand, gearmand_wakeup_t wakeup); -/** - * Sets the round-robin mode on the server object. RR will distribute work - * fairly among every function assigned to a worker, instead of draining - * each function before moving on to the next. - * @param gearmand Server instance previously initialized - * @param bool true=round robin is used, false=round robin is not used - */ GEARMAN_API -void gearmand_set_round_robin(gearmand_st *gearmand, bool round_robin); +const char *gearmand_version(void); + +GEARMAN_API +const char *gearmand_bugreport(void); + +GEARMAN_API +const char *gearmand_verbose_name(gearmand_verbose_t verbose); /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAND_H__ */ diff -Nru gearmand-0.14/libgearman-server/gearmand_thread.c gearmand-0.23/libgearman-server/gearmand_thread.c --- gearmand-0.14/libgearman-server/gearmand_thread.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/gearmand_thread.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,418 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearmand Thread Definitions - */ - -#include "common.h" -#include "gearmand.h" - -/* - * Private declarations - */ - -/** - * @addtogroup gearmand_thread_private Private Gearmand Thread Functions - * @ingroup gearmand_thread - * @{ - */ - -static void *_thread(void *data); -static void _log(const char *line, gearman_verbose_t verbose, void *context); -static void _run(gearman_server_thread_st *thread, void *fn_arg); - -static gearman_return_t _wakeup_init(gearmand_thread_st *thread); -static void _wakeup_close(gearmand_thread_st *thread); -static void _wakeup_clear(gearmand_thread_st *thread); -static void _wakeup_event(int fd, short events, void *arg); -static void _clear_events(gearmand_thread_st *thread); - -/** @} */ - -/* - * Public definitions - */ - -gearman_return_t gearmand_thread_create(gearmand_st *gearmand) -{ - gearmand_thread_st *thread; - gearman_return_t ret; - int pthread_ret; - - thread= (gearmand_thread_st *)malloc(sizeof(gearmand_thread_st)); - if (thread == NULL) - { - gearmand_log_fatal(gearmand, "gearmand_thread_create:malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - if (gearman_server_thread_create(&(gearmand->server), - &(thread->server_thread)) == NULL) - { - free(thread); - gearmand_log_fatal(gearmand, "gearmand_thread_create:gearman_server_thread_create:NULL"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - gearman_server_thread_set_log_fn(&(thread->server_thread), _log, thread, - gearmand->verbose); - gearman_server_thread_set_event_watch(&(thread->server_thread), - gearmand_connection_watch, NULL); - - thread->is_thread_lock= false; - thread->is_wakeup_event= false; - thread->count= 0; - thread->dcon_count= 0; - thread->dcon_add_count= 0; - thread->free_dcon_count= 0; - thread->wakeup_fd[0]= -1; - thread->wakeup_fd[1]= -1; - GEARMAN_LIST_ADD(gearmand->thread, thread,) - thread->gearmand= gearmand; - thread->dcon_list= NULL; - thread->dcon_add_list= NULL; - thread->free_dcon_list= NULL; - - /* If we have no threads, we still create a fake thread that uses the main - libevent instance. Otherwise create a libevent instance for each thread. */ - if (gearmand->threads == 0) - thread->base= gearmand->base; - else - { - gearmand_log_info(gearmand, "Initializing libevent for IO thread"); - - thread->base= event_base_new(); - if (thread->base == NULL) - { - gearmand_thread_free(thread); - gearmand_log_fatal(gearmand, "gearmand_thread_create:event_base_new:NULL"); - return GEARMAN_EVENT; - } - } - - ret= _wakeup_init(thread); - if (ret != GEARMAN_SUCCESS) - { - gearmand_thread_free(thread); - return ret; - } - - /* If we are not running multi-threaded, just return the thread context. */ - if (gearmand->threads == 0) - return GEARMAN_SUCCESS; - - thread->count= gearmand->thread_count; - - pthread_ret= pthread_mutex_init(&(thread->lock), NULL); - if (pthread_ret != 0) - { - thread->count= 0; - gearmand_thread_free(thread); - gearmand_log_fatal(gearmand, "gearmand_thread_create:pthread_mutex_init:%d", pthread_ret); - return GEARMAN_PTHREAD; - } - - thread->is_thread_lock= true; - - gearman_server_thread_set_run(&(thread->server_thread), _run, thread); - - pthread_ret= pthread_create(&(thread->id), NULL, _thread, thread); - if (pthread_ret != 0) - { - thread->count= 0; - gearmand_thread_free(thread); - gearmand_log_fatal(gearmand, "gearmand_thread_create:pthread_create:%d", pthread_ret); - - return GEARMAN_PTHREAD; - } - - gearmand_log_info(gearmand, "Thread %u created", thread->count); - - return GEARMAN_SUCCESS; -} - -void gearmand_thread_free(gearmand_thread_st *thread) -{ - gearmand_con_st *dcon; - - if (thread->gearmand->threads && thread->count > 0) - { - gearmand_log_info(thread->gearmand, "Shutting down thread %u", thread->count); - - gearmand_thread_wakeup(thread, GEARMAND_WAKEUP_SHUTDOWN); - (void) pthread_join(thread->id, NULL); - } - - if (thread->is_thread_lock) - (void) pthread_mutex_destroy(&(thread->lock)); - - _wakeup_close(thread); - - while (thread->dcon_list != NULL) - gearmand_con_free(thread->dcon_list); - - while (thread->dcon_add_list != NULL) - { - dcon= thread->dcon_add_list; - thread->dcon_add_list= dcon->next; - close(dcon->fd); - free(dcon); - } - - while (thread->free_dcon_list != NULL) - { - dcon= thread->free_dcon_list; - thread->free_dcon_list= dcon->next; - free(dcon); - } - - gearman_server_thread_free(&(thread->server_thread)); - - GEARMAN_LIST_DEL(thread->gearmand->thread, thread,) - - if (thread->gearmand->threads > 0) - { - if (thread->base != NULL) - event_base_free(thread->base); - - gearmand_log_info(thread->gearmand, "Thread %u shutdown complete", thread->count); - } - - free(thread); -} - -void gearmand_thread_wakeup(gearmand_thread_st *thread, - gearmand_wakeup_t wakeup) -{ - uint8_t buffer= wakeup; - - /* If this fails, there is not much we can really do. This should never fail - though if the thread is still active. */ - if (write(thread->wakeup_fd[1], &buffer, 1) != 1) - gearmand_log_error(thread->gearmand, "gearmand_thread_wakeup:write:%d", errno); -} - -void gearmand_thread_run(gearmand_thread_st *thread) -{ - gearman_server_con_st *server_con; - gearman_return_t ret; - gearmand_con_st *dcon; - - while (1) - { - server_con= gearman_server_thread_run(&(thread->server_thread), &ret); - if (ret == GEARMAN_SUCCESS || ret == GEARMAN_IO_WAIT || - ret == GEARMAN_SHUTDOWN_GRACEFUL) - { - return; - } - - if (server_con == NULL) - { - /* We either got a GEARMAN_SHUTDOWN or some other fatal internal error. - Either way, we want to shut the server down. */ - gearmand_wakeup(thread->gearmand, GEARMAND_WAKEUP_SHUTDOWN); - return; - } - - dcon= (gearmand_con_st *)gearman_server_con_data(server_con); - - gearmand_log_info(thread->gearmand, "[%4u] %15s:%5s Disconnected", thread->count, dcon->host, dcon->port); - - gearmand_con_free(dcon); - } -} - -/* - * Private definitions - */ - -static void *_thread(void *data) -{ - gearmand_thread_st *thread= (gearmand_thread_st *)data; - - gearmand_log_info(thread->gearmand, "[%4u] Entering thread event loop", thread->count); - - if (event_base_loop(thread->base, 0) == -1) - { - gearmand_log_fatal(thread->gearmand, "_io_thread:event_base_loop:-1"); - thread->gearmand->ret= GEARMAN_EVENT; - } - - gearmand_log_info(thread->gearmand, "[%4u] Exiting thread event loop", thread->count); - - return NULL; -} - -static void _log(const char *line, gearman_verbose_t verbose, void *context) -{ - gearmand_thread_st *dthread= (gearmand_thread_st *)context; - char buffer[GEARMAN_MAX_ERROR_SIZE]; - - snprintf(buffer, GEARMAN_MAX_ERROR_SIZE, "[%4u] %s", dthread->count, line); - (*dthread->gearmand->log_fn)(buffer, verbose, - (void *)dthread->gearmand->log_context); -} - -static void _run(gearman_server_thread_st *thread __attribute__ ((unused)), - void *fn_arg) -{ - gearmand_thread_st *dthread= (gearmand_thread_st *)fn_arg; - gearmand_thread_wakeup(dthread, GEARMAND_WAKEUP_RUN); -} - -static gearman_return_t _wakeup_init(gearmand_thread_st *thread) -{ - int ret; - - gearmand_log_info(thread->gearmand, "Creating IO thread wakeup pipe"); - - ret= pipe(thread->wakeup_fd); - if (ret == -1) - { - gearmand_log_fatal(thread->gearmand, "_wakeup_init:pipe:%d", errno); - return GEARMAN_ERRNO; - } - - ret= fcntl(thread->wakeup_fd[0], F_GETFL, 0); - if (ret == -1) - { - gearmand_log_fatal(thread->gearmand, "_wakeup_init:fcntl:F_GETFL:%d", errno); - return GEARMAN_ERRNO; - } - - ret= fcntl(thread->wakeup_fd[0], F_SETFL, ret | O_NONBLOCK); - if (ret == -1) - { - gearmand_log_fatal(thread->gearmand, "_wakeup_init:fcntl:F_SETFL:%d", errno); - return GEARMAN_ERRNO; - } - - event_set(&(thread->wakeup_event), thread->wakeup_fd[0], EV_READ | EV_PERSIST, - _wakeup_event, thread); - event_base_set(thread->base, &(thread->wakeup_event)); - - if (event_add(&(thread->wakeup_event), NULL) == -1) - { - gearmand_log_fatal(thread->gearmand, "_wakeup_init:event_add:-1"); - return GEARMAN_EVENT; - } - - thread->is_wakeup_event= true; - - return GEARMAN_SUCCESS; -} - -static void _wakeup_close(gearmand_thread_st *thread) -{ - _wakeup_clear(thread); - - if (thread->wakeup_fd[0] >= 0) - { - gearmand_log_info(thread->gearmand, "Closing IO thread wakeup pipe"); - close(thread->wakeup_fd[0]); - thread->wakeup_fd[0]= -1; - close(thread->wakeup_fd[1]); - thread->wakeup_fd[1]= -1; - } -} - -static void _wakeup_clear(gearmand_thread_st *thread) -{ - if (thread->is_wakeup_event) - { - gearmand_log_info(thread->gearmand, "[%4u] Clearing event for IO thread wakeup pipe", thread->count); - int del_ret= event_del(&(thread->wakeup_event)); - assert(del_ret == 0); - thread->is_wakeup_event= false; - } -} - -static void _wakeup_event(int fd, short events __attribute__ ((unused)), void *arg) -{ - gearmand_thread_st *thread= (gearmand_thread_st *)arg; - uint8_t buffer[GEARMAN_PIPE_BUFFER_SIZE]; - ssize_t ret; - ssize_t x; - - while (1) - { - ret= read(fd, buffer, GEARMAN_PIPE_BUFFER_SIZE); - if (ret == 0) - { - _clear_events(thread); - gearmand_log_fatal(thread->gearmand, "_wakeup_event:read:EOF"); - thread->gearmand->ret= GEARMAN_PIPE_EOF; - return; - } - else if (ret == -1) - { - if (errno == EINTR) - continue; - - if (errno == EAGAIN) - break; - - _clear_events(thread); - gearmand_log_fatal(thread->gearmand, "_wakeup_event:read:%d", errno); - thread->gearmand->ret= GEARMAN_ERRNO; - return; - } - - for (x= 0; x < ret; x++) - { - switch ((gearmand_wakeup_t)buffer[x]) - { - case GEARMAND_WAKEUP_PAUSE: - gearmand_log_info(thread->gearmand, "[%4u] Received PAUSE wakeup event", thread->count); - break; - - case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: - gearmand_log_info(thread->gearmand, - "[%4u] Received SHUTDOWN_GRACEFUL wakeup event", - thread->count); - if (gearman_server_shutdown_graceful(&(thread->gearmand->server)) == GEARMAN_SHUTDOWN) - { - gearmand_wakeup(thread->gearmand, GEARMAND_WAKEUP_SHUTDOWN); - } - break; - - case GEARMAND_WAKEUP_SHUTDOWN: - gearmand_log_info(thread->gearmand, "[%4u] Received SHUTDOWN wakeup event", thread->count); - _clear_events(thread); - break; - - case GEARMAND_WAKEUP_CON: - gearmand_log_info(thread->gearmand, "[%4u] Received CON wakeup event", thread->count); - gearmand_con_check_queue(thread); - break; - - case GEARMAND_WAKEUP_RUN: - gearmand_log_debug(thread->gearmand, "[%4u] Received RUN wakeup event", thread->count); - gearmand_thread_run(thread); - break; - - default: - gearmand_log_fatal(thread->gearmand, "[%4u] Received unknown wakeup event (%u)", thread->count, buffer[x]); - _clear_events(thread); - thread->gearmand->ret= GEARMAN_UNKNOWN_STATE; - break; - } - } - } -} - -static void _clear_events(gearmand_thread_st *thread) -{ - _wakeup_clear(thread); - - while (thread->dcon_list != NULL) - gearmand_con_free(thread->dcon_list); -} diff -Nru gearmand-0.14/libgearman-server/gearmand_thread.cc gearmand-0.23/libgearman-server/gearmand_thread.cc --- gearmand-0.14/libgearman-server/gearmand_thread.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/gearmand_thread.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,431 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Gearmand Thread Definitions + */ + +#include +#include + +#include +#include + +#include + +/* + * Private declarations + */ + +/** + * @addtogroup gearmand_thread_private Private Gearmand Thread Functions + * @ingroup gearmand_thread + * @{ + */ + +static void *_thread(void *data); +static void _log(const char *line, gearmand_verbose_t verbose, gearmand_thread_st *dthread); +static void _run(gearman_server_thread_st *thread, void *fn_arg); + +static gearmand_error_t _wakeup_init(gearmand_thread_st *thread); +static void _wakeup_close(gearmand_thread_st *thread); +static void _wakeup_clear(gearmand_thread_st *thread); +static void _wakeup_event(int fd, short events, void *arg); +static void _clear_events(gearmand_thread_st *thread); + +/** @} */ + +/* + * Public definitions + */ + +gearmand_error_t gearmand_thread_create(gearmand_st *gearmand) +{ + gearmand_thread_st *thread; + gearmand_error_t ret; + + thread= static_cast(malloc(sizeof(gearmand_thread_st))); + if (not thread) + { + return gearmand_merror("malloc", gearmand_thread_st, 1); + } + + if (! gearman_server_thread_init(gearmand_server(gearmand), &(thread->server_thread), + _log, thread, gearmand_connection_watch)) + { + free(thread); + gearmand_fatal("gearman_server_thread_init(NULL)"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + thread->is_thread_lock= false; + thread->is_wakeup_event= false; + thread->count= 0; + thread->dcon_count= 0; + thread->dcon_add_count= 0; + thread->free_dcon_count= 0; + thread->wakeup_fd[0]= -1; + thread->wakeup_fd[1]= -1; + + gearmand_thread_list_add(thread); + + thread->dcon_list= NULL; + thread->dcon_add_list= NULL; + thread->free_dcon_list= NULL; + + /* If we have no threads, we still create a fake thread that uses the main + libevent instance. Otherwise create a libevent instance for each thread. */ + if (gearmand->threads == 0) + { + thread->base= gearmand->base; + } + else + { + gearmand_info("Initializing libevent for IO thread"); + + thread->base= static_cast(event_base_new()); + if (thread->base == NULL) + { + gearmand_thread_free(thread); + gearmand_fatal("event_base_new(NULL)"); + return GEARMAN_EVENT; + } + } + + ret= _wakeup_init(thread); + if (ret != GEARMAN_SUCCESS) + { + gearmand_thread_free(thread); + return ret; + } + + /* If we are not running multi-threaded, just return the thread context. */ + if (gearmand->threads == 0) + return GEARMAN_SUCCESS; + + thread->count= gearmand->thread_count; + + int pthread_ret; + pthread_ret= pthread_mutex_init(&(thread->lock), NULL); + if (pthread_ret != 0) + { + thread->count= 0; + gearmand_thread_free(thread); + + errno= pthread_ret; + gearmand_fatal_perror("pthread_mutex_init"); + return GEARMAN_ERRNO; + } + + thread->is_thread_lock= true; + + gearman_server_thread_set_run(&(thread->server_thread), _run, thread); + + pthread_ret= pthread_create(&(thread->id), NULL, _thread, thread); + if (pthread_ret != 0) + { + thread->count= 0; + gearmand_thread_free(thread); + + errno= pthread_ret; + gearmand_perror("pthread_create"); + + return GEARMAN_ERRNO; + } + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Thread %u created", thread->count); + + return GEARMAN_SUCCESS; +} + +void gearmand_thread_free(gearmand_thread_st *thread) +{ + gearmand_con_st *dcon; + + if (Gearmand()->threads && thread->count > 0) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Shutting down thread %u", thread->count); + + gearmand_thread_wakeup(thread, GEARMAND_WAKEUP_SHUTDOWN); + (void) pthread_join(thread->id, NULL); + } + + if (thread->is_thread_lock) + (void) pthread_mutex_destroy(&(thread->lock)); + + _wakeup_close(thread); + + while (thread->dcon_list != NULL) + { + gearmand_con_free(thread->dcon_list); + } + + while (thread->dcon_add_list != NULL) + { + dcon= thread->dcon_add_list; + thread->dcon_add_list= dcon->next; + gearmand_sockfd_close(dcon->fd); + free(dcon); + } + + while (thread->free_dcon_list != NULL) + { + dcon= thread->free_dcon_list; + thread->free_dcon_list= dcon->next; + free(dcon); + } + + gearman_server_thread_free(&(thread->server_thread)); + + gearmand_thread_list_free(thread); + + if (Gearmand()->threads > 0) + { + if (thread->base != NULL) + event_base_free(thread->base); + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Thread %u shutdown complete", thread->count); + } + + free(thread); +} + +void gearmand_thread_wakeup(gearmand_thread_st *thread, + gearmand_wakeup_t wakeup) +{ + uint8_t buffer= wakeup; + + /* If this fails, there is not much we can really do. This should never fail + though if the thread is still active. */ + if (write(thread->wakeup_fd[1], &buffer, 1) != 1) + { + gearmand_perror("write"); + } +} + +void gearmand_thread_run(gearmand_thread_st *thread) +{ + while (1) + { + gearmand_error_t ret; + gearmand_con_st *dcon= gearman_server_thread_run(&(thread->server_thread), &ret); + + if (ret == GEARMAN_SUCCESS || ret == GEARMAN_IO_WAIT || + ret == GEARMAN_SHUTDOWN_GRACEFUL) + { + return; + } + + if (not dcon) + { + /* We either got a GEARMAN_SHUTDOWN or some other fatal internal error. + Either way, we want to shut the server down. */ + gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); + return; + } + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Disconnected %s:%s", dcon->host, dcon->port); + + gearmand_con_free(dcon); + } +} + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/* + * Private definitions + */ + +static void *_thread(void *data) +{ + gearmand_thread_st *thread= (gearmand_thread_st *)data; + char buffer[BUFSIZ]; + + snprintf(buffer, sizeof(buffer), "[%6u ]", thread->count); + + gearmand_initialize_thread_logging(buffer); + + gearmand_info("Entering thread event loop"); + + if (event_base_loop(thread->base, 0) == -1) + { + gearmand_fatal("event_base_loop(-1)"); + Gearmand()->ret= GEARMAN_EVENT; + } + + gearmand_info("Exiting thread event loop"); + + return NULL; +} + +static void _log(const char *line, gearmand_verbose_t verbose, gearmand_thread_st *dthread) +{ + (void)dthread; + (*Gearmand()->log_fn)(line, verbose, (void *)Gearmand()->log_context); +} + +static void _run(gearman_server_thread_st *thread __attribute__ ((unused)), + void *fn_arg) +{ + gearmand_thread_st *dthread= (gearmand_thread_st *)fn_arg; + gearmand_thread_wakeup(dthread, GEARMAND_WAKEUP_RUN); +} + +static gearmand_error_t _wakeup_init(gearmand_thread_st *thread) +{ + int ret; + + gearmand_info("Creating IO thread wakeup pipe"); + + ret= pipe(thread->wakeup_fd); + if (ret == -1) + { + gearmand_perror("pipe"); + return GEARMAN_ERRNO; + } + + ret= fcntl(thread->wakeup_fd[0], F_GETFL, 0); + if (ret == -1) + { + gearmand_perror("fcntl(F_GETFL)"); + return GEARMAN_ERRNO; + } + + ret= fcntl(thread->wakeup_fd[0], F_SETFL, ret | O_NONBLOCK); + if (ret == -1) + { + gearmand_perror("fcntl(F_SETFL)"); + return GEARMAN_ERRNO; + } + + event_set(&(thread->wakeup_event), thread->wakeup_fd[0], EV_READ | EV_PERSIST, + _wakeup_event, thread); + event_base_set(thread->base, &(thread->wakeup_event)); + + if (event_add(&(thread->wakeup_event), NULL) < 0) + { + gearmand_perror("event_add"); + return GEARMAN_EVENT; + } + + thread->is_wakeup_event= true; + + return GEARMAN_SUCCESS; +} + +static void _wakeup_close(gearmand_thread_st *thread) +{ + _wakeup_clear(thread); + + if (thread->wakeup_fd[0] >= 0) + { + gearmand_info("Closing IO thread wakeup pipe"); + gearmand_pipe_close(thread->wakeup_fd[0]); + thread->wakeup_fd[0]= -1; + gearmand_pipe_close(thread->wakeup_fd[1]); + thread->wakeup_fd[1]= -1; + } +} + +static void _wakeup_clear(gearmand_thread_st *thread) +{ + if (thread->is_wakeup_event) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Clearing event for IO thread wakeup pipe %u", thread->count); + if (event_del(&(thread->wakeup_event)) < 0) + { + gearmand_perror("event_del"); + assert(! "event_del"); + } + thread->is_wakeup_event= false; + } +} + +static void _wakeup_event(int fd, short events __attribute__ ((unused)), void *arg) +{ + gearmand_thread_st *thread= (gearmand_thread_st *)arg; + uint8_t buffer[GEARMAN_PIPE_BUFFER_SIZE]; + ssize_t ret; + + while (1) + { + ret= read(fd, buffer, GEARMAN_PIPE_BUFFER_SIZE); + if (ret == 0) + { + _clear_events(thread); + gearmand_fatal("read(EOF)"); + Gearmand()->ret= GEARMAN_PIPE_EOF; + return; + } + else if (ret == -1) + { + if (errno == EINTR) + continue; + + if (errno == EAGAIN) + break; + + _clear_events(thread); + gearmand_perror("_wakeup_event:read"); + Gearmand()->ret= GEARMAN_ERRNO; + return; + } + + for (ssize_t x= 0; x < ret; x++) + { + switch ((gearmand_wakeup_t)buffer[x]) + { + case GEARMAND_WAKEUP_PAUSE: + gearmand_info("Received PAUSE wakeup event"); + break; + + case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: + gearmand_info("Received SHUTDOWN_GRACEFUL wakeup event"); + if (gearman_server_shutdown_graceful(&(Gearmand()->server)) == GEARMAN_SHUTDOWN) + { + gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); + } + break; + + case GEARMAND_WAKEUP_SHUTDOWN: + gearmand_info("Received SHUTDOWN wakeup event"); + _clear_events(thread); + break; + + case GEARMAND_WAKEUP_CON: + gearmand_info("Received CON wakeup event"); + gearmand_con_check_queue(thread); + break; + + case GEARMAND_WAKEUP_RUN: + gearmand_debug("Received RUN wakeup event"); + gearmand_thread_run(thread); + break; + + default: + gearmand_log_fatal(GEARMAN_DEFAULT_LOG_PARAM, "Received unknown wakeup event (%u)", buffer[x]); + _clear_events(thread); + Gearmand()->ret= GEARMAN_UNKNOWN_STATE; + break; + } + } + } +} + +static void _clear_events(gearmand_thread_st *thread) +{ + _wakeup_clear(thread); + + while (thread->dcon_list != NULL) + { + gearmand_con_free(thread->dcon_list); + } +} diff -Nru gearmand-0.14/libgearman-server/gearmand_thread.h gearmand-0.23/libgearman-server/gearmand_thread.h --- gearmand-0.14/libgearman-server/gearmand_thread.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/gearmand_thread.h 2011-06-03 04:13:30.000000000 +0200 @@ -11,8 +11,9 @@ * @brief Thread Declarations */ -#ifndef __GEARMAND_THREAD_H__ -#define __GEARMAND_THREAD_H__ +#pragma once + +#include #ifdef __cplusplus extern "C" { @@ -38,7 +39,6 @@ int wakeup_fd[2]; gearmand_thread_st *next; gearmand_thread_st *prev; - gearmand_st *gearmand; struct event_base *base; gearmand_con_st *dcon_list; gearmand_con_st *dcon_add_list; @@ -56,7 +56,7 @@ * @return Standard gearman return value. */ GEARMAN_API -gearman_return_t gearmand_thread_create(gearmand_st *gearmand); +gearmand_error_t gearmand_thread_create(struct gearmand_st *gearmand); /** * Free resources used by a thread. @@ -88,5 +88,3 @@ #ifdef __cplusplus } #endif - -#endif /* __GEARMAND_THREAD_H__ */ diff -Nru gearmand-0.14/libgearman-server/hash.c gearmand-0.23/libgearman-server/hash.c --- gearmand-0.14/libgearman-server/hash.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/hash.c 2011-03-30 19:34:07.000000000 +0200 @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +void gearmand_hash_server_add(gearman_server_st *server, + uint32_t key, + gearman_server_job_st *server_job) +{ + GEARMAN_HASH_ADD(server->job, key, server_job,); +} + +void gearmand_hash_server_free(gearman_server_st *server, + uint32_t key, gearman_server_job_st *server_job) +{ + GEARMAN_HASH_DEL(server->job, key, server_job,); +} diff -Nru gearmand-0.14/libgearman-server/hash.h gearmand-0.23/libgearman-server/hash.h --- gearmand-0.14/libgearman-server/hash.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/hash.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,55 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_INTERNAL_API + void gearmand_hash_server_add(gearman_server_st *server, + uint32_t key, + gearman_server_job_st *server_job); + +GEARMAN_INTERNAL_API + void gearmand_hash_server_free(gearman_server_st *server, + uint32_t key, gearman_server_job_st *server_job); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/include.am gearmand-0.23/libgearman-server/include.am --- gearmand-0.14/libgearman-server/include.am 2010-06-29 21:53:59.000000000 +0200 +++ gearmand-0.23/libgearman-server/include.am 2011-06-03 04:13:30.000000000 +0200 @@ -1,5 +1,6 @@ # vim:ft=automake # Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day # Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor # All rights reserved. @@ -9,93 +10,76 @@ # # Included from Top Level Makefile.am # All paths should be given relative to the root +# -if HAVE_LIBDRIZZLE -QUEUE_LIBDRIZZLE_H= libgearman-server/queue_libdrizzle.h -QUEUE_LIBDRIZZLE_C= libgearman-server/queue_libdrizzle.c -endif - -if HAVE_LIBMEMCACHED -QUEUE_LIBMEMCACHED_H= libgearman-server/queue_libmemcached.h -QUEUE_LIBMEMCACHED_C= libgearman-server/queue_libmemcached.c -endif - -if HAVE_LIBSQLITE3 -QUEUE_LIBSQLITE3_H= libgearman-server/queue_libsqlite3.h -QUEUE_LIBSQLITE3_C= libgearman-server/queue_libsqlite3.c -endif - -if HAVE_LIBPQ -QUEUE_LIBPQ_H= libgearman-server/queue_libpq.h -QUEUE_LIBPQ_C= libgearman-server/queue_libpq.c -endif - -if HAVE_LIBTOKYOCABINET -QUEUE_LIBTOKYOCABINET_H= libgearman-server/queue_libtokyocabinet.h -QUEUE_LIBTOKYOCABINET_C= libgearman-server/queue_libtokyocabinet.c -endif +libgearman_server_libgearman_server_la_SOURCES= +libgearman_server_libgearman_server_la_LIBADD= +libgearman_server_libgearman_server_la_CXXFLAGS= +libgearman_server_libgearman_server_la_CFLAGS= -noinst_LTLIBRARIES+= libgearman-server/libgearman-server.la +include libgearman-server/error/include.am +include libgearman-server/plugins/include.am +noinst_LTLIBRARIES+= libgearman-server/libgearman-server.la -noinst_HEADERS += \ - $(QUEUE_LIBDRIZZLE_H) \ - $(QUEUE_LIBMEMCACHED_H) \ - $(QUEUE_LIBPQ_H) \ - $(QUEUE_LIBSQLITE3_H) \ - $(QUEUE_LIBTOKYOCABINET_H) \ - libgearman-server/client.h \ - libgearman-server/conf.h \ - libgearman-server/conf_module.h \ - libgearman-server/connection.h \ - libgearman-server/constants.h \ - libgearman-server/function.h \ - libgearman-server/gearmand.h \ - libgearman-server/gearmand_con.h \ - libgearman-server/gearmand_thread.h \ - libgearman-server/job.h \ - libgearman-server/log.h \ - libgearman-server/packet.h \ - libgearman-server/protocol_http.h \ - libgearman-server/server.h \ - libgearman-server/thread.h \ - libgearman-server/worker.h noinst_HEADERS+= \ - libgearman-server/common.h + libgearman-server/byte.h \ + libgearman-server/byteorder.h \ + libgearman-server/client.h \ + libgearman-server/common.h \ + libgearman-server/connection.h \ + libgearman-server/connection_list.h \ + libgearman-server/constants.h \ + libgearman-server/fifo.h \ + libgearman-server/function.h \ + libgearman-server/gearmand.h \ + libgearman-server/gearmand_con.h \ + libgearman-server/gearmand_thread.h \ + libgearman-server/hash.h \ + libgearman-server/io.h \ + libgearman-server/job.h \ + libgearman-server/list.h \ + libgearman-server/log.h \ + libgearman-server/packet.h \ + libgearman-server/queue.h \ + libgearman-server/plugins.h \ + libgearman-server/port.h \ + libgearman-server/server.h \ + libgearman-server/thread.h \ + libgearman-server/wakeup.h \ + libgearman-server/worker.h + +libgearman_server_libgearman_server_la_SOURCES+= \ + libgearman-server/byteorder.cc \ + libgearman-server/client.cc \ + libgearman-server/connection.c \ + libgearman-server/connection_list.cc \ + libgearman-server/fifo.c \ + libgearman-server/function.cc \ + libgearman-server/gearmand.cc \ + libgearman-server/gearmand_con.c \ + libgearman-server/gearmand_thread.cc \ + libgearman-server/hash.c \ + libgearman-server/io.cc \ + libgearman-server/job.c \ + libgearman-server/list.c \ + libgearman-server/log.cc \ + libgearman-server/packet.cc \ + libgearman-server/plugins.cc \ + libgearman-server/queue.cc \ + libgearman-server/server.c \ + libgearman-server/thread.c \ + libgearman-server/wakeup.cc \ + libgearman-server/worker.cc \ + libgearman/command.cc -libgearman_server_libgearman_server_la_SOURCES= \ - $(QUEUE_LIBDRIZZLE_C) \ - $(QUEUE_LIBMEMCACHED_C) \ - $(QUEUE_LIBPQ_C) \ - $(QUEUE_LIBSQLITE3_C) \ - $(QUEUE_LIBTOKYOCABINET_C) \ - libgearman-server/client.c \ - libgearman-server/conf.c \ - libgearman-server/conf_module.c \ - libgearman-server/connection.c \ - libgearman-server/function.c \ - libgearman-server/gearmand.c \ - libgearman-server/gearmand_con.c \ - libgearman-server/gearmand_thread.c \ - libgearman-server/job.c \ - libgearman-server/log.c \ - libgearman-server/packet.c \ - libgearman-server/protocol_http.c \ - libgearman-server/server.c \ - libgearman-server/thread.c \ - libgearman-server/worker.c - -libgearman_server_libgearman_server_la_CFLAGS= \ +libgearman_server_libgearman_server_la_CFLAGS+= \ ${AM_CFLAGS} \ -DBUILDING_LIBGEARMAN -libgearman_server_libgearman_server_la_LIBADD= \ - $(LTLIBDRIZZLE) \ - $(LTLIBEVENT) \ - $(LTLIBMEMCACHED) \ - $(LTLIBPQ) \ - $(LTLIBSQLITE3) \ - $(LTLIBTOKYOCABINET) \ - libgearman/libgearman.la \ - libgearman/libgearmancore.la +libgearman_server_libgearman_server_la_CXXFLAGS+= \ + ${AM_CXXFLAGS} \ + -DBUILDING_LIBGEARMAN + +libgearman_server_libgearman_server_la_LIBADD+= $(LTLIBEVENT) diff -Nru gearmand-0.14/libgearman-server/io.cc gearmand-0.23/libgearman-server/io.cc --- gearmand-0.14/libgearman-server/io.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/io.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,821 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Connection Definitions + */ + +#include + +#include +#include +#include + +static gearmand_error_t gearmand_connection_recv_data(gearman_server_con_st *con, void *data, size_t data_size); + +static void _connection_close(gearmand_io_st *connection); +static gearmand_error_t _connection_flush(gearman_server_con_st * con); +size_t _connection_read(gearman_server_con_st *con, void *data, size_t data_size, + gearmand_error_t &ret); + +/** + * @addtogroup gearmand_io_static Static Connection Declarations + * @ingroup gearman_connection + * @{ + */ + + +void gearmand_connection_init(gearmand_connection_list_st *gearman, + gearmand_io_st *connection, + gearmand_con_st *dcon, + gearmand_connection_options_t *options) +{ + assert(gearman); + assert(connection); + + connection->options.ready= false; + connection->options.packet_in_use= false; + connection->options.external_fd= false; + connection->options.close_after_flush= false; + + if (options) + { + while (*options != GEARMAND_CON_MAX) + { + gearman_io_set_option(connection, *options, true); + options++; + } + } + + + connection->_state= gearmand_io_st::GEARMAND_CON_UNIVERSAL_INVALID; + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE; + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE; + connection->events= 0; + connection->revents= 0; + connection->fd= INVALID_SOCKET; + connection->created_id= 0; + connection->created_id_next= 0; + connection->send_buffer_size= 0; + connection->send_data_size= 0; + connection->send_data_offset= 0; + connection->recv_buffer_size= 0; + connection->recv_data_size= 0; + connection->recv_data_offset= 0; + connection->universal= gearman; + + if (gearman->con_list != NULL) + gearman->con_list->prev= connection; + connection->next= gearman->con_list; + connection->prev= NULL; + gearman->con_list= connection; + gearman->con_count++; + + connection->context= dcon; + + connection->send_buffer_ptr= connection->send_buffer; + connection->recv_packet= NULL; + connection->recv_buffer_ptr= connection->recv_buffer; +} + +void gearmand_io_free(gearmand_io_st *connection) +{ + if (connection->fd != INVALID_SOCKET) + _connection_close(connection); + + { + if (connection->universal->con_list == connection) + connection->universal->con_list= connection->next; + + if (connection->prev != NULL) + connection->prev->next= connection->next; + + if (connection->next != NULL) + connection->next->prev= connection->prev; + connection->universal->con_count--; + } + + if (connection->options.packet_in_use) + { + gearmand_packet_free(&(connection->packet)); + } +} + +gearmand_error_t gearman_io_set_option(gearmand_io_st *connection, + gearmand_connection_options_t options, + bool value) +{ + switch (options) + { + case GEARMAND_CON_READY: + connection->options.ready= value; + break; + case GEARMAND_CON_PACKET_IN_USE: + connection->options.packet_in_use= value; + break; + case GEARMAND_CON_EXTERNAL_FD: + connection->options.external_fd= value; + break; + case GEARMAND_CON_CLOSE_AFTER_FLUSH: + connection->options.close_after_flush= value; + break; + case GEARMAND_CON_MAX: + return GEARMAN_INVALID_COMMAND; + } + + return GEARMAN_SUCCESS; +} + +/** + * Set socket options for a connection. + */ +static gearmand_error_t _io_setsockopt(gearmand_io_st &connection); + +/** @} */ + +/* + * Public Definitions + */ + +gearmand_error_t gearman_io_set_fd(gearmand_io_st *connection, int fd) +{ + assert(connection); + + connection->options.external_fd= true; + connection->fd= fd; + connection->_state= gearmand_io_st::GEARMAND_CON_UNIVERSAL_CONNECTED; + + return _io_setsockopt(*connection); +} + +gearmand_con_st *gearman_io_context(const gearmand_io_st *connection) +{ + return connection->context; +} + +static void _connection_close(gearmand_io_st *connection) +{ + if (connection->fd == INVALID_SOCKET) + return; + + if (connection->options.external_fd) + { + connection->options.external_fd= false; + } + else + { + (void)gearmand_sockfd_close(connection->fd); + assert(! "We should never have an internal fd"); + } + + connection->_state= gearmand_io_st::GEARMAND_CON_UNIVERSAL_INVALID; + connection->fd= INVALID_SOCKET; + connection->events= 0; + connection->revents= 0; + + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE; + connection->send_buffer_ptr= connection->send_buffer; + connection->send_buffer_size= 0; + connection->send_data_size= 0; + connection->send_data_offset= 0; + + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE; + if (connection->recv_packet != NULL) + { + gearmand_packet_free(connection->recv_packet); + connection->recv_packet= NULL; + } + + connection->recv_buffer_ptr= connection->recv_buffer; + connection->recv_buffer_size= 0; +} + +gearmand_error_t gearman_io_send(gearman_server_con_st *con, + const gearmand_packet_st *packet, bool flush) +{ + gearmand_error_t ret; + size_t send_size; + + gearmand_io_st *connection= &con->con; + + switch (connection->send_state) + { + case gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE: + if (! (packet->options.complete)) + { + gearmand_error("packet not complete"); + return GEARMAN_INVALID_PACKET; + } + + /* Pack first part of packet, which is everything but the payload. */ + while (1) + { + send_size= con->protocol.packet_pack_fn(packet, con, + connection->send_buffer + connection->send_buffer_size, + GEARMAN_SEND_BUFFER_SIZE - + connection->send_buffer_size, &ret); + if (ret == GEARMAN_SUCCESS) + { + connection->send_buffer_size+= send_size; + break; + } + else if (ret == GEARMAN_IGNORE_PACKET) + { + return GEARMAN_SUCCESS; + } + else if (ret != GEARMAN_FLUSH_DATA) + { + return ret; + } + + /* We were asked to flush when the buffer is already flushed! */ + if (connection->send_buffer_size == 0) + { + gearmand_error("send buffer too small"); + + return GEARMAN_SEND_BUFFER_TOO_SMALL; + } + + /* Flush buffer now if first part of packet won't fit in. */ + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_PRE_FLUSH; + + case gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_PRE_FLUSH: + ret= _connection_flush(con); + if (ret != GEARMAN_SUCCESS) + { + return ret; + } + } + + /* Return here if we have no data to send. */ + if (packet->data_size == 0) + break; + + /* If there is any room in the buffer, copy in data. */ + if (packet->data and (GEARMAN_SEND_BUFFER_SIZE - connection->send_buffer_size) > 0) + { + connection->send_data_offset= GEARMAN_SEND_BUFFER_SIZE - connection->send_buffer_size; + if (connection->send_data_offset > packet->data_size) + connection->send_data_offset= packet->data_size; + + memcpy(connection->send_buffer + connection->send_buffer_size, packet->data, + connection->send_data_offset); + connection->send_buffer_size+= connection->send_data_offset; + + /* Return if all data fit in the send buffer. */ + if (connection->send_data_offset == packet->data_size) + { + connection->send_data_offset= 0; + break; + } + } + + /* Flush buffer now so we can start writing directly from data buffer. */ + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FORCE_FLUSH; + + case gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FORCE_FLUSH: + ret= _connection_flush(con); + if (ret != GEARMAN_SUCCESS) + { + return ret; + } + + connection->send_data_size= packet->data_size; + + /* If this is NULL, then ?? function will be used. */ + if (packet->data == NULL) + { + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH_DATA; + return GEARMAN_SUCCESS; + } + + /* Copy into the buffer if it fits, otherwise flush from packet buffer. */ + connection->send_buffer_size= packet->data_size - connection->send_data_offset; + if (connection->send_buffer_size < GEARMAN_SEND_BUFFER_SIZE) + { + memcpy(connection->send_buffer, + packet->data + connection->send_data_offset, + connection->send_buffer_size); + connection->send_data_size= 0; + connection->send_data_offset= 0; + break; + } + + connection->send_buffer_ptr= const_cast(packet->data) + connection->send_data_offset; + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH_DATA; + + case gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH: + case gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH_DATA: + ret= _connection_flush(con); + if (ret == GEARMAN_SUCCESS && connection->options.close_after_flush) + { + _connection_close(connection); + ret= GEARMAN_LOST_CONNECTION; + gearmand_gerror("failure while flusing data, closing connection", ret); + } + return ret; + } + + if (flush) + { + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH; + ret= _connection_flush(con); + if (ret == GEARMAN_SUCCESS && connection->options.close_after_flush) + { + _connection_close(connection); + ret= GEARMAN_LOST_CONNECTION; + gearmand_gerror("failure while flusing data, closing connection", ret); + } + return ret; + } + + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE; + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _connection_flush(gearman_server_con_st *con) +{ + gearmand_io_st *connection= &con->con; + + assert(connection->_state == gearmand_io_st::GEARMAND_CON_UNIVERSAL_CONNECTED); + while (1) + { + switch (connection->_state) + { + case gearmand_io_st::GEARMAND_CON_UNIVERSAL_INVALID: + assert(0); + return GEARMAN_ERRNO; + + case gearmand_io_st::GEARMAND_CON_UNIVERSAL_CONNECTED: + while (connection->send_buffer_size) + { + ssize_t write_size= send(connection->fd, connection->send_buffer_ptr, connection->send_buffer_size, MSG_NOSIGNAL|MSG_DONTWAIT); + + if (write_size == 0) // detect infinite loop? + { + gearmand_log_info("send() sent zero bytes to peer %s:%s", + connection->context == NULL ? "-" : connection->context->host, + connection->context == NULL ? "-" : connection->context->port); + continue; + } + else if (write_size == -1) + { + gearmand_error_t gret; + + switch (errno) + { + case EAGAIN: + gret= gearmand_io_set_events(con, POLLOUT); + if (gret != GEARMAN_SUCCESS) + { + return gret; + } + return GEARMAN_IO_WAIT; + + case EINTR: + continue; + + case EPIPE: + case ECONNRESET: + case EHOSTDOWN: + gearmand_perror("lost connection to client during send(EPIPE || ECONNRESET || EHOSTDOWN)"); + _connection_close(connection); + return GEARMAN_LOST_CONNECTION; + + default: + break; + } + + gearmand_perror("send() failed, closing connection"); + _connection_close(connection); + return GEARMAN_ERRNO; + } + + connection->send_buffer_size-= static_cast(write_size); + if (connection->send_state == gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH_DATA) + { + connection->send_data_offset+= static_cast(write_size); + if (connection->send_data_offset == connection->send_data_size) + { + connection->send_data_size= 0; + connection->send_data_offset= 0; + break; + } + + if (connection->send_buffer_size == 0) + { + return GEARMAN_SUCCESS; + } + } + else if (connection->send_buffer_size == 0) + { + break; + } + + connection->send_buffer_ptr+= write_size; + } + + connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE; + connection->send_buffer_ptr= connection->send_buffer; + return GEARMAN_SUCCESS; + } + } +} + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + + +gearmand_error_t gearman_io_recv(gearman_server_con_st *con, bool recv_data) +{ + gearmand_io_st *connection= &con->con; + gearmand_packet_st *packet= &(con->packet->packet); + + switch (connection->recv_state) + { + case gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE: + if (connection->_state != gearmand_io_st::GEARMAND_CON_UNIVERSAL_CONNECTED) + { + gearmand_error("not connected"); + return GEARMAN_NOT_CONNECTED; + } + + connection->recv_packet= packet; + // The options being passed in are just defaults. + gearmand_packet_init(connection->recv_packet, GEARMAN_MAGIC_TEXT, GEARMAN_COMMAND_TEXT); + + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_READ; + + case gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_READ: + while (1) + { + gearmand_error_t ret; + + if (connection->recv_buffer_size > 0) + { + size_t recv_size= con->protocol.packet_unpack_fn(connection->recv_packet, con, + connection->recv_buffer_ptr, + connection->recv_buffer_size, &ret); + connection->recv_buffer_ptr+= recv_size; + connection->recv_buffer_size-= recv_size; + if (gearmand_success(ret)) + { + break; + } + else if (ret != GEARMAN_IO_WAIT) + { + gearmand_gerror("protocol failure, closing connection", ret); + _connection_close(connection); + return ret; + } + } + + /* Shift buffer contents if needed. */ + if (connection->recv_buffer_size > 0) + memmove(connection->recv_buffer, connection->recv_buffer_ptr, connection->recv_buffer_size); + connection->recv_buffer_ptr= connection->recv_buffer; + + size_t recv_size= _connection_read(con, connection->recv_buffer + connection->recv_buffer_size, + GEARMAN_RECV_BUFFER_SIZE - connection->recv_buffer_size, ret); + if (gearmand_failed(ret)) + { + return ret; + } + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, "read %lu bytes", (unsigned long)recv_size); + + connection->recv_buffer_size+= recv_size; + } + + if (packet->data_size == 0) + { + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE; + break; + } + + connection->recv_data_size= packet->data_size; + + if (not recv_data) + { + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_STATE_READ_DATA; + break; + } + + packet->data= static_cast(malloc(packet->data_size)); + if (not packet->data) + { + // Server up the memory error first, in case _connection_close() + // creates any. + gearmand_merror("malloc", char, packet->data_size); + _connection_close(connection); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + packet->options.free_data= true; + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_STATE_READ_DATA; + + case gearmand_io_st::GEARMAND_CON_RECV_STATE_READ_DATA: + while (connection->recv_data_size) + { + gearmand_error_t ret; + ret= gearmand_connection_recv_data(con, + ((uint8_t *)(packet->data)) + + connection->recv_data_offset, + packet->data_size - + connection->recv_data_offset); + if (gearmand_failed(ret)) + { + return ret; + } + } + + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE; + break; + } + + packet= connection->recv_packet; + connection->recv_packet= NULL; + + return GEARMAN_SUCCESS; +} + +gearmand_error_t gearmand_connection_recv_data(gearman_server_con_st *con, void *data, size_t data_size) +{ + gearmand_io_st *connection= &con->con; + + if (connection->recv_data_size == 0) + { + return GEARMAN_SUCCESS; + } + + if ((connection->recv_data_size - connection->recv_data_offset) < data_size) + data_size= connection->recv_data_size - connection->recv_data_offset; + + size_t recv_size= 0; + if (connection->recv_buffer_size > 0) + { + if (connection->recv_buffer_size < data_size) + recv_size= connection->recv_buffer_size; + else + recv_size= data_size; + + memcpy(data, connection->recv_buffer_ptr, recv_size); + connection->recv_buffer_ptr+= recv_size; + connection->recv_buffer_size-= recv_size; + } + + gearmand_error_t ret; + if (data_size != recv_size) + { + recv_size+= _connection_read(con, ((uint8_t *)data) + recv_size, data_size - recv_size, ret); + connection->recv_data_offset+= recv_size; + } + else + { + connection->recv_data_offset+= recv_size; + ret= GEARMAN_SUCCESS; + } + + if (connection->recv_data_size == connection->recv_data_offset) + { + connection->recv_data_size= 0; + connection->recv_data_offset= 0; + connection->recv_state= gearmand_io_st::GEARMAND_CON_RECV_UNIVERSAL_NONE; + } + + return ret; +} + +size_t _connection_read(gearman_server_con_st *con, void *data, size_t data_size, gearmand_error_t &ret) +{ + ssize_t read_size; + gearmand_io_st *connection= &con->con; + + while (1) + { + read_size= recv(connection->fd, data, data_size, MSG_DONTWAIT); + + if (read_size == 0) + { + ret= GEARMAN_LOST_CONNECTION; + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "lost connection to client recv(peer has closed connection) %s:%s", + connection->context == NULL ? "-" : connection->context->host, + connection->context == NULL ? "-" : connection->context->port); + _connection_close(connection); + return 0; + } + else if (read_size == -1) + { + switch (errno) + { + case EAGAIN: + ret= gearmand_io_set_events(con, POLLIN); + if (gearmand_failed(ret)) + { + gearmand_perror("recv"); + return 0; + } + + ret= GEARMAN_IO_WAIT; + return 0; + + case EINTR: + continue; + + case EPIPE: + case ECONNRESET: + case EHOSTDOWN: + gearmand_perror("lost connection to client recv(EPIPE || ECONNRESET || EHOSTDOWN)"); + ret= GEARMAN_LOST_CONNECTION; + break; + + default: + gearmand_perror("recv"); + ret= GEARMAN_ERRNO; + } + + gearmand_error("closing connection due to previous errno error"); + _connection_close(connection); + return 0; + } + + break; + } + + ret= GEARMAN_SUCCESS; + return size_t(read_size); +} + +gearmand_error_t gearmand_io_set_events(gearman_server_con_st *con, short events) +{ + gearmand_io_st *connection= &con->con; + + if ((connection->events | events) == connection->events) + { + return GEARMAN_SUCCESS; + } + + connection->events|= events; + + if (connection->universal->event_watch_fn) + { + gearmand_error_t ret= connection->universal->event_watch_fn(connection, connection->events, + (void *)connection->universal->event_watch_context); + if (gearmand_failed(ret)) + { + gearmand_gerror("event watch failed, closing connection", ret); + _connection_close(connection); + return ret; + } + } + + return GEARMAN_SUCCESS; +} + +gearmand_error_t gearmand_io_set_revents(gearman_server_con_st *con, short revents) +{ + gearmand_io_st *connection= &con->con; + + if (revents != 0) + connection->options.ready= true; + + connection->revents= revents; + + /* Remove external POLLOUT watch if we didn't ask for it. Otherwise we spin + forever until another POLLIN state change. This is much more efficient + than removing POLLOUT on every state change since some external polling + mechanisms need to use a system call to change flags (like Linux epoll). */ + if (revents & POLLOUT && !(connection->events & POLLOUT) && + connection->universal->event_watch_fn != NULL) + { + gearmand_error_t ret= connection->universal->event_watch_fn(connection, connection->events, + (void *)connection->universal->event_watch_context); + if (gearmand_failed(ret)) + { + gearmand_gerror("event watch failed, closing connection", ret); + _connection_close(connection); + return ret; + } + } + + connection->events&= (short)~revents; + + return GEARMAN_SUCCESS; +} + +/* + * Static Definitions + */ + +static gearmand_error_t _io_setsockopt(gearmand_io_st &connection) +{ + struct linger linger; + struct timeval waittime; + + int setting= 1; + if (setsockopt(connection.fd, IPPROTO_TCP, TCP_NODELAY, &setting, (socklen_t)sizeof(int)) and errno != EOPNOTSUPP) + { + gearmand_perror("setsockopt(TCP_NODELAY)"); + return GEARMAN_ERRNO; + } + + linger.l_onoff= 1; + linger.l_linger= GEARMAN_DEFAULT_SOCKET_TIMEOUT; + if (setsockopt(connection.fd, SOL_SOCKET, SO_LINGER, &linger, (socklen_t)sizeof(struct linger))) + { + gearmand_perror("setsockopt(SO_LINGER)"); + return GEARMAN_ERRNO; + } + +#if defined(__MACH__) && defined(__APPLE__) || defined(__FreeBSD__) + { + setting= 1; + + // This is not considered a fatal error + if (setsockopt(connection.fd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&setting, sizeof(int))) + { + gearmand_perror("setsockopt(SO_NOSIGPIPE)"); + } + } +#endif + + waittime.tv_sec= GEARMAN_DEFAULT_SOCKET_TIMEOUT; + waittime.tv_usec= 0; + if (setsockopt(connection.fd, SOL_SOCKET, SO_SNDTIMEO, &waittime, (socklen_t)sizeof(struct timeval)) and errno != ENOPROTOOPT) + { + gearmand_perror("setsockopt(SO_SNDTIMEO)"); + return GEARMAN_ERRNO; + } + + if (setsockopt(connection.fd, SOL_SOCKET, SO_RCVTIMEO, &waittime, (socklen_t)sizeof(struct timeval)) and errno != ENOPROTOOPT) + { + gearmand_error("setsockopt(SO_RCVTIMEO)"); + return GEARMAN_ERRNO; + } + + setting= GEARMAN_DEFAULT_SOCKET_SEND_SIZE; + if (setsockopt(connection.fd, SOL_SOCKET, SO_SNDBUF, &setting, (socklen_t)sizeof(int))) + { + gearmand_perror("setsockopt(SO_SNDBUF)"); + return GEARMAN_ERRNO; + } + + setting= GEARMAN_DEFAULT_SOCKET_RECV_SIZE; + if (setsockopt(connection.fd, SOL_SOCKET, SO_RCVBUF, &setting, (socklen_t)sizeof(int))) + { + gearmand_perror("setsockopt(SO_RCVBUF)"); + return GEARMAN_ERRNO; + } + + int fcntl_flags; + if ((fcntl_flags= fcntl(connection.fd, F_GETFL, 0)) == -1) + { + gearmand_perror("fcntl(F_GETFL)"); + return GEARMAN_ERRNO; + } + + if ((fcntl(connection.fd, F_SETFL, fcntl_flags | O_NONBLOCK) == -1)) + { + gearmand_perror("fcntl(F_SETFL)"); + return GEARMAN_ERRNO; + } + + return GEARMAN_SUCCESS; +} + +void gearmand_sockfd_close(int sockfd) +{ + if (sockfd == INVALID_SOCKET) + return; + + /* in case of death shutdown to avoid blocking at close() */ + if (shutdown(sockfd, SHUT_RDWR) == SOCKET_ERROR && get_socket_errno() != ENOTCONN) + { + gearmand_perror("shutdown"); + assert(errno != ENOTSOCK); + return; + } + + if (closesocket(sockfd) == SOCKET_ERROR) + { + gearmand_perror("close"); + } +} + +void gearmand_pipe_close(int pipefd) +{ + if (pipefd == INVALID_SOCKET) + return; + + if (closesocket(pipefd) == SOCKET_ERROR) + { + gearmand_perror("close"); + } +} diff -Nru gearmand-0.14/libgearman-server/io.h gearmand-0.23/libgearman-server/io.h --- gearmand-0.14/libgearman-server/io.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/io.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,121 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Connection Declarations + */ + +#pragma once + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @addtogroup gearman_con Connection Declarations + * @ingroup gearman_universal + * + * This is a low level interface for gearman connections. This is used + * internally by both client and worker interfaces, so you probably want to + * look there first. This is usually used to write lower level clients, workers, + * proxies, or your own server. + * + * @{ + */ + +/** + * @ingroup gearman_connection + */ + +/** Initialize a connection structure. Always check the return value even if + * passing in a pre-allocated structure. Some other initialization may have + * failed. + * + * @param[in] gearman Structure previously initialized with gearman_create() or + * gearman_clone(). + * @param[in] connection Caller allocated structure, or NULL to allocate one. + * @return On success, a pointer to the (possibly allocated) structure. On + * failure this will be NULL. + */ +GEARMAN_INTERNAL_API + void gearmand_connection_init(gearmand_connection_list_st *gearman, + gearmand_io_st *connection, + struct gearmand_con_st *dcon, + gearmand_connection_options_t *options); + +/** + * Free a connection structure. + * + * @param[in] connection Structure previously initialized with gearmand_connection_init(), + * gearmand_connection_init_args(), or gearman_connection_clone(). + */ +GEARMAN_INTERNAL_API +void gearmand_io_free(gearmand_io_st *connection); + + +GEARMAN_INTERNAL_API +gearmand_error_t gearman_io_set_option(gearmand_io_st *connection, + gearmand_connection_options_t options, + bool value); + + +/** + * Set connection to an already open file descriptor. + */ +GEARMAN_INTERNAL_API +gearmand_error_t gearman_io_set_fd(gearmand_io_st *connection, int fd); + +/** + * Get application context pointer. + */ +GEARMAN_INTERNAL_API +gearmand_con_st *gearman_io_context(const gearmand_io_st *connection); + +/** + * Used by thread to send packets. + */ +GEARMAN_INTERNAL_API +gearmand_error_t gearman_io_send(gearman_server_con_st *connection, + const gearmand_packet_st *packet, bool flush); + +/** + * Used by thread to recv packets. + */ +GEARMAN_INTERNAL_API +gearmand_error_t gearman_io_recv(gearman_server_con_st *con, bool recv_data); + +/** + * Set events to be watched for a connection. + */ +GEARMAN_INTERNAL_API +gearmand_error_t gearmand_io_set_events(gearman_server_con_st *connection, short events); + +/** + * Set events that are ready for a connection. This is used with the external + * event callbacks. + */ +GEARMAN_INTERNAL_API +gearmand_error_t gearmand_io_set_revents(gearman_server_con_st *connection, short revents); + +GEARMAN_INTERNAL_API +void gearmand_sockfd_close(int sockfd); + +GEARMAN_INTERNAL_API +void gearmand_pipe_close(int sockfd); + +/** @} */ + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/job.c gearmand-0.23/libgearman-server/job.c --- gearmand-0.14/libgearman-server/job.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/job.c 2011-06-29 22:18:02.000000000 +0200 @@ -1,17 +1,53 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. */ + + /** * @file * @brief Server job definitions */ -#include "common.h" +#include +#include + +#include +#include /* * Private declarations @@ -45,30 +81,48 @@ /** @} */ +#pragma GCC diagnostic ignored "-Wold-style-cast" + /* * Public definitions */ +gearman_server_job_st * gearman_server_job_add(gearman_server_st *server, + const char *function_name, size_t function_name_size, + const char *unique, size_t unique_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + gearman_server_client_st *server_client, + gearmand_error_t *ret_ptr, + int64_t when) +{ + return gearman_server_job_add_reducer(server, + function_name, function_name_size, + unique, unique_size, + NULL, 0, // reducer + data, data_size, + priority, server_client, ret_ptr, when); +} gearman_server_job_st * -gearman_server_job_add(gearman_server_st *server, const char *function_name, - size_t function_name_size, const char *unique, - size_t unique_size, const void *data, size_t data_size, - gearman_job_priority_t priority, - gearman_server_client_st *server_client, - gearman_return_t *ret_ptr) +gearman_server_job_add_reducer(gearman_server_st *server, + const char *function_name, size_t function_name_size, + const char *unique, size_t unique_size, + const char *reducer_name, size_t reducer_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + gearman_server_client_st *server_client, + gearmand_error_t *ret_ptr, + int64_t when) { - gearman_server_job_st *server_job; - gearman_server_function_st *server_function; - uint32_t key; - - server_function= gearman_server_function_get(server, function_name, - function_name_size); + gearman_server_function_st *server_function= gearman_server_function_get(server, function_name, function_name_size); if (server_function == NULL) { *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; return NULL; } + uint32_t key; + gearman_server_job_st *server_job; if (unique_size == 0) { server_job= NULL; @@ -109,7 +163,7 @@ return NULL; } - server_job= gearman_server_job_create(server, NULL); + server_job= gearman_server_job_create(server); if (server_job == NULL) { *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; @@ -121,48 +175,73 @@ server_job->function= server_function; server_function->job_total++; - snprintf(server_job->job_handle, GEARMAN_JOB_HANDLE_SIZE, "%s:%u", - server->job_handle_prefix, server->job_handle_count); - snprintf(server_job->unique, GEARMAN_UNIQUE_SIZE, "%.*s", - (uint32_t)unique_size, unique); + int checked_length; + checked_length= snprintf(server_job->job_handle, GEARMAND_JOB_HANDLE_SIZE, "%s:%u", + server->job_handle_prefix, server->job_handle_count); + + if (checked_length >= GEARMAND_JOB_HANDLE_SIZE || checked_length < 0) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Job handle plus handle count beyond GEARMAND_JOB_HANDLE_SIZE: %s:%u", + server->job_handle_prefix, server->job_handle_count); + } + + checked_length= snprintf(server_job->unique, GEARMAN_UNIQUE_SIZE, "%.*s", + (int)unique_size, unique); + if (checked_length >= GEARMAN_UNIQUE_SIZE || checked_length < 0) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "We recieved a unique beyond GEARMAN_UNIQUE_SIZE: %.*s", (int)unique_size, unique); + } + server->job_handle_count++; server_job->data= data; server_job->data_size= data_size; + server_job->when= when; + if (reducer_size) + { + strncpy(server_job->reducer, reducer_name, reducer_size); + server_job->reducer[reducer_size]= 0; + } + else + { + server_job->reducer[0]= 0; + } + server_job->unique_key= key; - key= key % GEARMAN_JOB_HASH_SIZE; + key= key % GEARMAND_JOB_HASH_SIZE; GEARMAN_HASH_ADD(server->unique, key, server_job, unique_); key= _server_job_hash(server_job->job_handle, strlen(server_job->job_handle)); server_job->job_handle_key= key; - key= key % GEARMAN_JOB_HASH_SIZE; - GEARMAN_HASH_ADD(server->job, key, server_job,); + key= key % GEARMAND_JOB_HASH_SIZE; + gearmand_hash_server_add(server, key, server_job); if (server->state.queue_startup) { server_job->job_queued= true; } - else if (server_client == NULL && server->queue_add_fn != NULL) + else if (server_client == NULL && server->queue._add_fn != NULL) { - *ret_ptr= (*(server->queue_add_fn))(server, - (void *)server->queue_context, - server_job->unique, - unique_size, - function_name, - function_name_size, - data, data_size, priority); - if (*ret_ptr != GEARMAN_SUCCESS) + *ret_ptr= (*(server->queue._add_fn))(server, + (void *)server->queue._context, + server_job->unique, + unique_size, + function_name, + function_name_size, + data, data_size, priority, + when); + if (gearmand_failed(*ret_ptr)) { server_job->data= NULL; gearman_server_job_free(server_job); return NULL; } - if (server->queue_flush_fn != NULL) + if (server->queue._flush_fn != NULL) { - *ret_ptr= (*(server->queue_flush_fn))(server, - (void *)server->queue_context); + *ret_ptr= (*(server->queue._flush_fn))(server, + (void *)server->queue._context); if (*ret_ptr != GEARMAN_SUCCESS) { server_job->data= NULL; @@ -175,13 +254,13 @@ } *ret_ptr= gearman_server_job_queue(server_job); - if (*ret_ptr != GEARMAN_SUCCESS) + if (gearmand_failed(*ret_ptr)) { - if (server_client == NULL && server->queue_done_fn != NULL) + if (server_client == NULL && server->queue._done_fn != NULL) { /* Do our best to remove the job from the queue. */ - (void)(*(server->queue_done_fn))(server, - (void *)server->queue_context, + (void)(*(server->queue._done_fn))(server, + (void *)server->queue._context, server_job->unique, unique_size, server_job->function->function_name, server_job->function->function_name_size); @@ -192,9 +271,11 @@ } } else + { *ret_ptr= GEARMAN_JOB_EXISTS; + } - if (server_client != NULL) + if (server_client) { server_client->job= server_job; GEARMAN_LIST_ADD(server_job->client, server_client, job_) @@ -204,27 +285,21 @@ } gearman_server_job_st * -gearman_server_job_create(gearman_server_st *server, - gearman_server_job_st *server_job) +gearman_server_job_create(gearman_server_st *server) { - if (server_job == NULL) - { - if (server->free_job_count > 0) - { - server_job= server->free_job_list; - GEARMAN_LIST_DEL(server->free_job, server_job,) - } - else - { - server_job= (gearman_server_job_st *)malloc(sizeof(gearman_server_job_st)); - if (server_job == NULL) - return NULL; - } + gearman_server_job_st *server_job; - server_job->options.allocated= true; + if (server->free_job_count > 0) + { + server_job= server->free_job_list; + gearmand_server_free_job_list_free(server, server_job); } else - server_job->options.allocated= false; + { + server_job= (gearman_server_job_st *)malloc(sizeof(gearman_server_job_st)); + if (server_job == NULL) + return NULL; + } server_job->ignore_job= false; server_job->job_queued= false; @@ -236,7 +311,6 @@ server_job->numerator= 0; server_job->denominator= 0; server_job->data_size= 0; - server_job->server= server; server_job->next= NULL; server_job->prev= NULL; server_job->unique_next= NULL; @@ -258,6 +332,9 @@ { uint32_t key; + if (! server_job) + return; + if (server_job->worker != NULL) server_job->function->job_running--; @@ -272,18 +349,19 @@ if (server_job->worker != NULL) GEARMAN_LIST_DEL(server_job->worker->job, server_job, worker_) - key= server_job->unique_key % GEARMAN_JOB_HASH_SIZE; - GEARMAN_HASH_DEL(server_job->server->unique, key, server_job, unique_); + key= server_job->unique_key % GEARMAND_JOB_HASH_SIZE; + GEARMAN_HASH_DEL(Server->unique, key, server_job, unique_); - key= server_job->job_handle_key % GEARMAN_JOB_HASH_SIZE; - GEARMAN_HASH_DEL(server_job->server->job, key, server_job,); + key= server_job->job_handle_key % GEARMAND_JOB_HASH_SIZE; + gearmand_hash_server_free(Server, key, server_job); - if (server_job->options.allocated) + if (Server->free_job_count < GEARMAN_MAX_FREE_SERVER_JOB) { - if (server_job->server->free_job_count < GEARMAN_MAX_FREE_SERVER_JOB) - GEARMAN_LIST_ADD(server_job->server->free_job, server_job,) - else - free(server_job); + gearmand_server_job_list_add(Server, server_job); + } + else + { + free(server_job); } } @@ -295,7 +373,7 @@ key= _server_job_hash(job_handle, strlen(job_handle)); - for (gearman_server_job_st *server_job= server->job_hash[key % GEARMAN_JOB_HASH_SIZE]; + for (gearman_server_job_st *server_job= server->job_hash[key % GEARMAND_JOB_HASH_SIZE]; server_job != NULL; server_job= server_job->next) { if (server_job->job_handle_key == key && @@ -318,34 +396,47 @@ gearman_server_job_st * gearman_server_job_peek(gearman_server_con_st *server_con) { - gearman_server_worker_st *server_worker; - gearman_job_priority_t priority; - - for (server_worker= server_con->worker_list; server_worker != NULL; + for (gearman_server_worker_st *server_worker= server_con->worker_list; + server_worker != NULL; server_worker= server_worker->con_next) { if (server_worker->function->job_count != 0) { - for (priority= GEARMAN_JOB_PRIORITY_HIGH; - priority != GEARMAN_JOB_PRIORITY_MAX; priority++) + for (gearmand_job_priority_t priority= GEARMAND_JOB_PRIORITY_HIGH; + priority != GEARMAND_JOB_PRIORITY_MAX; priority++) { - if (server_worker->function->job_list[priority] != NULL) + gearman_server_job_st *server_job; + server_job= server_worker->function->job_list[priority]; + + int64_t current_time= (int64_t)time(NULL); + + while(server_job && + server_job->when != 0 && + server_job->when > current_time) { - if (server_worker->function->job_list[priority]->ignore_job) + server_job = server_job->function_next; + } + + if (server_job != NULL) + { + + if (server_job->ignore_job) { /* This is only happens when a client disconnects from a foreground job. We do this because we don't want to run the job anymore. */ - server_worker->function->job_list[priority]->ignore_job= false; + server_job->ignore_job= false; gearman_server_job_free(gearman_server_job_take(server_con)); return gearman_server_job_peek(server_con); } - return server_worker->function->job_list[priority]; + + return server_job; } } } } + return NULL; } @@ -364,95 +455,126 @@ worker->con_prev->con_next= worker; } -gearman_server_job_st * -gearman_server_job_take(gearman_server_con_st *server_con) +gearman_server_job_st *gearman_server_job_take(gearman_server_con_st *server_con) { - gearman_server_worker_st *server_worker; - gearman_server_job_st *server_job; - gearman_job_priority_t priority; - - for (server_worker= server_con->worker_list; server_worker != NULL; - server_worker= server_worker->con_next) + for (gearman_server_worker_st *server_worker= server_con->worker_list; server_worker; server_worker= server_worker->con_next) { - if (server_worker->function->job_count != 0) - break; - } - - if (server_worker == NULL) - return NULL; + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Jobs available %lu", (unsigned long)(server_worker->function->job_count)); + if (server_worker->function->job_count) + { + if (server_worker == NULL) + { + return NULL; + } - if (server_con->thread->server->flags.round_robin) - { - GEARMAN_LIST_DEL(server_con->worker, server_worker, con_) - _server_con_worker_list_append(server_con->worker_list, server_worker); - ++server_con->worker_count; - if (server_con->worker_list == NULL) { - server_con->worker_list= server_worker; - } - } + if (Server->flags.round_robin) + { + GEARMAN_LIST_DEL(server_con->worker, server_worker, con_) + _server_con_worker_list_append(server_con->worker_list, server_worker); + ++server_con->worker_count; + if (server_con->worker_list == NULL) + { + server_con->worker_list= server_worker; + } + } - for (priority= GEARMAN_JOB_PRIORITY_HIGH; - priority != GEARMAN_JOB_PRIORITY_MAX; priority++) - { - if (server_worker->function->job_list[priority] != NULL) - break; - } + gearmand_job_priority_t priority; + for (priority= GEARMAND_JOB_PRIORITY_HIGH; priority < GEARMAND_JOB_PRIORITY_LOW; priority++) + { + if (server_worker->function->job_list[priority]) + { + break; + } + } - server_job= server_worker->function->job_list[priority]; - server_job->function->job_list[priority]= server_job->function_next; - if (server_job->function->job_end[priority] == server_job) - server_job->function->job_end[priority]= NULL; - server_job->function->job_count--; + gearman_server_job_st *server_job= server_job= server_worker->function->job_list[priority]; + gearman_server_job_st *previous_job= server_job; + + int64_t current_time= (int64_t)time(NULL); + + while (server_job && server_job->when != 0 && server_job->when > current_time) + { + previous_job= server_job; + server_job= server_job->function_next; + } + + if (server_job) + { + if (server_job->function->job_list[priority] == server_job) + { + // If it's the head of the list, advance it + server_job->function->job_list[priority]= server_job->function_next; + } + else + { + // Otherwise, just remove the item from the list + previous_job->function_next = server_job->function_next; + } + + // If it's the tail of the list, move the tail back + if (server_job->function->job_end[priority] == server_job) + { + server_job->function->job_end[priority]= previous_job; + } + server_job->function->job_count--; - server_job->worker= server_worker; - GEARMAN_LIST_ADD(server_worker->job, server_job, worker_) - server_job->function->job_running++; + server_job->worker= server_worker; + GEARMAN_LIST_ADD(server_worker->job, server_job, worker_) + server_job->function->job_running++; - if (server_job->ignore_job) - { - gearman_server_job_free(server_job); - return gearman_server_job_take(server_con); + if (server_job->ignore_job) + { + gearman_server_job_free(server_job); + return gearman_server_job_take(server_con); + } + + return server_job; + } + } } - - return server_job; + + return NULL; } -gearman_return_t gearman_server_job_queue(gearman_server_job_st *job) +gearmand_error_t gearman_server_job_queue(gearman_server_job_st *job) { gearman_server_client_st *client; gearman_server_worker_st *worker; uint32_t noop_sent; - gearman_return_t ret; + gearmand_error_t ret; - if (job->worker != NULL) + if (job->worker) { job->retries++; - if (job->server->job_retries == job->retries) + if (Server->job_retries == job->retries) { - gearman_log_error(job->server->gearman, - "Dropped job due to max retry count: %s %s", - job->job_handle, job->unique); - for (client= job->client_list; client != NULL; client= client->job_next) - { - ret= gearman_server_io_packet_add(client->con, false, - GEARMAN_MAGIC_RESPONSE, - GEARMAN_COMMAND_WORK_FAIL, - job->job_handle, - (size_t)strlen(job->job_handle), - NULL); - if (ret != GEARMAN_SUCCESS) - return ret; + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "Dropped job due to max retry count: %s %s", + job->job_handle, job->unique); + + for (client= job->client_list; client != NULL; client= client->job_next) + { + ret= gearman_server_io_packet_add(client->con, false, + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_WORK_FAIL, + job->job_handle, + (size_t)strlen(job->job_handle), + NULL); + if (gearmand_failed(ret)) + { + return ret; + } } /* Remove from persistent queue if one exists. */ - if (job->job_queued && job->server->queue_done_fn != NULL) + if (job->job_queued && Server->queue._done_fn != NULL) { - ret= (*(job->server->queue_done_fn))(job->server, - (void *)job->server->queue_context, - job->unique, - (size_t)strlen(job->unique), - job->function->function_name, - job->function->function_name_size); + ret= (*(Server->queue._done_fn))(Server, + (void *)Server->queue._context, + job->unique, + (size_t)strlen(job->unique), + job->function->function_name, + job->function->function_name_size); if (ret != GEARMAN_SUCCESS) return ret; } @@ -474,6 +596,7 @@ { worker= job->function->worker_list; noop_sent= 0; + do { if (worker->con->is_sleeping && ! (worker->con->is_noop_sent)) @@ -481,8 +604,11 @@ ret= gearman_server_io_packet_add(worker->con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_NOOP, NULL); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } worker->con->is_noop_sent= true; noop_sent++; @@ -491,17 +617,22 @@ worker= worker->function_next; } while (worker != job->function->worker_list && - (job->server->worker_wakeup == 0 || - noop_sent < job->server->worker_wakeup)); + (Server->worker_wakeup == 0 || + noop_sent < Server->worker_wakeup)); job->function->worker_list= worker; } /* Queue the job to be run. */ if (job->function->job_list[job->priority] == NULL) + { job->function->job_list[job->priority]= job; + } else + { job->function->job_end[job->priority]->function_next= job; + } + job->function->job_end[job->priority]= job; job->function->job_count++; @@ -523,6 +654,7 @@ value += (value << 10); value ^= (value >> 6); } + value += (value << 3); value ^= (value >> 11); value += (value << 15); @@ -537,7 +669,7 @@ { gearman_server_job_st *server_job; - for (server_job= server->unique_hash[unique_key % GEARMAN_JOB_HASH_SIZE]; + for (server_job= server->unique_hash[unique_key % GEARMAND_JOB_HASH_SIZE]; server_job != NULL; server_job= server_job->unique_next) { if (data_size == 0) diff -Nru gearmand-0.14/libgearman-server/job.h gearmand-0.23/libgearman-server/job.h --- gearmand-0.14/libgearman-server/job.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/job.h 2011-06-16 06:00:25.000000000 +0200 @@ -11,16 +11,9 @@ * @brief Job Declarations */ -#ifndef __GEARMAN_SERVER_JOB_H__ -#define __GEARMAN_SERVER_JOB_H__ +#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_server_job Job Declarations - * @ingroup gearman_server +/** @addtogroup gearman_server_job Job Declarations @ingroup gearman_server * * This is a low level interface for gearman server jobs. This is used * internally by the server interface, so you probably want to look there first. @@ -31,10 +24,7 @@ struct gearman_server_job_st { uint8_t retries; - struct { - bool allocated; - } options; - gearman_job_priority_t priority; + gearmand_job_priority_t priority; bool ignore_job; bool job_queued; uint32_t job_handle_key; @@ -43,7 +33,7 @@ uint32_t numerator; uint32_t denominator; size_t data_size; - gearman_server_st *server; + int64_t when; gearman_server_job_st *next; gearman_server_job_st *prev; gearman_server_job_st *unique_next; @@ -55,29 +45,50 @@ const void *data; gearman_server_client_st *client_list; gearman_server_worker_st *worker; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; + char job_handle[GEARMAND_JOB_HANDLE_SIZE]; char unique[GEARMAN_UNIQUE_SIZE]; + char reducer[GEARMAN_UNIQUE_SIZE]; }; + +#ifdef __cplusplus +extern "C" { +#endif + /** * Add a new job to a server instance. */ GEARMAN_API gearman_server_job_st * -gearman_server_job_add(gearman_server_st *server, const char *function_name, - size_t function_name_size, const char *unique, - size_t unique_size, const void *data, size_t data_size, - gearman_job_priority_t priority, +gearman_server_job_add(gearman_server_st *server, + const char *function_name, size_t function_name_size, + const char *unique, size_t unique_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, gearman_server_client_st *server_client, - gearman_return_t *ret_ptr); + gearmand_error_t *ret_ptr, + int64_t when); + +GEARMAN_API +gearman_server_job_st * +gearman_server_job_add_reducer(gearman_server_st *server, + const char *function_name, size_t function_name_size, + const char *unique, size_t unique_size, + const char *reducer, size_t reducer_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + gearman_server_client_st *server_client, + gearmand_error_t *ret_ptr, + int64_t when); + + /** * Initialize a server job structure. */ GEARMAN_API gearman_server_job_st * -gearman_server_job_create(gearman_server_st *server, - gearman_server_job_st *server_job); +gearman_server_job_create(gearman_server_st *server); /** * Free a server job structure. @@ -111,12 +122,10 @@ * Queue a job to be run. */ GEARMAN_API -gearman_return_t gearman_server_job_queue(gearman_server_job_st *server_job); +gearmand_error_t gearman_server_job_queue(gearman_server_job_st *server_job); /** @} */ #ifdef __cplusplus } #endif - -#endif /* __GEARMAN_SERVER_JOB_H__ */ diff -Nru gearmand-0.14/libgearman-server/list.c gearmand-0.23/libgearman-server/list.c --- gearmand-0.14/libgearman-server/list.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/list.c 2011-03-30 19:34:07.000000000 +0200 @@ -0,0 +1,75 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +void gearmand_thread_list_free(gearmand_thread_st *thread) +{ + GEARMAN_LIST_DEL(Gearmand()->thread, thread,); +} + +void gearmand_thread_list_add(gearmand_thread_st *thread) +{ + GEARMAN_LIST_ADD(Gearmand()->thread, thread,) +} + +void gearmand_server_list_free(gearman_server_st *server, + gearman_server_function_st *function) +{ + GEARMAN_LIST_DEL(server->function, function,); +} + +void gearmand_server_list_add(gearman_server_st *server, + gearman_server_function_st *function) +{ + GEARMAN_LIST_ADD(server->function, function,); +} + +void gearmand_server_free_job_list_free(gearman_server_st *server, + gearman_server_job_st *server_job) +{ + GEARMAN_LIST_DEL(server->free_job, server_job,); +} + +void gearmand_server_job_list_add(gearman_server_st *server, + gearman_server_job_st *server_job) +{ + GEARMAN_LIST_ADD(server->free_job, server_job,); +} diff -Nru gearmand-0.14/libgearman-server/list.h gearmand-0.23/libgearman-server/list.h --- gearmand-0.14/libgearman-server/list.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/list.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,68 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_INTERNAL_API +void gearmand_thread_list_free(gearmand_thread_st *thread); + +GEARMAN_INTERNAL_API +void gearmand_thread_list_add(gearmand_thread_st *thread); + +GEARMAN_INTERNAL_API + void gearmand_server_list_free(gearman_server_st *server, + gearman_server_function_st *function); + +GEARMAN_INTERNAL_API + void gearmand_server_list_add(gearman_server_st *server, + gearman_server_function_st *function); + +GEARMAN_INTERNAL_API + void gearmand_server_free_job_list_free(gearman_server_st *server, + gearman_server_job_st *server_job); + +GEARMAN_INTERNAL_API + void gearmand_server_job_list_add(gearman_server_st *server, + gearman_server_job_st *server_job); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/log.c gearmand-0.23/libgearman-server/log.c --- gearmand-0.14/libgearman-server/log.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/log.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,110 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008-2009 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Gearman State Definitions - */ - -#include "common.h" - - -void gearmand_log(gearmand_st *state, gearman_verbose_t verbose, - const char *format, va_list args) -{ - char log_buffer[GEARMAN_MAX_ERROR_SIZE]; - - if (state->log_fn == NULL) - { - printf("%5s: ", gearman_verbose_name(verbose)); - vprintf(format, args); - printf("\n"); - } - else - { - vsnprintf(log_buffer, GEARMAN_MAX_ERROR_SIZE, format, args); - state->log_fn(log_buffer, verbose, (void *)state->log_context); - } -} - - -void gearmand_log_fatal(gearmand_st *gearman, const char *format, ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_FATAL) - { - va_start(args, format); - gearmand_log(gearman, GEARMAN_VERBOSE_FATAL, format, args); - va_end(args); - } -} - -void gearmand_log_error(gearmand_st *gearman, const char *format, ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_ERROR) - { - va_start(args, format); - gearmand_log(gearman, GEARMAN_VERBOSE_ERROR, format, args); - va_end(args); - } -} - -void gearmand_log_info(gearmand_st *gearman, const char *format, ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_INFO) - { - va_start(args, format); - gearmand_log(gearman, GEARMAN_VERBOSE_INFO, format, args); - va_end(args); - } -} - -void gearmand_log_debug(gearmand_st *gearman, const char *format, ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_DEBUG) - { - va_start(args, format); - gearmand_log(gearman, GEARMAN_VERBOSE_DEBUG, format, args); - va_end(args); - } -} - -void gearmand_log_crazy(gearmand_st *gearman, const char *format, ...) -{ - va_list args; - - if (gearman->verbose >= GEARMAN_VERBOSE_CRAZY) - { - va_start(args, format); - gearmand_log(gearman, GEARMAN_VERBOSE_CRAZY, format, args); - va_end(args); - } -} - -void gearman_conf_error_set(gearman_conf_st *conf, const char *msg, const char *format, ...) -{ - va_list args; - char *ptr; - size_t length= strlen(msg); - - ptr= memcpy(conf->last_error, msg, length); - ptr+= length; - - va_start(args, format); - vsnprintf(ptr, GEARMAN_MAX_ERROR_SIZE- length, format, args); - va_end(args); -} - - diff -Nru gearmand-0.14/libgearman-server/log.cc gearmand-0.23/libgearman-server/log.cc --- gearmand-0.14/libgearman-server/log.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/log.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,253 @@ +/* Gearman server and library + * Copyright (C) 2008-2009 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Gearman State Definitions + */ + +#include + +#include +#include +#include + +static pthread_key_t logging_key; +static pthread_once_t intitialize_log_once = PTHREAD_ONCE_INIT; + +static void delete_log(void *ptr) +{ + if (ptr) + { + free(ptr); + } +} + +static void create_log(void) +{ + (void) pthread_key_create(&logging_key, delete_log); +} + +void gearmand_initialize_thread_logging(const char *identity) +{ + (void) pthread_once(&intitialize_log_once, create_log); + + void *ptr; + if ((ptr = pthread_getspecific(logging_key)) == NULL) + { + const char *key_to_use= strdup(identity); + (void) pthread_setspecific(logging_key, key_to_use); + } +} + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/** + * Log a message. + * + * @param[in] gearman Structure previously initialized with gearman_create() or + * gearman_clone(). + * @param[in] verbose Logging level of the message. + * @param[in] format Format and variable argument list of message. + * @param[in] args Variable argument list that has been initialized. + */ + +static void gearmand_log(const char *position, const char *func, gearmand_verbose_t verbose, const char *format, va_list args) +{ + (void)func; + char log_buffer[GEARMAN_MAX_ERROR_SIZE*2]; + + (void) pthread_once(&intitialize_log_once, create_log); + + const char *identity= (const char *)pthread_getspecific(logging_key); + + if (identity == NULL) + identity= "[ main ]"; + + if (Gearmand() && Gearmand()->log_fn) + { + int length= snprintf(log_buffer, sizeof(log_buffer), "%s ", identity); + + // We just return whatever we have if this occurs + if (length < -1 || (size_t)length >= sizeof(log_buffer)) + { + Gearmand()->log_fn(log_buffer, verbose, (void *)Gearmand()->log_context); + return; + } + size_t remaining_size= sizeof(log_buffer) - (size_t)length; + char *ptr= log_buffer; + ptr+= length; + + int format_length= vsnprintf(ptr, remaining_size, format, args); + remaining_size-= format_length; + + ptr+= format_length; + + if (position and verbose != GEARMAND_VERBOSE_INFO) + snprintf(ptr, remaining_size, " -> %s", position); + + + Gearmand()->log_fn(log_buffer, verbose, (void *)Gearmand()->log_context); + } + else + { + fprintf(stderr, "%s %7s: ", identity, gearmand_verbose_name(verbose)); + vprintf(format, args); + fprintf(stderr, "\n"); + } +} + + +void gearmand_log_fatal(const char *position, const char *func, const char *format, ...) +{ + va_list args; + + if (not Gearmand() || Gearmand()->verbose >= GEARMAND_VERBOSE_FATAL) + { + va_start(args, format); + gearmand_log(position, func, GEARMAND_VERBOSE_FATAL, format, args); + va_end(args); + } +} + +void gearmand_log_fatal_perror(const char *position, const char *function, const char *message) +{ + if (not Gearmand() || Gearmand()->verbose >= GEARMAND_VERBOSE_FATAL) + { + const char *errmsg_ptr; + char errmsg[GEARMAN_MAX_ERROR_SIZE]; + errmsg[0]= 0; + +#ifdef STRERROR_R_CHAR_P + errmsg_ptr= strerror_r(errno, errmsg, sizeof(errmsg)); +#else + strerror_r(errno, errmsg, sizeof(errmsg)); + errmsg_ptr= errmsg; +#endif + + gearmand_log_fatal(position, function, "%s(%s)", message, errmsg_ptr); + } +} + +gearmand_error_t gearmand_log_error(const char *position, const char *function, const char *format, ...) +{ + va_list args; + + if (not Gearmand() || Gearmand()->verbose >= GEARMAND_VERBOSE_ERROR) + { + va_start(args, format); + gearmand_log(position, function, GEARMAND_VERBOSE_ERROR, format, args); + va_end(args); + } + + return GEARMAN_UNKNOWN_OPTION; +} + +void gearmand_log_info(const char *position, const char *function, const char *format, ...) +{ + va_list args; + + if (not Gearmand() || Gearmand()->verbose >= GEARMAND_VERBOSE_INFO) + { + va_start(args, format); + gearmand_log(position, function, GEARMAND_VERBOSE_INFO, format, args); + va_end(args); + } +} + +void gearmand_log_debug(const char *position, const char *function, const char *format, ...) +{ + va_list args; + + if (not Gearmand() || Gearmand()->verbose >= GEARMAND_VERBOSE_DEBUG) + { + va_start(args, format); + gearmand_log(position, function, GEARMAND_VERBOSE_DEBUG, format, args); + va_end(args); + } +} + +void gearmand_log_crazy(const char *position, const char *function, const char *format, ...) +{ +#ifdef DEBUG + va_list args; + + if (not Gearmand() || Gearmand()->verbose >= GEARMAND_VERBOSE_CRAZY) + { + va_start(args, format); + gearmand_log(position, function, GEARMAND_VERBOSE_CRAZY, format, args); + va_end(args); + } +#else + (void)position; + (void)function; + (void)format; +#endif +} + +gearmand_error_t gearmand_log_perror(const char *position, const char *function, const char *message) +{ + if (not Gearmand() or (Gearmand()->verbose >= GEARMAND_VERBOSE_ERROR)) + { + const char *errmsg_ptr; + char errmsg[GEARMAN_MAX_ERROR_SIZE]; + errmsg[0]= 0; + +#ifdef STRERROR_R_CHAR_P + errmsg_ptr= strerror_r(errno, errmsg, sizeof(errmsg)); +#else + strerror_r(errno, errmsg, sizeof(errmsg)); + errmsg_ptr= errmsg; +#endif + gearmand_log_error(position, function, "%s(%s)", message, errmsg_ptr); + } + + return GEARMAN_ERRNO; +} + +gearmand_error_t gearmand_log_gerror(const char *position, const char *function, const gearmand_error_t rc, const char *message) +{ + if (gearmand_failed(rc) and rc != GEARMAN_IO_WAIT) + { + gearmand_log_error(position, function, "%s(%s)", message, gearmand_strerror(rc)); + } + else if (rc == GEARMAN_IO_WAIT) + { + gearmand_log_crazy(position, function, "%s(%s)", message, gearmand_strerror(rc)); + } + + return rc; +} + +gearmand_error_t gearmand_log_gai_error(const char *position, const char *function, const int rc, const char *message) +{ + if (rc == EAI_SYSTEM) + { + return gearmand_log_perror(position, function, message); + } + + gearmand_log_error(position, function, "%s getaddrinfo(%s)", message, gai_strerror(rc)); + + return GEARMAN_GETADDRINFO; +} + +gearmand_error_t gearmand_log_memory_error(const char *position, const char *function, const char *allocator, const char *object_type, size_t count, size_t size) +{ + if (count > 1) + { + gearmand_log_error(position, function, "%s(%s, count: %lu size: %lu)", allocator, object_type, static_cast(count), static_cast(size)); + } + else + { + gearmand_log_error(position, function, "%s(%s, size: %lu)", allocator, object_type, static_cast(count), static_cast(size)); + } + + return GEARMAN_MEMORY_ALLOCATION_FAILURE; +} diff -Nru gearmand-0.14/libgearman-server/log.h gearmand-0.23/libgearman-server/log.h --- gearmand-0.14/libgearman-server/log.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/log.h 2011-06-03 04:13:30.000000000 +0200 @@ -6,78 +6,94 @@ * the COPYING file in the parent directory for full text. */ -/** - * @file - * @brief Local Gearman Declarations - */ +/* + All logging facilities within the server. +*/ -#ifndef __GEARMAND_LOG_H__ -#define __GEARMAND_LOG_H__ +#include + +#pragma once #ifdef __cplusplus extern "C" { #endif -#ifdef GEARMAN_CORE +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define AT __FILE__ ":" TOSTRING(__LINE__) -/** - * @addtogroup gearman_local Local Gearman Declarations - * @ingroup gearman_universal - * @{ - */ +#ifdef __cplusplus +#define STRING_WITH_LEN(X) (X), (size_t((sizeof(X) - 1))) +#define gearman_literal_param(X) (X), (size_t(sizeof(X) - 1)) +#else +#define STRING_WITH_LEN(X) (X), ((size_t)((sizeof(X) - 1))) +#define gearman_literal_param(X) (X), ((size_t)((sizeof(X) - 1))) +#endif + +#define GEARMAN_DEFAULT_LOG_PARAM AT, __func__ -/** - * Log a message. - * - * @param[in] gearman Structure previously initialized with gearman_create() or - * gearman_clone(). - * @param[in] verbose Logging level of the message. - * @param[in] format Format and variable argument list of message. - * @param[in] args Variable argument list that has been initialized. - */ GEARMAN_INTERNAL_API -void gearmand_log(gearmand_st *gearman, gearman_verbose_t verbose, - const char *format, va_list args); +void gearmand_initialize_thread_logging(const char *identity); /** * Log a fatal message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API -void gearmand_log_fatal(gearmand_st *gearman, const char *format, ...); +void gearmand_log_fatal(const char *position, const char *func, const char *format, ...); +#define gearmand_fatal(_mesg) gearmand_log_fatal(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) + +GEARMAN_INTERNAL_API +void gearmand_log_fatal_perror(const char *position, const char *function, const char *message); +#define gearmand_fatal_perror(_mesg) gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) + /** * Log an error message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API -void gearmand_log_error(gearmand_st *gearman, const char *format, ...); +gearmand_error_t gearmand_log_error(const char *position, const char *function, const char *format, ...); +#define gearmand_error(_mesg) gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) + +GEARMAN_INTERNAL_API +gearmand_error_t gearmand_log_perror(const char *position, const char *function, const char *message); +#define gearmand_perror(_mesg) gearmand_log_perror(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) + +GEARMAN_INTERNAL_API +gearmand_error_t gearmand_log_gerror(const char *position, const char *function, const gearmand_error_t rc, const char *message); +#define gearmand_gerror(_mesg, _gearmand_errot_t) gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, (_gearmand_errot_t), (_mesg)) + +GEARMAN_INTERNAL_API +gearmand_error_t gearmand_log_gai_error(const char *position, const char *function, const int rc, const char *message); +#define gearmand_gai_error(_mesg, _gai_int) gearmand_log_gai_error(GEARMAN_DEFAULT_LOG_PARAM, (_gai_int), (_mesg)) + +GEARMAN_INTERNAL_API +gearmand_error_t gearmand_log_memory_error(const char *position, const char *function, const char *allocator, const char *type, size_t count, size_t size); +#define gearmand_merror(__allocator, __object_type, __count) gearmand_log_memory_error(GEARMAN_DEFAULT_LOG_PARAM, (__allocator), (#__object_type), (__count), (sizeof(__object_type))) + + /** * Log an info message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API -void gearmand_log_info(gearmand_st *gearman, const char *format, ...); +void gearmand_log_info(const char *position, const char *function, const char *format, ...); +#define gearmand_info(_mesg) gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) /** * Log a debug message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API -void gearmand_log_debug(gearmand_st *gearman, const char *format, ...); +void gearmand_log_debug(const char *position, const char *function, const char *format, ...); +#define gearmand_debug(_mesg) gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) + /** * Log a crazy message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API -void gearmand_log_crazy(gearmand_st *gearman, const char *format, ...); - -GEARMAN_INTERNAL_API -void gearman_conf_error_set(gearman_conf_st *conf, const char *msg, const char *format, ...); - -#endif /* GEARMAN_CORE */ - -/** @} */ +void gearmand_log_crazy(const char *position, const char *function, const char *format, ...); +#define gearmand_crazy(_mesg) gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) #ifdef __cplusplus } #endif - -#endif /* __GEARMAND_LOG_H__ */ diff -Nru gearmand-0.14/libgearman-server/packet.c gearmand-0.23/libgearman-server/packet.c --- gearmand-0.14/libgearman-server/packet.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/packet.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,189 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Server connection definitions - */ - -#include "common.h" - -/* - * Public definitions - */ - -gearman_server_packet_st * -gearman_server_packet_create(gearman_server_thread_st *thread, - bool from_thread) -{ - gearman_server_packet_st *server_packet= NULL; - - if (from_thread && thread->server->flags.threaded) - { - if (thread->free_packet_count > 0) - { - server_packet= thread->free_packet_list; - thread->free_packet_list= server_packet->next; - thread->free_packet_count--; - } - } - else - { - if (thread->server->free_packet_count > 0) - { - server_packet= thread->server->free_packet_list; - thread->server->free_packet_list= server_packet->next; - thread->server->free_packet_count--; - } - } - - if (server_packet == NULL) - { - server_packet= (gearman_server_packet_st *)malloc(sizeof(gearman_server_packet_st)); - if (server_packet == NULL) - { - gearman_log_error(thread->gearman, "gearman_server_packet_create", "malloc"); - return NULL; - } - } - - server_packet->next= NULL; - - return server_packet; -} - -void gearman_server_packet_free(gearman_server_packet_st *packet, - gearman_server_thread_st *thread, - bool from_thread) -{ - if (from_thread && thread->server->flags.threaded) - { - if (thread->free_packet_count < GEARMAN_MAX_FREE_SERVER_PACKET) - { - packet->next= thread->free_packet_list; - thread->free_packet_list= packet; - thread->free_packet_count++; - } - else - free(packet); - } - else - { - if (thread->server->free_packet_count < GEARMAN_MAX_FREE_SERVER_PACKET) - { - packet->next= thread->server->free_packet_list; - thread->server->free_packet_list= packet; - thread->server->free_packet_count++; - } - else - free(packet); - } -} - -gearman_return_t gearman_server_io_packet_add(gearman_server_con_st *con, - bool take_data, - enum gearman_magic_t magic, - gearman_command_t command, - const void *arg, ...) -{ - gearman_server_packet_st *server_packet; - va_list ap; - size_t arg_size; - gearman_return_t ret; - - server_packet= gearman_server_packet_create(con->thread, false); - if (server_packet == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - - if (gearman_packet_create(con->thread->gearman, - &(server_packet->packet)) == NULL) - { - gearman_server_packet_free(server_packet, con->thread, false); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - server_packet->packet.magic= magic; - server_packet->packet.command= command; - - va_start(ap, arg); - - while (arg != NULL) - { - arg_size = va_arg(ap, size_t); - - ret= gearman_packet_create_arg(&(server_packet->packet), arg, arg_size); - if (ret != GEARMAN_SUCCESS) - { - va_end(ap); - gearman_packet_free(&(server_packet->packet)); - gearman_server_packet_free(server_packet, con->thread, false); - return ret; - } - - arg = va_arg(ap, void *); - } - - va_end(ap); - - ret= gearman_packet_pack_header(&(server_packet->packet)); - if (ret != GEARMAN_SUCCESS) - { - gearman_packet_free(&(server_packet->packet)); - gearman_server_packet_free(server_packet, con->thread, false); - return ret; - } - - if (take_data) - server_packet->packet.options.free_data= true; - - (void) pthread_mutex_lock(&con->thread->lock); - GEARMAN_FIFO_ADD(con->io_packet, server_packet,); - (void) pthread_mutex_unlock(&con->thread->lock); - - gearman_server_con_io_add(con); - - return GEARMAN_SUCCESS; -} - -void gearman_server_io_packet_remove(gearman_server_con_st *con) -{ - gearman_server_packet_st *server_packet= con->io_packet_list; - - gearman_packet_free(&(server_packet->packet)); - - (void) pthread_mutex_lock(&con->thread->lock); - GEARMAN_FIFO_DEL(con->io_packet, server_packet,); - (void) pthread_mutex_unlock(&con->thread->lock); - - gearman_server_packet_free(server_packet, con->thread, true); -} - -void gearman_server_proc_packet_add(gearman_server_con_st *con, - gearman_server_packet_st *packet) -{ - (void) pthread_mutex_lock(&con->thread->lock); - GEARMAN_FIFO_ADD(con->proc_packet, packet,); - (void) pthread_mutex_unlock(&con->thread->lock); - - gearman_server_con_proc_add(con); -} - -gearman_server_packet_st * -gearman_server_proc_packet_remove(gearman_server_con_st *con) -{ - gearman_server_packet_st *server_packet= con->proc_packet_list; - - if (server_packet == NULL) - return NULL; - - (void) pthread_mutex_lock(&con->thread->lock); - GEARMAN_FIFO_DEL(con->proc_packet, server_packet,); - (void) pthread_mutex_unlock(&con->thread->lock); - - return server_packet; -} diff -Nru gearmand-0.14/libgearman-server/packet.cc gearmand-0.23/libgearman-server/packet.cc --- gearmand-0.14/libgearman-server/packet.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/packet.cc 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,557 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Server connection definitions + */ + +#include + +#define GEARMAN_CORE +#include + +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/* + * Public definitions + */ + +gearman_server_packet_st * +gearman_server_packet_create(gearman_server_thread_st *thread, + bool from_thread) +{ + gearman_server_packet_st *server_packet= NULL; + + if (from_thread && Server->flags.threaded) + { + if (thread->free_packet_count > 0) + { + server_packet= thread->free_packet_list; + thread->free_packet_list= server_packet->next; + thread->free_packet_count--; + } + } + else + { + if (Server->free_packet_count > 0) + { + server_packet= Server->free_packet_list; + Server->free_packet_list= server_packet->next; + Server->free_packet_count--; + } + } + + if (server_packet == NULL) + { + server_packet= (gearman_server_packet_st *)malloc(sizeof(gearman_server_packet_st)); + if (server_packet == NULL) + { + gearmand_perror("malloc"); + return NULL; + } + } + + server_packet->next= NULL; + + return server_packet; +} + +void gearman_server_packet_free(gearman_server_packet_st *packet, + gearman_server_thread_st *thread, + bool from_thread) +{ + if (from_thread && Server->flags.threaded) + { + if (thread->free_packet_count < GEARMAN_MAX_FREE_SERVER_PACKET) + { + packet->next= thread->free_packet_list; + thread->free_packet_list= packet; + thread->free_packet_count++; + } + else + { + gearmand_crazy("free"); + free(packet); + } + } + else + { + if (Server->free_packet_count < GEARMAN_MAX_FREE_SERVER_PACKET) + { + packet->next= Server->free_packet_list; + Server->free_packet_list= packet; + Server->free_packet_count++; + } + else + { + gearmand_crazy("free"); + free(packet); + } + } +} + +gearmand_error_t gearman_server_io_packet_add(gearman_server_con_st *con, + bool take_data, + enum gearman_magic_t magic, + gearman_command_t command, + const void *arg, ...) +{ + gearman_server_packet_st *server_packet; + va_list ap; + + server_packet= gearman_server_packet_create(con->thread, false); + if (not server_packet) + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + + gearmand_packet_init(&(server_packet->packet), magic, command); + + va_start(ap, arg); + + while (arg) + { + size_t arg_size= va_arg(ap, size_t); + + gearmand_error_t ret= gearmand_packet_create(&(server_packet->packet), arg, arg_size); + if (gearmand_failed(ret)) + { + va_end(ap); + gearmand_packet_free(&(server_packet->packet)); + gearman_server_packet_free(server_packet, con->thread, false); + return ret; + } + + arg= va_arg(ap, void *); + } + + va_end(ap); + + gearmand_error_t ret= gearmand_packet_pack_header(&(server_packet->packet)); + if (gearmand_failed(ret)) + { + gearmand_packet_free(&(server_packet->packet)); + gearman_server_packet_free(server_packet, con->thread, false); + return ret; + } + + if (take_data) + { + server_packet->packet.options.free_data= true; + } + + (void) pthread_mutex_lock(&con->thread->lock); + gearmand_server_con_fifo_add(con, server_packet); + (void) pthread_mutex_unlock(&con->thread->lock); + + gearman_server_con_io_add(con); + + return GEARMAN_SUCCESS; +} + +void gearman_server_io_packet_remove(gearman_server_con_st *con) +{ + gearman_server_packet_st *server_packet= con->io_packet_list; + + gearmand_packet_free(&(server_packet->packet)); + + (void) pthread_mutex_lock(&con->thread->lock); + gearmand_server_con_fifo_free(con, server_packet); + (void) pthread_mutex_unlock(&con->thread->lock); + + gearman_server_packet_free(server_packet, con->thread, true); +} + +void gearman_server_proc_packet_add(gearman_server_con_st *con, + gearman_server_packet_st *packet) +{ + (void) pthread_mutex_lock(&con->thread->lock); + gearmand_server_con_fifo_proc_add(con, packet); + (void) pthread_mutex_unlock(&con->thread->lock); + + gearman_server_con_proc_add(con); +} + +gearman_server_packet_st * +gearman_server_proc_packet_remove(gearman_server_con_st *con) +{ + gearman_server_packet_st *server_packet= con->proc_packet_list; + + if (server_packet == NULL) + return NULL; + + (void) pthread_mutex_lock(&con->thread->lock); + gearmand_server_con_fifo_proc_free(con, server_packet); + (void) pthread_mutex_unlock(&con->thread->lock); + + return server_packet; +} + +const char *gearmand_strcommand(gearmand_packet_st *packet) +{ + assert(packet); + return gearman_command_info(packet->command)->name; +} + +inline static gearmand_error_t packet_create_arg(gearmand_packet_st *packet, + const void *arg, size_t arg_size) +{ + size_t offset; + + if (packet->argc == gearman_command_info(packet->command)->argc && + (not (gearman_command_info(packet->command)->data) || + packet->data)) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "too many arguments for command(%s)", gearman_command_info(packet->command)->name); + return GEARMAN_TOO_MANY_ARGS; + } + + if (packet->argc == gearman_command_info(packet->command)->argc) + { + packet->data= static_cast(arg); + packet->data_size= arg_size; + return GEARMAN_SUCCESS; + } + + if (packet->args_size == 0 and packet->magic != GEARMAN_MAGIC_TEXT) + packet->args_size= GEARMAN_PACKET_HEADER_SIZE; + + if ((packet->args_size + arg_size) < GEARMAN_ARGS_BUFFER_SIZE) + { + packet->args= packet->args_buffer; + } + else + { + if (packet->args == packet->args_buffer) + packet->args= NULL; + + void *new_args= realloc(packet->args, packet->args_size + arg_size); + if (not new_args) + { + gearmand_perror("realloc"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + if (packet->args_size > 0) + memcpy(new_args, packet->args_buffer, packet->args_size); + + packet->args= static_cast(new_args); + } + + memcpy(packet->args + packet->args_size, arg, arg_size); + packet->args_size+= arg_size; + packet->arg_size[packet->argc]= arg_size; + packet->argc++; + + if (packet->magic == GEARMAN_MAGIC_TEXT) + { + offset= 0; + } + else + { + offset= GEARMAN_PACKET_HEADER_SIZE; + } + + for (uint8_t x= 0; x < packet->argc; x++) + { + packet->arg[x]= packet->args + offset; + offset+= packet->arg_size[x]; + } + + return GEARMAN_SUCCESS; +} + +/** @} */ + +/* + * Public Definitions + */ + + +void gearmand_packet_init(gearmand_packet_st *packet, enum gearman_magic_t magic, gearman_command_t command) +{ + assert(packet); + + packet->options.complete= false; + packet->options.free_data= false; + + packet->magic= magic; + packet->command= command; + packet->argc= 0; + packet->args_size= 0; + packet->data_size= 0; + + packet->args= NULL; + packet->data= NULL; +} + +gearmand_error_t gearmand_packet_create(gearmand_packet_st *packet, + const void *arg, size_t arg_size) +{ + return packet_create_arg(packet, arg, arg_size); +} + +void gearmand_packet_free(gearmand_packet_st *packet) +{ + if (packet->args != packet->args_buffer && packet->args != NULL) + { + gearmand_crazy("free"); + free(packet->args); + packet->args= NULL; + } + + if (packet->options.free_data && packet->data != NULL) + { + gearmand_crazy("free"); + free((void *)packet->data); //@todo fix the need for the casting. + packet->data= NULL; + } +} + +gearmand_error_t gearmand_packet_pack_header(gearmand_packet_st *packet) +{ + uint64_t length_64; + uint32_t tmp; + + if (packet->magic == GEARMAN_MAGIC_TEXT) + { + packet->options.complete= true; + return GEARMAN_SUCCESS; + } + + if (packet->args_size == 0) + { + packet->args= packet->args_buffer; + packet->args_size= GEARMAN_PACKET_HEADER_SIZE; + } + + switch (packet->magic) + { + case GEARMAN_MAGIC_TEXT: + break; + + case GEARMAN_MAGIC_REQUEST: + memcpy(packet->args, "\0REQ", 4); + break; + + case GEARMAN_MAGIC_RESPONSE: + memcpy(packet->args, "\0RES", 4); + break; + + default: + gearmand_error("invalid magic value"); + return GEARMAN_INVALID_MAGIC; + } + + if (packet->command == GEARMAN_COMMAND_TEXT || + packet->command >= GEARMAN_COMMAND_MAX) + { + gearmand_error("invalid command value"); + return GEARMAN_INVALID_COMMAND; + } + + tmp= packet->command; + tmp= htonl(tmp); + memcpy(packet->args + 4, &tmp, 4); + + length_64= packet->args_size + packet->data_size - GEARMAN_PACKET_HEADER_SIZE; + + // Check for overflow on 32bit(portable?). + if (length_64 >= UINT32_MAX || length_64 < packet->data_size) + { + gearmand_error("data size too too long"); + return GEARMAN_ARGUMENT_TOO_LARGE; + } + + tmp= (uint32_t)length_64; + tmp= htonl(tmp); + memcpy(packet->args + 8, &tmp, 4); + + packet->options.complete= true; + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t gearmand_packet_unpack_header(gearmand_packet_st *packet) +{ + uint32_t tmp; + + if (not memcmp(packet->args, "\0REQ", 4)) + { + packet->magic= GEARMAN_MAGIC_REQUEST; + } + else if (not memcmp(packet->args, "\0RES", 4)) + { + packet->magic= GEARMAN_MAGIC_RESPONSE; + } + else + { + gearmand_error("invalid magic value"); + return GEARMAN_INVALID_MAGIC; + } + + memcpy(&tmp, packet->args + 4, 4); + packet->command= static_cast(ntohl(tmp)); + + if (packet->command == GEARMAN_COMMAND_TEXT || + packet->command >= GEARMAN_COMMAND_MAX) + { + gearmand_error("invalid command value"); + return GEARMAN_INVALID_COMMAND; + } + + memcpy(&tmp, packet->args + 8, 4); + packet->data_size= ntohl(tmp); + + return GEARMAN_SUCCESS; +} + +size_t gearmand_packet_pack(const gearmand_packet_st *packet, + gearman_server_con_st *con __attribute__ ((unused)), + void *data, size_t data_size, + gearmand_error_t *ret_ptr) +{ + if (packet->args_size == 0) + { + *ret_ptr= GEARMAN_SUCCESS; + return 0; + } + + if (packet->args_size > data_size) + { + *ret_ptr= GEARMAN_FLUSH_DATA; + return 0; + } + + memcpy(data, packet->args, packet->args_size); + *ret_ptr= GEARMAN_SUCCESS; + return packet->args_size; +} + +size_t gearmand_packet_unpack(gearmand_packet_st *packet, + gearman_server_con_st *con __attribute__ ((unused)), + const void *data, size_t data_size, + gearmand_error_t *ret_ptr) +{ + uint8_t *ptr; + size_t used_size; + + if (packet->args_size == 0) + { + if (data_size > 0 && ((uint8_t *)data)[0] != 0) + { + /* Try to parse a text-based command. */ + ptr= (uint8_t *)memchr(data, '\n', data_size); + if (ptr == NULL) + { + *ret_ptr= GEARMAN_IO_WAIT; + return 0; + } + + packet->magic= GEARMAN_MAGIC_TEXT; + packet->command= GEARMAN_COMMAND_TEXT; + + used_size= (size_t)(ptr - ((uint8_t *)data)) + 1; + *ptr= 0; + if (used_size > 1 && *(ptr - 1) == '\r') + *(ptr - 1)= 0; + + size_t arg_size; + for (arg_size= used_size, ptr= (uint8_t *)data; ptr != NULL; data= ptr) + { + ptr= (uint8_t *)memchr(data, ' ', arg_size); + if (ptr != NULL) + { + *ptr= 0; + ptr++; + while (*ptr == ' ') + ptr++; + + arg_size-= (size_t)(ptr - ((uint8_t *)data)); + } + + *ret_ptr= packet_create_arg(packet, data, ptr == NULL ? arg_size : + (size_t)(ptr - ((uint8_t *)data))); + if (*ret_ptr != GEARMAN_SUCCESS) + return used_size; + } + + return used_size; + } + else if (data_size < GEARMAN_PACKET_HEADER_SIZE) + { + *ret_ptr= GEARMAN_IO_WAIT; + return 0; + } + + packet->args= packet->args_buffer; + packet->args_size= GEARMAN_PACKET_HEADER_SIZE; + memcpy(packet->args, data, GEARMAN_PACKET_HEADER_SIZE); + + *ret_ptr= gearmand_packet_unpack_header(packet); + if (gearmand_failed(*ret_ptr)) + { + return 0; + } + + used_size= GEARMAN_PACKET_HEADER_SIZE; + } + else + { + used_size= 0; + } + + while (packet->argc != gearman_command_info(packet->command)->argc) + { + if (packet->argc != (gearman_command_info(packet->command)->argc - 1) || + gearman_command_info(packet->command)->data) + { + ptr= (uint8_t *)memchr(((uint8_t *)data) + used_size, 0, data_size - used_size); + if (not ptr) + { + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, "Possible protocol error for %s, recieved only %u args", gearman_command_info(packet->command)->name, packet->argc); + *ret_ptr= GEARMAN_IO_WAIT; + return used_size; + } + + size_t arg_size= (size_t)(ptr - (((uint8_t *)data) + used_size)) + 1; + *ret_ptr= packet_create_arg(packet, ((uint8_t *)data) + used_size, arg_size); + + if (gearmand_failed(*ret_ptr)) + return used_size; + + packet->data_size-= arg_size; + used_size+= arg_size; + } + else + { + if ((data_size - used_size) < packet->data_size) + { + *ret_ptr= GEARMAN_IO_WAIT; + return used_size; + } + + *ret_ptr= packet_create_arg(packet, ((uint8_t *)data) + used_size, packet->data_size); + if (gearmand_failed(*ret_ptr)) + { + return used_size; + } + + used_size+= packet->data_size; + packet->data_size= 0; + } + } + + *ret_ptr= GEARMAN_SUCCESS; + return used_size; +} diff -Nru gearmand-0.14/libgearman-server/packet.h gearmand-0.23/libgearman-server/packet.h --- gearmand-0.14/libgearman-server/packet.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/packet.h 2011-06-03 04:13:30.000000000 +0200 @@ -14,10 +14,42 @@ #ifndef __GEARMAN_SERVER_PACKET_H__ #define __GEARMAN_SERVER_PACKET_H__ +#include + #ifdef __cplusplus extern "C" { #endif +enum gearman_magic_t +{ + GEARMAN_MAGIC_TEXT, + GEARMAN_MAGIC_REQUEST, + GEARMAN_MAGIC_RESPONSE +}; + +/** + * @ingroup gearman_packet + */ +struct gearmand_packet_st +{ + struct { + bool complete; + bool free_data; + } options; + enum gearman_magic_t magic; + gearman_command_t command; + uint8_t argc; + size_t args_size; + size_t data_size; + struct gearmand_packet_st *next; + struct gearmand_packet_st *prev; + char *args; + const char *data; + char *arg[GEARMAN_MAX_COMMAND_ARGS]; + size_t arg_size[GEARMAN_MAX_COMMAND_ARGS]; + char args_buffer[GEARMAN_ARGS_BUFFER_SIZE]; +}; + /** * @addtogroup gearman_server_packet Packet Declarations * @ingroup gearman_server @@ -31,11 +63,10 @@ struct gearman_server_packet_st { - gearman_packet_st packet; + gearmand_packet_st packet; gearman_server_packet_st *next; }; - /** * Initialize a server packet structure. */ @@ -44,6 +75,9 @@ gearman_server_packet_create(gearman_server_thread_st *thread, bool from_thread); +GEARMAN_LOCAL +const char *gearmand_strcommand(gearmand_packet_st *packet); + /** * Free a server connection structure. */ @@ -56,7 +90,7 @@ * Add a server packet structure to io queue for a connection. */ GEARMAN_API -gearman_return_t gearman_server_io_packet_add(gearman_server_con_st *con, +gearmand_error_t gearman_server_io_packet_add(gearman_server_con_st *con, bool take_data, enum gearman_magic_t magic, gearman_command_t command, @@ -82,6 +116,59 @@ gearman_server_packet_st * gearman_server_proc_packet_remove(gearman_server_con_st *con); + +/** + * Initialize a packet structure. + * + * @param[in] gearman Structure previously initialized with gearman_create() or + * gearman_clone(). + * @param[in] packet Caller allocated structure, or NULL to allocate one. + * @return On success, a pointer to the (possibly allocated) structure. On + * failure this will be NULL. + */ +GEARMAN_INTERNAL_API +void gearmand_packet_init(gearmand_packet_st *packet, enum gearman_magic_t magic, gearman_command_t command); + +/** + * Free a packet structure. + * + * @param[in] packet Structure previously initialized with + * gearmand_packet_init() or gearmand_packet_creates(). + */ +GEARMAN_INTERNAL_API +void gearmand_packet_free(gearmand_packet_st *packet); + +/** + * Add an argument to a packet. + */ +GEARMAN_INTERNAL_API + gearmand_error_t gearmand_packet_create(gearmand_packet_st *packet, + const void *arg, size_t arg_size); + +/** + * Pack header. + */ +GEARMAN_INTERNAL_API + gearmand_error_t gearmand_packet_pack_header(gearmand_packet_st *packet); + +/** + * Pack packet into output buffer. + */ +GEARMAN_INTERNAL_API + size_t gearmand_packet_pack(const gearmand_packet_st *packet, + gearman_server_con_st *con, + void *data, size_t data_size, + gearmand_error_t *ret_ptr); + +/** + * Unpack packet from input data. + */ +GEARMAN_INTERNAL_API + size_t gearmand_packet_unpack(gearmand_packet_st *packet, + gearman_server_con_st *con, + const void *data, size_t data_size, + gearmand_error_t *ret_ptr); + /** @} */ #ifdef __cplusplus diff -Nru gearmand-0.14/libgearman-server/plugins/base.h gearmand-0.23/libgearman-server/plugins/base.h --- gearmand-0.14/libgearman-server/plugins/base.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/base.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,73 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +#include + +namespace gearmand { + +class Plugin { +public: + + Plugin(const std::string &name_arg) : + _command_line_options(name_arg), + _name(name_arg) + { + } + + const std::string &name() const + { + return _name; + } + + virtual ~Plugin() + {}; + + boost::program_options::options_description &command_line_options() + { + return _command_line_options; + } + +private: + boost::program_options::options_description _command_line_options; + std::string _name; +}; + +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/include.am gearmand-0.23/libgearman-server/plugins/include.am --- gearmand-0.14/libgearman-server/plugins/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/include.am 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,11 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential + +noinst_HEADERS+= \ + libgearman-server/plugins/base.h \ + libgearman-server/plugins/protocol.h \ + libgearman-server/plugins/queue.h + +include libgearman-server/plugins/protocol/include.am +include libgearman-server/plugins/queue/include.am diff -Nru gearmand-0.14/libgearman-server/plugins/protocol/http/include.am gearmand-0.23/libgearman-server/plugins/protocol/http/include.am --- gearmand-0.14/libgearman-server/plugins/protocol/http/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/protocol/http/include.am 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,16 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +noinst_HEADERS+= \ + libgearman-server/plugins/protocol/http/protocol.h + +libgearman_server_libgearman_server_la_SOURCES+= \ + libgearman-server/plugins/protocol/http/protocol.cc diff -Nru gearmand-0.14/libgearman-server/plugins/protocol/http/protocol.cc gearmand-0.23/libgearman-server/plugins/protocol/http/protocol.cc --- gearmand-0.14/libgearman-server/plugins/protocol/http/protocol.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/protocol/http/protocol.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,348 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief HTTP Protocol Definitions + */ + +#include + +#include + +/** + * @addtogroup gearmand::protocol::HTTPatic Static HTTP Protocol Definitions + * @ingroup gearman_protocol_http + * @{ + */ + +/** + * Default values. + */ +#define GEARMAN_PROTOCOL_HTTP_DEFAULT_PORT "8080" + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +/* Protocol callback functions. */ +static gearmand_error_t _http_con_add(gearman_server_con_st *connection); +static void _http_free(gearman_server_con_st *connection, void *context); +static size_t _http_pack(const gearmand_packet_st *packet, gearman_server_con_st *connection, + void *data, size_t data_size, + gearmand_error_t *ret_ptr); +static size_t _http_unpack(gearmand_packet_st *packet, gearman_server_con_st *connection, + const void *data, size_t data_size, + gearmand_error_t *ret_ptr); + +namespace gearmand { +namespace protocol { + +HTTP::HTTP() : + Plugin("HTTP"), + _background(false), + _keep_alive(false) +{ + command_line_options().add_options() + ("http-port", boost::program_options::value(&global_port)->default_value(GEARMAN_PROTOCOL_HTTP_DEFAULT_PORT), "Port to listen on."); +} + +HTTP::~HTTP() +{ +} + +gearmand_error_t HTTP::start(gearmand_st *gearmand) +{ + return gearmand_port_add(gearmand, global_port.c_str(), _http_con_add); +} + +} // namespace protocol +} // namespace gearmand + +/* Line parsing helper function. */ +static const char *_http_line(const void *data, size_t data_size, + size_t *line_size, size_t *offset); + +/** @} */ + +/* + * Public definitions + */ + + +/* + * Static definitions + */ + +static gearmand_error_t _http_con_add(gearman_server_con_st *connection) +{ + gearmand::protocol::HTTP *http; + + http= new gearmand::protocol::HTTP; + if (not http) + { + gearmand_error("new"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + gearmand_connection_set_protocol(connection, http, _http_free, _http_pack, _http_unpack); + + return GEARMAN_SUCCESS; +} + +static void _http_free(gearman_server_con_st *connection __attribute__ ((unused)), + void *context) +{ + gearmand::protocol::HTTP *http; + http= (gearmand::protocol::HTTP *)context; + delete http; +} + +static size_t _http_pack(const gearmand_packet_st *packet, gearman_server_con_st *connection, + void *data, size_t data_size, + gearmand_error_t *ret_ptr) +{ + size_t pack_size; + gearmand::protocol::HTTP *http; + + http= (gearmand::protocol::HTTP *)gearmand_connection_protocol_context(connection); + + if (packet->command != GEARMAN_COMMAND_WORK_COMPLETE && + packet->command != GEARMAN_COMMAND_WORK_FAIL && + (http->background() == false || + packet->command != GEARMAN_COMMAND_JOB_CREATED)) + { + *ret_ptr= GEARMAN_IGNORE_PACKET; + return 0; + } + + pack_size= (size_t)snprintf((char *)data, data_size, + "HTTP/1.0 200 OK\r\n" + "X-Gearman-Job-Handle: %.*s\r\n" + "Content-Length: %"PRIu64"\r\n" + "Server: Gearman/" PACKAGE_VERSION "\r\n" + "\r\n", + packet->command == GEARMAN_COMMAND_JOB_CREATED ? (int)packet->arg_size[0] : (int)packet->arg_size[0] - 1, + (const char *)packet->arg[0], + (uint64_t)packet->data_size); + + if (pack_size > data_size) + { + *ret_ptr= GEARMAN_FLUSH_DATA; + return 0; + } + + if (! (http->keep_alive())) + { + gearman_io_set_option(&connection->con, GEARMAND_CON_CLOSE_AFTER_FLUSH, true); + } + + *ret_ptr= GEARMAN_SUCCESS; + return pack_size; +} + +static size_t _http_unpack(gearmand_packet_st *packet, gearman_server_con_st *connection, + const void *data, size_t data_size, + gearmand_error_t *ret_ptr) +{ + gearmand::protocol::HTTP *http; + size_t offset= 0; + const char *request; + size_t request_size; + const char *method; + ptrdiff_t method_size; + const char *uri; + ptrdiff_t uri_size; + const char *version; + size_t version_size; + const char *header; + size_t header_size; + char content_length[11]; /* 11 bytes to fit max display length of uint32_t */ + const char *unique= "-"; + size_t unique_size= 2; + gearmand_job_priority_t priority= GEARMAND_JOB_PRIORITY_NORMAL; + + /* Get the request line first. */ + request= _http_line(data, data_size, &request_size, &offset); + if (request == NULL || request_size == 0) + { + *ret_ptr= GEARMAN_IO_WAIT; + return offset; + } + + http= (gearmand::protocol::HTTP *)gearmand_connection_protocol_context(connection); + http->reset(); + + /* Parse out the method, URI, and HTTP version from the request line. */ + method= request; + uri= (const char *)memchr(request, ' ', request_size); + if (not uri) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad request line: %.*s", (uint32_t)request_size, request); + *ret_ptr= GEARMAN_INVALID_PACKET; + return 0; + } + + method_size= uri - request; + if ((method_size != 3 || + (strncasecmp(method, "GET", 3) && strncasecmp(method, "PUT", 3))) && + (method_size != 4 || strncasecmp(method, "POST", 4))) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad method: %.*s", (uint32_t)method_size, method); + *ret_ptr= GEARMAN_INVALID_PACKET; + return 0; + } + + while (*uri == ' ') + uri++; + + while (*uri == '/') + uri++; + + version= (const char *)memchr(uri, ' ', request_size - (size_t)(uri - request)); + if (version == NULL) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad request line: %.*s", + (uint32_t)request_size, request); + *ret_ptr= GEARMAN_INVALID_PACKET; + return 0; + } + + uri_size= version - uri; + if (uri_size == 0) + { + gearmand_error("must give function name in URI"); + *ret_ptr= GEARMAN_INVALID_PACKET; + return 0; + } + + while (*version == ' ') + version++; + + version_size= request_size - (size_t)(version - request); + + if (version_size == 8 && !strncasecmp(version, "HTTP/1.1", 8)) + { + http->set_keep_alive(true); + } + else if (version_size != 8 || strncasecmp(version, "HTTP/1.0", 8)) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad version: %.*s", (uint32_t)version_size, version); + *ret_ptr= GEARMAN_INVALID_PACKET; + return 0; + } + + /* Loop through all the headers looking for ones of interest. */ + while ((header= _http_line(data, data_size, &header_size, &offset)) != NULL) + { + if (header_size == 0) + break; + + if (header_size > 16 && !strncasecmp(header, "Content-Length: ", 16)) + { + if ((method_size == 4 && !strncasecmp(method, "POST", 4)) || + (method_size == 3 && !strncasecmp(method, "PUT", 3))) + { + snprintf(content_length, 11, "%.*s", (int)header_size - 16, + header + 16); + packet->data_size= (size_t)atoi(content_length); + } + } + else if (header_size == 22 && + !strncasecmp(header, "Connection: Keep-Alive", 22)) + { + http->set_keep_alive(true); + } + else if (header_size > 18 && !strncasecmp(header, "X-Gearman-Unique: ", 18)) + { + unique= header + 18; + unique_size= header_size - 18; + } + else if (header_size == 26 && + !strncasecmp(header, "X-Gearman-Background: true", 26)) + { + http->set_background(true); + } + else if (header_size == 24 && + !strncasecmp(header, "X-Gearman-Priority: high", 24)) + { + priority= GEARMAND_JOB_PRIORITY_HIGH; + } + else if (header_size == 23 && + !strncasecmp(header, "X-Gearman-Priority: low", 23)) + { + priority= GEARMAND_JOB_PRIORITY_LOW; + } + } + + /* Make sure we received the end of headers. */ + if (header == NULL) + { + *ret_ptr= GEARMAN_IO_WAIT; + return 0; + } + + /* Request and all headers complete, build a packet based on HTTP request. */ + packet->magic= GEARMAN_MAGIC_REQUEST; + + if (http->background()) + { + if (priority == GEARMAND_JOB_PRIORITY_NORMAL) + packet->command= GEARMAN_COMMAND_SUBMIT_JOB_BG; + else if (priority == GEARMAND_JOB_PRIORITY_HIGH) + packet->command= GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG; + else + packet->command= GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG; + } + else + { + if (priority == GEARMAND_JOB_PRIORITY_NORMAL) + packet->command= GEARMAN_COMMAND_SUBMIT_JOB; + else if (priority == GEARMAND_JOB_PRIORITY_HIGH) + packet->command= GEARMAN_COMMAND_SUBMIT_JOB_HIGH; + else + packet->command= GEARMAN_COMMAND_SUBMIT_JOB_LOW; + } + + *ret_ptr= gearmand_packet_pack_header(packet); + if (*ret_ptr != GEARMAN_SUCCESS) + return 0; + + *ret_ptr= gearmand_packet_create(packet, uri, (size_t)uri_size + 1); + if (*ret_ptr != GEARMAN_SUCCESS) + return 0; + + *ret_ptr= gearmand_packet_create(packet, unique, unique_size + 1); + if (*ret_ptr != GEARMAN_SUCCESS) + return 0; + + /* Make sure function and unique are NULL terminated. */ + packet->arg[0][uri_size]= 0; + packet->arg[1][unique_size]= 0; + + *ret_ptr= GEARMAN_SUCCESS; + return offset; +} + +static const char *_http_line(const void *data, size_t data_size, + size_t *line_size, size_t *offset) +{ + const char *start= (const char *)data + *offset; + const char *end; + + end= (const char *)memchr(start, '\n', data_size - *offset); + if (end == NULL) + return NULL; + + *offset+= (size_t)(end - start) + 1; + + if (end != start && *(end - 1) == '\r') + end--; + + *line_size= (size_t)(end - start); + + return start; +} diff -Nru gearmand-0.14/libgearman-server/plugins/protocol/http/protocol.h gearmand-0.23/libgearman-server/plugins/protocol/http/protocol.h --- gearmand-0.14/libgearman-server/plugins/protocol/http/protocol.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/protocol/http/protocol.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,63 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief HTTP Protocol Declarations + */ + +#pragma once + +#include + +struct gearmand_st; + +namespace gearmand { +namespace protocol { + +class HTTP : public gearmand::Plugin { + bool _background; + bool _keep_alive; + std::string global_port; + +public: + + HTTP(); + ~HTTP(); + + gearmand_error_t start(gearmand_st *gearmand); + + bool background() + { + return _background; + } + + bool keep_alive() + { + return _keep_alive; + } + + void set_background(bool arg) + { + _background= arg; + } + + void set_keep_alive(bool arg) + { + _keep_alive= arg; + } + + void reset() + { + _background= false; + _keep_alive= false; + } +}; + +} // namespace protocol +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/protocol/include.am gearmand-0.23/libgearman-server/plugins/protocol/include.am --- gearmand-0.14/libgearman-server/plugins/protocol/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/protocol/include.am 2011-03-08 07:00:29.000000000 +0100 @@ -0,0 +1,12 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +include libgearman-server/plugins/protocol/http/include.am diff -Nru gearmand-0.14/libgearman-server/plugins/protocol.h gearmand-0.23/libgearman-server/plugins/protocol.h --- gearmand-0.14/libgearman-server/plugins/protocol.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/protocol.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,41 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + diff -Nru gearmand-0.14/libgearman-server/plugins/queue/base.h gearmand-0.23/libgearman-server/plugins/queue/base.h --- gearmand-0.14/libgearman-server/plugins/queue/base.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/base.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,65 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include + +namespace gearmand { +namespace plugins { + +class Queue : public gearmand::Plugin { +public: + Queue(const std::string &arg) : + Plugin(arg) + { + gearmand::queue::add(this); + } + + virtual gearmand_error_t initialize()= 0; + + virtual ~Queue() + {}; + + typedef std::vector vector; + +private: +}; + +} // namespace plugin +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/queue/drizzle/include.am gearmand-0.23/libgearman-server/plugins/queue/drizzle/include.am --- gearmand-0.14/libgearman-server/plugins/queue/drizzle/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/drizzle/include.am 2011-04-28 21:40:57.000000000 +0200 @@ -0,0 +1,22 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +if HAVE_LIBDRIZZLE +noinst_HEADERS+= libgearman-server/plugins/queue/drizzle/queue.h + +libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/drizzle/queue.cc +libgearman_server_libgearman_server_la_LIBADD+= $(libdrizzle_LIBS) +libgearman_server_libgearman_server_la_CXXFLAGS+= $(libdrizzle_CFLAGS) + +gearmand_gearmand_LDADD+= $(libdrizzle_LIBS) +gearmand_gearmand_CPPFLAGS+= $(libdrizzle_CFLAGS) + +endif diff -Nru gearmand-0.14/libgearman-server/plugins/queue/drizzle/queue.cc gearmand-0.23/libgearman-server/plugins/queue/drizzle/queue.cc --- gearmand-0.14/libgearman-server/plugins/queue/drizzle/queue.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/drizzle/queue.cc 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,603 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief libdrizzle Queue Storage Definitions + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include + +using namespace gearmand_internal; +using namespace gearmand; + +namespace gearmand { namespace plugins { namespace queue { class Drizzle; }}} + +static gearmand_error_t gearman_server_queue_libdrizzle_init(plugins::queue::Drizzle *queue, gearman_server_st *server); + +/** + * @addtogroup plugins::queue::Drizzleatic Static libdrizzle Queue Storage Definitions + * @ingroup gearman_queue_libdrizzle + * @{ + */ + +/** + * Default values. + */ +#define GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_DATABASE "gearman" +#define GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_TABLE "queue" +#define GEARMAN_QUEUE_QUERY_BUFFER 256 + +#define libdrizzle_failed(X) bool(X != DRIZZLE_RETURN_OK) + +namespace gearmand { +namespace plugins { +namespace queue { + +class Drizzle : public gearmand::plugins::Queue { +public: + Drizzle(); + ~Drizzle(); + + gearmand_error_t initialize(); + + drizzle_result_st *result() + { + return &_result; + } + + void resize_query(size_t arg) + { + _query.resize(arg); + } + + char *query_ptr() + { + return &_query[0]; + } + + void set_epoch_support(bool arg) + { + _epoch_support= arg; + } + + bool epoch_support() + { + return _epoch_support; + } + + drizzle_st *drizzle; + drizzle_con_st *con; + drizzle_result_st _result; + std::vector _query; + std::string host; + std::string username; + std::string password; + std::string uds; + std::string user; + std::string schema; + std::string table; + bool mysql_protocol; + in_port_t port; + +private: + bool _epoch_support; +}; + + +Drizzle::Drizzle () : + Queue("libdrizzle"), + drizzle(NULL), + con(NULL), + _result(), + _query(), + username(""), + _epoch_support(true) +{ + command_line_options().add_options() + ("libdrizzle-host", boost::program_options::value(&host)->default_value("localhost"), "Host of server.") + ("libdrizzle-port", boost::program_options::value(&port)->default_value(4427), "Port of server. (by default Drizzle)") + ("libdrizzle-uds", boost::program_options::value(&uds), "Unix domain socket for server.") + ("libdrizzle-user", boost::program_options::value(&user)->default_value("root"), "User name for authentication.") + ("libdrizzle-password", boost::program_options::value(&password), "Password for authentication.") + ("libdrizzle-db", boost::program_options::value(&schema)->default_value(GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_DATABASE), "Database to use.") + ("libdrizzle-table", boost::program_options::value(&table)->default_value(GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_TABLE), "Table to use.") + ("libdrizzle-mysql", boost::program_options::bool_switch(&mysql_protocol)->default_value(false), "Use MySQL protocol.") + ; + + drizzle =drizzle_create(NULL); + con= drizzle_con_create(drizzle, NULL); +} + +Drizzle::~Drizzle() +{ + drizzle_con_free(con); + drizzle_free(drizzle); +} + +gearmand_error_t Drizzle::initialize() +{ + return gearman_server_queue_libdrizzle_init(this, &Gearmand()->server); +} + +void initialize_drizzle() +{ + static Drizzle local_instance; +} + +} // namespace queue +} // namespace plugins +} // namespace gearmand + +/** + * Query error handling function. + */ +static drizzle_return_t _libdrizzle_query(plugins::queue::Drizzle *queue, + const char *query, size_t query_size); + +/* Queue callback functions. */ +static gearmand_error_t _libdrizzle_add(gearman_server_st *server, + void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when); + +static gearmand_error_t _libdrizzle_flush(gearman_server_st *gearman, + void *context); + +static gearmand_error_t _libdrizzle_done(gearman_server_st *gearman, + void *context, const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size); + +static gearmand_error_t _libdrizzle_replay(gearman_server_st *gearman, + void *context, + gearman_queue_add_fn *add_fn, + void *add_context); + +/** @} */ + +/* + * Public definitions + */ + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +gearmand_error_t gearman_server_queue_libdrizzle_init(plugins::queue::Drizzle *queue, gearman_server_st *server) +{ + gearmand_info("Initializing libdrizzle module"); + + if (drizzle_create(queue->drizzle) == NULL) + { + gearmand_error("drizzle_create"); + return GEARMAN_QUEUE_ERROR; + } + + if (drizzle_con_create(queue->drizzle, queue->con) == NULL) + { + gearmand_error("drizzle_con_create"); + return GEARMAN_QUEUE_ERROR; + } + + drizzle_con_set_db(queue->con, queue->schema.c_str()); + + if (queue->mysql_protocol) + drizzle_con_set_options(queue->con, DRIZZLE_CON_MYSQL); + + if (queue->uds.empty()) + { + drizzle_con_set_tcp(queue->con, queue->host.c_str(), queue->port); + } + else + { + drizzle_con_set_uds(queue->con, queue->uds.c_str()); + } + + drizzle_con_set_auth(queue->con, queue->user.c_str(), queue->password.c_str()); + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Using '%s' as the username", queue->user.c_str()); + + std::string query; + + query+= "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = \""; + query+= queue->schema; + query+= "\""; + if (libdrizzle_failed(_libdrizzle_query(queue, query.c_str(), query.size()))) + { + return gearmand_gerror("Error occurred while searching for gearman queue schema", GEARMAN_QUEUE_ERROR); + } + + if (libdrizzle_failed(drizzle_result_buffer(queue->result()))) + { + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + + if (not drizzle_result_row_count(queue->result())) + { + return gearmand_gerror("Error occurred while search for gearman queue schema", GEARMAN_QUEUE_ERROR); + } + drizzle_result_free(queue->result()); + + // We need to check and see if the tables exists, and if not create it + query.clear(); + query+= "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = \"" +queue->table +"\""; + if (libdrizzle_failed(_libdrizzle_query(queue, query.c_str(), query.size()))) + { + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + + if (libdrizzle_failed(drizzle_result_buffer(queue->result()))) + { + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + bool create_table= drizzle_result_row_count(queue->result()); + drizzle_result_free(queue->result()); + + if (not create_table) + { + gearmand_log_info("libdrizzle module creating table '%s.%s'", + drizzle_con_db(queue->con), queue->table.c_str()); + + query.clear(); + + query+= "CREATE TABLE " +queue->table + "( unique_key VARCHAR(" + TOSTRING(GEARMAN_UNIQUE_SIZE) + "),"; + query+= "function_name VARCHAR(255), priority INT, data LONGBLOB, when_to_run BIGINT, unique key (unique_key, function_name))"; + + if (libdrizzle_failed(_libdrizzle_query(queue, query.c_str(), query.size()))) + { + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + + if (libdrizzle_failed(drizzle_column_skip(queue->result()))) + { + drizzle_result_free(queue->result()); + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + drizzle_result_free(queue->result()); + } + else + { + gearmand_log_info("libdrizzle module using table '%s.%s'", + drizzle_con_db(queue->con), queue->table.c_str()); + + query.clear(); + query+= "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = \"" +queue->schema +"\" "; + query+= "AND TABLE_NAME = \"" +queue->table +"\" AND COLUMN_NAME = \"when_to_run\""; + if (libdrizzle_failed(_libdrizzle_query(queue, query.c_str(), query.size()))) + { + return GEARMAN_QUEUE_ERROR; + } + + if (libdrizzle_failed(drizzle_result_buffer(queue->result()))) + { + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + + if (not drizzle_result_row_count(queue->result())) + { + gearmand_info("Current schema does not have when_to_run column"); + queue->set_epoch_support(false); + } + drizzle_result_free(queue->result()); + } + + gearman_server_set_queue(server, queue, _libdrizzle_add, _libdrizzle_flush, _libdrizzle_done, _libdrizzle_replay); + + return GEARMAN_SUCCESS; +} + +/* + * Static definitions + */ + +static drizzle_return_t _libdrizzle_query(plugins::queue::Drizzle *queue, + const char *query, size_t query_size) +{ + drizzle_return_t ret; + + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, "libdrizzle query: %.*s", (uint32_t)query_size, query); + + drizzle_result_st *result= drizzle_query(queue->con, queue->result(), query, query_size, &ret); + if (ret != DRIZZLE_RETURN_OK) + { + + if (ret == DRIZZLE_RETURN_COULD_NOT_CONNECT) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "Failed to connect to database instance. host: %s:%d user: %s schema: %s (%s)", + drizzle_con_host(queue->con), + (int)(drizzle_con_port(queue->con)), + drizzle_con_user(queue->con), + drizzle_con_db(queue->con), + drizzle_error(queue->drizzle)); + } + else + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "libdrizled error '%s' executing '%.*s'", + drizzle_error(queue->drizzle), + query_size, query); + } + + return ret; + } + (void)result; + + return DRIZZLE_RETURN_OK; +} + +static gearmand_error_t _libdrizzle_add(gearman_server_st *, + void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when) +{ + plugins::queue::Drizzle *queue= (plugins::queue::Drizzle *)context; + Byte query; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libdrizzle add: %.*s", (uint32_t)unique_size, (char *)unique); + + if (when and not queue->epoch_support()) + { + return gearmand_gerror("Table lacks when_to_run field", GEARMAN_QUEUE_ERROR); + } + + // @todo test for overallocation failure + query.resize(((unique_size + function_name_size + data_size) * 2) + GEARMAN_QUEUE_QUERY_BUFFER); + + size_t query_size; + + if (queue->epoch_support()) + { + query_size= (size_t)snprintf(query.c_str(), query.size(), + "INSERT INTO %s SET priority=%u,when_to_run=%lld,unique_key='", + queue->table.c_str(), (uint32_t)priority, + (long long unsigned int)when); + } + else + { + query_size= (size_t)snprintf(query.c_str(), query.size(), + "INSERT INTO %s SET priority=%u,unique_key='", + queue->table.c_str(), (uint32_t)priority); + } + + query_size+= (size_t)drizzle_escape_string((char *)(query.c_str() + query_size), (const char *)unique, unique_size); + memcpy(query.c_str() + query_size, "',function_name='", 17); + query_size+= 17; + + query_size+= (size_t)drizzle_escape_string(query.c_str() + query_size, (const char *)function_name, + function_name_size); + memcpy(query.c_str() + query_size, "',data='", 8); + query_size+= 8; + + query_size+= (size_t)drizzle_escape_string(query.c_str() + query_size, (const char *)data, + data_size); + memcpy(query.c_str() + query_size, "'", 1); + query_size+= 1; + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "%.*s", query_size, query.c_str()); + + + + if (_libdrizzle_query(queue, query.c_str(), query_size) != DRIZZLE_RETURN_OK) + return GEARMAN_QUEUE_ERROR; + + drizzle_result_free(queue->result()); + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libdrizzle_flush(gearman_server_st *, void *) +{ + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libdrizzle flush"); + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libdrizzle_done(gearman_server_st *, + void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size) +{ + plugins::queue::Drizzle *queue= (plugins::queue::Drizzle *)context; + Byte escaped_function_name(function_name_size*2); + Byte escaped_unique_name(unique_size*2); + Byte query(function_name_size*2 + unique_size*2 +queue->table.size() +GEARMAN_QUEUE_QUERY_BUFFER); + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "libdrizzle done: %.*s(%.*s)", + uint32_t(function_name_size), (char *)function_name, + uint32_t(unique_size), (char *)unique); + + (void)drizzle_escape_string(escaped_unique_name.c_str(), (const char *)unique, unique_size); + (void)drizzle_escape_string(escaped_function_name.c_str(), (const char *)function_name, function_name_size); + + ssize_t query_size= (ssize_t)snprintf(query.c_str(), query.size(), + "DELETE FROM %s WHERE unique_key='%s' and function_name= '%s'", + queue->table.c_str(), + escaped_unique_name.c_str(), + escaped_function_name.c_str()); + + if (query_size < 0 || size_t(query_size) > query.size()) + { + return gearmand_gerror("snprintf(DELETE)", GEARMAN_MEMORY_ALLOCATION_FAILURE); + } + + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, "%.*", size_t(query_size), query.c_str()); + + if (_libdrizzle_query(queue, query.c_str(), (size_t)query_size) != DRIZZLE_RETURN_OK) + { + return GEARMAN_QUEUE_ERROR; + } + + drizzle_result_free(queue->result()); + + return GEARMAN_SUCCESS; +} + +#if 0 +static gearmand_error_t _dump_queue(plugins::queue::Drizzle *queue) +{ + char query[DRIZZLE_MAX_TABLE_SIZE + GEARMAN_QUEUE_QUERY_BUFFER]; + + size_t query_size; + query_size= (size_t)snprintf(query, sizeof(query), + "SELECT unique_key,function_name FROM %s", + queue->table.c_str()); + + if (_libdrizzle_query(NULL, queue, query, query_size) != DRIZZLE_RETURN_OK) + { + gearmand_log_error("drizzle_column_skip:%s", drizzle_error(queue->drizzle)); + return GEARMAN_QUEUE_ERROR; + } + + if (drizzle_column_skip(queue->result()) != DRIZZLE_RETURN_OK) + { + drizzle_result_free(queue->result()); + gearmand_log_error("drizzle_column_skip:%s", drizzle_error(queue->drizzle)); + + return GEARMAN_QUEUE_ERROR; + } + + gearmand_debug("Shutting down with the following items left to be processed."); + while (1) + { + drizzle_return_t ret; + drizzle_row_t row= drizzle_row_buffer(queue->result(), &ret); + + if (ret != DRIZZLE_RETURN_OK) + { + drizzle_result_free(queue->result()); + gearmand_log_error("drizzle_row_buffer:%s", drizzle_error(queue->drizzle)); + + return GEARMAN_QUEUE_ERROR; + } + + if (row == NULL) + break; + + size_t *field_sizes; + field_sizes= drizzle_row_field_sizes(queue->result()); + + gearmand_log_debug("\t unique: %.*s function: %.*s", + (uint32_t)field_sizes[0], row[0], + (uint32_t)field_sizes[1], row[1] + ); + + drizzle_row_free(queue->result(), row); + } + + drizzle_result_free(queue->result()); + + return GEARMAN_SUCCESS; +} +#endif + +static gearmand_error_t _libdrizzle_replay(gearman_server_st *server, + void *context, + gearman_queue_add_fn *add_fn, + void *add_context) +{ + plugins::queue::Drizzle *queue= (plugins::queue::Drizzle *)context; + size_t *field_sizes; + gearmand_error_t gret; + + gearmand_info("libdrizzle replay start"); + + std::string query; + if (queue->epoch_support()) + { + query+= "SELECT unique_key,function_name,priority,data,when_to_run FROM " + queue->table; + } + else + { + query+= "SELECT unique_key,function_name,priority,data FROM " +queue->table; + } + + if (libdrizzle_failed(_libdrizzle_query(queue, query.c_str(), query.size()))) + { + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + + if (drizzle_column_skip(queue->result()) != DRIZZLE_RETURN_OK) + { + drizzle_result_free(queue->result()); + return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); + } + + while (1) + { + drizzle_return_t ret; + drizzle_row_t row= drizzle_row_buffer(queue->result(), &ret); + + if (ret != DRIZZLE_RETURN_OK) + { + drizzle_result_free(queue->result()); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "drizzle_row_buffer:%s", drizzle_error(queue->drizzle)); + + return GEARMAN_QUEUE_ERROR; + } + + if (row == NULL) + break; + + field_sizes= drizzle_row_field_sizes(queue->result()); + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libdrizzle replay: %.*s", (uint32_t)field_sizes[0], row[0]); + + size_t data_size= field_sizes[3]; + /* need to make a copy here ... gearman_server_job_free will free it later */ + char *data= (char *)malloc(data_size); + if (data == NULL) + { + gearmand_perror("Failed to allocate data while replaying the queue"); + drizzle_row_free(queue->result(), row); + drizzle_result_free(queue->result()); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + memcpy(data, row[3], data_size); + + int64_t when; + if (not queue->epoch_support()) + { + when= 0; + } + else + { + when= atoi(row[4]); + } + + gret= (*add_fn)(server, add_context, row[0], field_sizes[0], + row[1], field_sizes[1], + data, data_size, (gearmand_job_priority_t)atoi(row[2]), when); + + if (gret != GEARMAN_SUCCESS) + { + drizzle_row_free(queue->result(), row); + drizzle_result_free(queue->result()); + return gret; + } + + drizzle_row_free(queue->result(), row); + } + + drizzle_result_free(queue->result()); + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman-server/plugins/queue/drizzle/queue.h gearmand-0.23/libgearman-server/plugins/queue/drizzle/queue.h --- gearmand-0.14/libgearman-server/plugins/queue/drizzle/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/drizzle/queue.h 2011-04-28 02:23:23.000000000 +0200 @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +namespace gearmand { +namespace plugins { +namespace queue { + +void initialize_drizzle(); + +} // namespace queue +} // namespace plugin +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/queue/include.am gearmand-0.23/libgearman-server/plugins/queue/include.am --- gearmand-0.14/libgearman-server/plugins/queue/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/include.am 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,19 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +noinst_HEADERS+= \ + libgearman-server/plugins/queue/base.h + +include libgearman-server/plugins/queue/drizzle/include.am +include libgearman-server/plugins/queue/libmemcached/include.am +include libgearman-server/plugins/queue/postgres/include.am +include libgearman-server/plugins/queue/sqlite/include.am +include libgearman-server/plugins/queue/tokyocabinet/include.am diff -Nru gearmand-0.14/libgearman-server/plugins/queue/libmemcached/include.am gearmand-0.23/libgearman-server/plugins/queue/libmemcached/include.am --- gearmand-0.14/libgearman-server/plugins/queue/libmemcached/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/libmemcached/include.am 2011-04-28 21:40:50.000000000 +0200 @@ -0,0 +1,21 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +if HAVE_LIBMEMCACHED +noinst_HEADERS+= libgearman-server/plugins/queue/libmemcached/queue.h + +libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/libmemcached/queue.cc +libgearman_server_libgearman_server_la_CXXFLAGS+= $(libmemcached_CFLAGS) +libgearman_server_libgearman_server_la_LIBADD+= $(libmemcached_LIBS) + +gearmand_gearmand_LDADD+= $(libmemcached_LIBS) +gearmand_gearmand_CPPFLAGS+= $(libmemcached_CFLAGS) +endif diff -Nru gearmand-0.14/libgearman-server/plugins/queue/libmemcached/queue.cc gearmand-0.23/libgearman-server/plugins/queue/libmemcached/queue.cc --- gearmand-0.14/libgearman-server/plugins/queue/libmemcached/queue.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/libmemcached/queue.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,328 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief libmemcached Queue Storage Definitions + */ + +#include + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +using namespace gearmand; + +/** + * @addtogroup gearmand::plugins::queue::Libmemcachedatic Static libmemcached Queue Storage Functions + * @ingroup gearman_queue_libmemcached + * @{ + */ + +/** + * Default values. + */ +#define GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX "gear_" + +namespace gearmand { namespace plugins { namespace queue { class Libmemcached; }}} + +static gearmand_error_t +_initialize(plugins::queue::Libmemcached *queue_obj, + gearman_server_st *server); + +namespace gearmand { +namespace plugins { +namespace queue { + +class Libmemcached : public gearmand::plugins::Queue { +public: + Libmemcached (); + ~Libmemcached (); + + gearmand_error_t initialize(); + + memcached_st memc; + std::string server_list; +private: + +}; + +Libmemcached::Libmemcached() : + Queue("libmemcached") +{ + memcached_create(&memc); + + command_line_options().add_options() + ("libmemcached-servers", boost::program_options::value(&server_list), "List of Memcached servers to use."); +} + +Libmemcached::~Libmemcached() +{ + memcached_free(&memc); +} + +gearmand_error_t Libmemcached::initialize() +{ + return _initialize(this, &Gearmand()->server); +} + +void initialize_libmemcached() +{ + static Libmemcached local_instance; +} + +} // namespace queue +} // namespace plugins +} // namespace gearmand + +/* Queue callback functions. */ +static gearmand_error_t _libmemcached_add(gearman_server_st *server, + void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when); + +static gearmand_error_t _libmemcached_flush(gearman_server_st *server, + void *context); + +static gearmand_error_t _libmemcached_done(gearman_server_st *server, + void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size); + +static gearmand_error_t _libmemcached_replay(gearman_server_st *server, + void *context, + gearman_queue_add_fn *add_fn, + void *add_context); + +/** @} */ + +/* + * Public definitions + */ + +gearmand_error_t _initialize(plugins::queue::Libmemcached *queue, + gearman_server_st *server) +{ + memcached_server_st *servers; + + gearmand_info("Initializing libmemcached module"); + + servers= memcached_servers_parse(queue->server_list.c_str()); + + if (servers == NULL) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "memcached_servers_parse"); + + return GEARMAN_QUEUE_ERROR; + } + + memcached_server_push(&queue->memc, servers); + memcached_server_list_free(servers); + + gearman_server_set_queue(server, queue, _libmemcached_add, _libmemcached_flush, _libmemcached_done, _libmemcached_replay); + + return GEARMAN_SUCCESS; +} + +/* + * Static definitions + */ + +static gearmand_error_t _libmemcached_add(gearman_server_st *server, + void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when) +{ + gearmand::plugins::queue::Libmemcached *queue= (gearmand::plugins::queue::Libmemcached *)context; + memcached_return rc; + char key[MEMCACHED_MAX_KEY]; + size_t key_length; + + if (when) // No support for EPOCH jobs + return GEARMAN_QUEUE_ERROR; + + (void)server; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libmemcached add: %.*s", (uint32_t)unique_size, (char *)unique); + + key_length= (size_t)snprintf(key, MEMCACHED_MAX_KEY, "%s%.*s-%.*s", + GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX, + (int)function_name_size, + (const char *)function_name, (int)unique_size, + (const char *)unique); + + rc= memcached_set(&queue->memc, (const char *)key, key_length, + (const char *)data, data_size, 0, (uint32_t)priority); + + if (rc != MEMCACHED_SUCCESS) + return GEARMAN_QUEUE_ERROR; + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libmemcached_flush(gearman_server_st *server, + void *context) +{ + gearmand_debug("libmemcached flush"); + (void)server; + (void)context; + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libmemcached_done(gearman_server_st *server, + void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size) +{ + size_t key_length; + char key[MEMCACHED_MAX_KEY]; + memcached_return rc; + gearmand::plugins::queue::Libmemcached *queue= (gearmand::plugins::queue::Libmemcached *)context; + (void)server; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libmemcached done: %.*s", (uint32_t)unique_size, (char *)unique); + + key_length= (size_t)snprintf(key, MEMCACHED_MAX_KEY, "%s%.*s-%.*s", + GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX, + (int)function_name_size, + (const char *)function_name, (int)unique_size, + (const char *)unique); + + /* For the moment we will assume it happened */ + rc= memcached_delete(&queue->memc, (const char *)key, key_length, 0); + + if (rc != MEMCACHED_SUCCESS) + return GEARMAN_QUEUE_ERROR; + + return GEARMAN_SUCCESS; +} + +struct replay_context +{ + memcached_st clone; + gearman_server_st *server; + gearman_queue_add_fn *add_fn; + void *add_context; +}; + +static memcached_return callback_loader(const memcached_st *ptr __attribute__((unused)), + memcached_result_st *result __attribute__((unused)), + void *context) +{ + struct replay_context *container= (struct replay_context *)context; + const char *key; + const char *unique; + const char *function; + size_t function_len; + char *data; + size_t data_size; + + key= memcached_result_key_value(result); + if (strncmp(key, GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX, strlen(GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX))) + return MEMCACHED_SUCCESS; + + function= key + strlen(GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX); + + unique= index(function, '-'); + + if (! unique) + return MEMCACHED_SUCCESS; + + function_len = (size_t) (unique-function); + unique++; + + assert(unique); + assert(strlen(unique)); + assert(function); + assert(function_len); + + data_size= (size_t) memcached_result_length(result); + /* need to make a copy here ... gearman_server_job_free will free it later */ + data= (char *)malloc(data_size); + if (data == NULL) + { + gearmand_perror("malloc"); + return MEMCACHED_MEMORY_ALLOCATION_FAILURE; + } + memcpy(data, memcached_result_value(result), data_size); + + /* Currently not looking at failure cases */ + (void)(*container->add_fn)(container->server, container->add_context, + unique, strlen(unique), + function, function_len, + data, data_size, + static_cast(memcached_result_flags(result)), 0); + + + return MEMCACHED_SUCCESS; +} + +/* Grab the object and load it into the loader */ +static memcached_return callback_for_key(const memcached_st *ptr __attribute__((unused)), + const char *key, size_t key_length, + void *context) +{ + memcached_return rc; + struct replay_context *container= (struct replay_context *)context; + memcached_execute_function callbacks[1]; + char *passable[1]; + + callbacks[0]= (memcached_execute_fn)&callback_loader; + + passable[0]= (char *)key; + rc= memcached_mget(&container->clone, passable, &key_length, 1); + + /* Just void errors for the moment, since other treads might have picked up the object. */ + (void)memcached_fetch_execute(&container->clone, callbacks, context, 1); + + return MEMCACHED_SUCCESS; +} + +/* + If we have any failures for loading values back into replay we just ignore them. +*/ +static gearmand_error_t _libmemcached_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context) +{ + gearmand::plugins::queue::Libmemcached *queue= (gearmand::plugins::queue::Libmemcached *)context; + struct replay_context container; + memcached_st *check_for_failure; + memcached_dump_func callbacks[1]; + + callbacks[0]= (memcached_dump_fn)&callback_for_key; + + gearmand_info("libmemcached replay start"); + + memset(&container, 0, sizeof(struct replay_context)); + check_for_failure= memcached_clone(&container.clone, &queue->memc); + container.server= server; + container.add_fn= add_fn; + container.add_context= add_context; + + assert(check_for_failure); + + + (void)memcached_dump(&queue->memc, callbacks, (void *)&container, 1); + + memcached_free(&container.clone); + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman-server/plugins/queue/libmemcached/queue.h gearmand-0.23/libgearman-server/plugins/queue/libmemcached/queue.h --- gearmand-0.14/libgearman-server/plugins/queue/libmemcached/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/libmemcached/queue.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +namespace gearmand { +namespace plugins { +namespace queue { + +void initialize_libmemcached(); + +} // namespace queue +} // namespace plugin +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/queue/postgres/include.am gearmand-0.23/libgearman-server/plugins/queue/postgres/include.am --- gearmand-0.14/libgearman-server/plugins/queue/postgres/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/postgres/include.am 2011-04-28 21:35:32.000000000 +0200 @@ -0,0 +1,19 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +if HAVE_LIBPQ +noinst_HEADERS+= libgearman-server/plugins/queue/postgres/queue.h + +libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/postgres/queue.cc + +libgearman_server_libgearman_server_la_LIBADD+= $(LTLIBPQ) +endif + diff -Nru gearmand-0.14/libgearman-server/plugins/queue/postgres/queue.cc gearmand-0.23/libgearman-server/plugins/queue/postgres/queue.cc --- gearmand-0.14/libgearman-server/plugins/queue/postgres/queue.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/postgres/queue.cc 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,377 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief libpq Queue Storage Definitions + */ + +#include +#include + +#include +#include + +#if defined(HAVE_LIBPQ_FE_H) +# include +# include +#else +# include +# include +#endif + +/** + * @addtogroup plugins::queue::Postgresatic Static libpq Queue Storage Definitions + * @ingroup gearman_queue_libpq + * @{ + */ + +/** + * Default values. + */ +#define GEARMAN_QUEUE_LIBPQ_DEFAULT_TABLE "queue" +#define GEARMAN_QUEUE_QUERY_BUFFER 256 + +namespace gearmand { namespace plugins { namespace queue { class Postgres; }}} + +static gearmand_error_t _initialize(gearman_server_st *server, gearmand::plugins::queue::Postgres *queue); + +namespace gearmand { +namespace plugins { +namespace queue { + +class Postgres : public gearmand::plugins::Queue { +public: + Postgres(); + ~Postgres(); + + gearmand_error_t initialize(); + + const std::string &insert() + { + return _insert_query; + } + + const std::string &select() + { + return _select_query; + } + + const std::string &create() + { + return _create_query; + } + + PGconn *con; + std::string postgres_connect_string; + std::string table; + std::vector query_buffer; + +public: + std::string _insert_query; + std::string _select_query; + std::string _create_query; +}; + +Postgres::Postgres() : + Queue("Postgres"), + con(NULL), + postgres_connect_string(""), + table(""), + query_buffer() +{ + command_line_options().add_options() + ("libpq-conninfo", boost::program_options::value(&postgres_connect_string)->default_value(""), "PostgreSQL connection information string.") + ("libpq-table", boost::program_options::value(&table)->default_value(GEARMAN_QUEUE_LIBPQ_DEFAULT_TABLE), "Table to use."); +} + +Postgres::~Postgres () +{ + if (con) + PQfinish(con); +} + +gearmand_error_t Postgres::initialize() +{ + _create_query+= "CREATE TABLE " +table +" (unique_key VARCHAR" +"(" + TOSTRING(GEARMAN_UNIQUE_SIZE) +"), "; + _create_query+= "function_name VARCHAR(255), priority INTEGER, data BYTEA, when_to_run INTEGER, UNIQUE (unique_key, function_name))"; + + gearmand_error_t ret= _initialize(&Gearmand()->server, this); + + _insert_query+= "INSERT INTO " +table +" (priority, unique_key, function_name, data, when_to_run) VALUES($1,$2,$3,$4::BYTEA,$5)"; + + _select_query+= "SELECT unique_key,function_name,priority,data,when_to_run FROM " +table; + + return ret; +} + +void initialize_postgres() +{ + static Postgres local_instance; +} + +} // namespace queue +} // namespace plugins +} // namespace gearmand + +/** + * PostgreSQL notification callback. + */ +static void _libpq_notice_processor(void *arg, const char *message); + +/* Queue callback functions. */ +static gearmand_error_t _libpq_add(gearman_server_st *server, void *context, + const char *unique, size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when); + +static gearmand_error_t _libpq_flush(gearman_server_st *server, void *context); + +static gearmand_error_t _libpq_done(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size); + +static gearmand_error_t _libpq_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context); + +/** @} */ + +/* + * Public definitions + */ + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +gearmand_error_t _initialize(gearman_server_st *server, + gearmand::plugins::queue::Postgres *queue) +{ + PGresult *result; + + gearmand_info("Initializing libpq module"); + + gearman_server_set_queue(server, queue, _libpq_add, _libpq_flush, _libpq_done, _libpq_replay); + + queue->con= PQconnectdb(queue->postgres_connect_string.c_str()); + + if (queue->con == NULL || PQstatus(queue->con) != CONNECTION_OK) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "PQconnectdb: %s", PQerrorMessage(queue->con)); + gearman_server_set_queue(server, NULL, NULL, NULL, NULL, NULL); + return GEARMAN_QUEUE_ERROR; + } + + (void)PQsetNoticeProcessor(queue->con, _libpq_notice_processor, server); + + std::string query("SELECT tablename FROM pg_tables WHERE tablename='" +queue->table + "'"); + + result= PQexec(queue->con, query.c_str()); + if (result == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) + { + std::string error_string= "PQexec:"; + error_string+= PQerrorMessage(queue->con); + gearmand_gerror(error_string.c_str(), GEARMAN_QUEUE_ERROR); + PQclear(result); + return GEARMAN_QUEUE_ERROR; + } + + if (PQntuples(result) == 0) + { + PQclear(result); + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "libpq module creating table '%s'", queue->table.c_str()); + + result= PQexec(queue->con, queue->create().c_str()); + if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "PQexec:%s", PQerrorMessage(queue->con)); + PQclear(result); + gearman_server_set_queue(server, NULL, NULL, NULL, NULL, NULL); + return GEARMAN_QUEUE_ERROR; + } + + PQclear(result); + } + else + { + PQclear(result); + } + + return GEARMAN_SUCCESS; +} + +/* + * Static definitions + */ + +static void _libpq_notice_processor(void *arg, const char *message) +{ + (void)arg; + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "PostgreSQL %s", message); +} + +static gearmand_error_t _libpq_add(gearman_server_st *server, void *context, + const char *unique, size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when) +{ + (void)server; + (void)when; + gearmand::plugins::queue::Postgres *queue= (gearmand::plugins::queue::Postgres *)context; + + char buffer[22]; + snprintf(buffer, sizeof(buffer), "%u", static_cast(priority)); + + const char *param_values[]= { + (char *)buffer, + (char *)unique, + (char *)function_name, + (char *)data, + (char *)when }; + + int param_lengths[]= { + (int)strlen(buffer), + (int)unique_size, + (int)function_name_size, + (int)data_size, + (int)when }; + + int param_formats[] = { 0, 0, 0, 1, 0 }; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libpq add: %.*s", (uint32_t)unique_size, (char *)unique); + + PGresult *result= PQexecParams(queue->con, queue->insert().c_str(), + gearmand_array_size(param_lengths), + NULL, param_values, param_lengths, param_formats, 0); + if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "PQexec:%s", PQerrorMessage(queue->con)); + PQclear(result); + return GEARMAN_QUEUE_ERROR; + } + + PQclear(result); + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libpq_flush(gearman_server_st *, void *) +{ + gearmand_debug("libpq flush"); + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libpq_done(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size) +{ + (void)server; + (void)function_name_size; + gearmand::plugins::queue::Postgres *queue= (gearmand::plugins::queue::Postgres *)context; + PGresult *result; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libpq done: %.*s", (uint32_t)unique_size, (char *)unique); + + std::string query; + query+= "DELETE FROM "; + query+= queue->table; + query+= " WHERE unique_key='"; + query+= (const char *)unique; + query+= "' AND function_name='"; + query+= (const char *)function_name; + query+= "'"; + + result= PQexec(queue->con, query.c_str()); + if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "PQexec:%s", PQerrorMessage(queue->con)); + PQclear(result); + return GEARMAN_QUEUE_ERROR; + } + + PQclear(result); + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libpq_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context) +{ + gearmand::plugins::queue::Postgres *queue= (gearmand::plugins::queue::Postgres *)context; + + gearmand_info("libpq replay start"); + + std::string query("SELECT unique_key,function_name,priority,data,when_to_run FROM " + queue->table); + + PGresult *result= PQexecParams(queue->con, query.c_str(), 0, NULL, NULL, NULL, NULL, 1); + if (result == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "PQexecParams:%s", PQerrorMessage(queue->con)); + PQclear(result); + return GEARMAN_QUEUE_ERROR; + } + + for (int row= 0; row < PQntuples(result); row++) + { + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "libpq replay: %.*s", + PQgetlength(result, row, 0), + PQgetvalue(result, row, 0)); + + size_t data_length; + char *data; + if (PQgetlength(result, row, 3) == 0) + { + data= NULL; + data_length= 0; + } + else + { + data_length= size_t(PQgetlength(result, row, 3)); + data= (char *)malloc(data_length); + if (not data) + { + PQclear(result); + return gearmand_perror("malloc"); + } + + memcpy(data, PQgetvalue(result, row, 3), data_length); + } + + gearmand_error_t ret; + ret= (*add_fn)(server, add_context, PQgetvalue(result, row, 0), + (size_t)PQgetlength(result, row, 0), + PQgetvalue(result, row, 1), + (size_t)PQgetlength(result, row, 1), + data, data_length, + (gearmand_job_priority_t)atoi(PQgetvalue(result, row, 2)), + atoll(PQgetvalue(result, row, 4))); + if (gearmand_failed(ret)) + { + PQclear(result); + return ret; + } + } + + PQclear(result); + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman-server/plugins/queue/postgres/queue.h gearmand-0.23/libgearman-server/plugins/queue/postgres/queue.h --- gearmand-0.14/libgearman-server/plugins/queue/postgres/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/postgres/queue.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +namespace gearmand { +namespace plugins { +namespace queue { + +void initialize_postgres(); + +} // namespace queue +} // namespace plugin +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/queue/sqlite/include.am gearmand-0.23/libgearman-server/plugins/queue/sqlite/include.am --- gearmand-0.14/libgearman-server/plugins/queue/sqlite/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/sqlite/include.am 2011-04-28 21:35:17.000000000 +0200 @@ -0,0 +1,20 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +if HAVE_LIBSQLITE3 +noinst_HEADERS+= libgearman-server/plugins/queue/sqlite/queue.h + +libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/sqlite/queue.cc + +libgearman_server_libgearman_server_la_LIBADD+= $(LTLIBSQLITE3) + +endif + diff -Nru gearmand-0.14/libgearman-server/plugins/queue/sqlite/queue.cc gearmand-0.23/libgearman-server/plugins/queue/sqlite/queue.cc --- gearmand-0.14/libgearman-server/plugins/queue/sqlite/queue.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/sqlite/queue.cc 2011-06-16 19:49:41.000000000 +0200 @@ -0,0 +1,698 @@ +/* Gearman server and library + * Copyright (C) 2009 Cory Bennett + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief libsqlite3 Queue Storage Definitions + */ + +#include + +#include +#include +#include + +/** + * @addtogroup gearman_queue_libsqlite3_static Static libsqlite3 Queue Storage Definitions + * @ingroup gearman_queue_libsqlite3 + * @{ + */ + +/** + * Default values. + */ +#define GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE "gearman_queue" +#define GEARMAN_QUEUE_QUERY_BUFFER 256 +#define SQLITE_MAX_TABLE_SIZE 256 +#define SQLITE_MAX_CREATE_TABLE_SIZE 1024 + +namespace gearmand { namespace plugins { namespace queue { class Sqlite; }}} + +static gearmand_error_t _initialize(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue); + +namespace gearmand { +namespace plugins { +namespace queue { + +class Sqlite : + public gearmand::plugins::Queue +{ +public: + Sqlite(); + ~Sqlite(); + + gearmand_error_t initialize(); + + std::string schema; + std::string table; + sqlite3 *db; + int in_trans; + + const std::string &insert_query() const + { + return _insert_query; + } + + const std::string &delete_query() const + { + return _delete_query; + } + + void set_epoch_support(bool arg) + { + _epoch_support= arg; + } + + bool epoch_support() + { + return _epoch_support; + } + +private: + std::string _insert_query; + std::string _delete_query; + bool _epoch_support; +}; + +Sqlite::Sqlite() : + Queue("libsqlite3"), + db(NULL), + in_trans(0), + _epoch_support(true) +{ + command_line_options().add_options() + ("libsqlite3-db", boost::program_options::value(&schema), "Database file to use.") + ("libsqlite3-table", boost::program_options::value(&table)->default_value(GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE), "Table to use.") + ; +} + +Sqlite::~Sqlite() +{ + if (db) + sqlite3_close(db); +} + +gearmand_error_t Sqlite::initialize() +{ + _delete_query+= "DELETE FROM "; + _delete_query+= table; + _delete_query+= " WHERE unique_key=? and function_name=?"; + + gearmand_error_t rc; + if (gearmand_failed(rc= _initialize(&Gearmand()->server, this))) + { + return rc; + } + + if (epoch_support()) + { + _insert_query+= "INSERT OR REPLACE INTO "; + _insert_query+= table; + _insert_query+= " (priority, unique_key, function_name, data, when_to_run) VALUES (?,?,?,?,?)"; + } + else + { + _insert_query+= "INSERT OR REPLACE INTO "; + _insert_query+= table; + _insert_query+= " (priority, unique_key, function_name, data) VALUES (?,?,?,?,?)"; + } + + return GEARMAN_SUCCESS; +} + +void initialize_sqlite() +{ + static Sqlite local_instance; +} + +} // namespace queue +} // namespace plugins +} // namespace gearmand + +/** + * Query error handling function. + */ +static int _sqlite_query(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue, + const char *query, size_t query_size, + sqlite3_stmt ** sth); +static int _sqlite_lock(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue); +static int _sqlite_commit(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue); +static int _sqlite_rollback(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue); + +/* Queue callback functions. */ +static gearmand_error_t _sqlite_add(gearman_server_st *server, void *context, + const char *unique, size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when); + +static gearmand_error_t _sqlite_flush(gearman_server_st *server, void *context); + +static gearmand_error_t _sqlite_done(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size); + +static gearmand_error_t _sqlite_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context); + +/** @} */ + +/* + * Public definitions + */ + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +gearmand_error_t _initialize(gearman_server_st *server, gearmand::plugins::queue::Sqlite *queue) +{ + gearmand_info("Initializing libsqlite3 module"); + + if (queue->schema.empty()) + { + return gearmand_gerror("missing required --libsqlite3-db= argument", GEARMAN_QUEUE_ERROR); + } + + + if (sqlite3_open(queue->schema.c_str(), &(queue->db)) != SQLITE_OK) + { + std::string error_string("sqlite3_open failed with: "); + error_string+= sqlite3_errmsg(queue->db); + return gearmand_gerror(error_string.c_str(), GEARMAN_QUEUE_ERROR); + } + + if (not queue->db) + { + return gearmand_gerror("Unknown error while opening up sqlite file", GEARMAN_QUEUE_ERROR); + } + + sqlite3_stmt* sth; + if (_sqlite_query(server, queue, STRING_WITH_LEN("SELECT name FROM sqlite_master WHERE type='table'"), &sth) != SQLITE_OK) + { + std::string error_string("Unknown error while calling SELECT on sqlite file "); + error_string+= queue->schema; + error_string+= " :"; + error_string+= sqlite3_errmsg(queue->db); + + return gearmand_gerror(error_string.c_str(), GEARMAN_QUEUE_ERROR); + } + + bool found= false; + while (sqlite3_step(sth) == SQLITE_ROW) + { + char *table= NULL; + + if (sqlite3_column_type(sth, 0) == SQLITE_TEXT) + { + table= (char*)sqlite3_column_text(sth, 0); + } + else + { + std::string error_string("Column `name` from sqlite_master is not type TEXT"); + sqlite3_finalize(sth); + return gearmand_gerror(error_string.c_str(), GEARMAN_QUEUE_ERROR); + } + + if (not queue->table.compare(table)) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "sqlite module using table '%s'", table); + found= true; + break; + } + } + + if (sqlite3_finalize(sth) != SQLITE_OK) + { + return gearmand_gerror(sqlite3_errmsg(queue->db), GEARMAN_QUEUE_ERROR); + } + + if (not found) + { + std::string query("CREATE TABLE "); + query+= queue->table; + query+= " ( unique_key TEXT, function_name TEXT, priority INTEGER, data BLOB, when_to_run INTEGER, PRIMARY KEY (unique_key, function_name))"; + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "sqlite module creating table '%s'", queue->table.c_str()); + + if (_sqlite_query(server, queue, query.c_str(), query.size(), &sth) != SQLITE_OK) + { + return gearmand_gerror(sqlite3_errmsg(queue->db), GEARMAN_QUEUE_ERROR); + } + + if (sqlite3_step(sth) != SQLITE_DONE) + { + gearmand_gerror(sqlite3_errmsg(queue->db), GEARMAN_QUEUE_ERROR); + sqlite3_finalize(sth); + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_finalize(sth) != SQLITE_OK) + { + return gearmand_gerror(sqlite3_errmsg(queue->db), GEARMAN_QUEUE_ERROR); + } + } + else + { + std::string query("SELECT when_to_run FROM "); + query+= queue->table; + + if (_sqlite_query(server, queue, query.c_str(), query.size(), &sth) != SQLITE_OK) + { + gearmand_info("No epoch support in sqlite queue"); + queue->set_epoch_support(false); + } + } + gearman_server_set_queue(server, queue, _sqlite_add, _sqlite_flush, _sqlite_done, _sqlite_replay); + + return GEARMAN_SUCCESS; +} + +/* + * Static definitions + */ + +int _sqlite_query(gearman_server_st *, + gearmand::plugins::queue::Sqlite *queue, + const char *query, size_t query_size, + sqlite3_stmt ** sth) +{ + if (query_size > UINT32_MAX) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "query size too big [%u]", (uint32_t)query_size); + return SQLITE_ERROR; + } + + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, "sqlite query: %s", query); + int ret= sqlite3_prepare(queue->db, query, (int)query_size, sth, NULL); + if (ret != SQLITE_OK) + { + if (*sth) + { + sqlite3_finalize(*sth); + } + *sth= NULL; + gearmand_log_error(AT, "sqlite_prepare:%s", sqlite3_errmsg(queue->db)); + } + + return ret; +} + +int _sqlite_lock(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue) +{ + if (queue->in_trans) + { + /* already in transaction */ + return SQLITE_OK; + } + + sqlite3_stmt* sth; + int ret= _sqlite_query(server, queue, STRING_WITH_LEN("BEGIN TRANSACTION"), &sth); + if (ret != SQLITE_OK) + { + gearmand_log_error(AT, "failed to begin transaction: %s", sqlite3_errmsg(queue->db)); + if (sth) + { + sqlite3_finalize(sth); + } + + return ret; + } + + ret= sqlite3_step(sth); + if (ret != SQLITE_DONE) + { + gearmand_log_error(AT, "lock error: %s", sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return ret; + } + + sqlite3_finalize(sth); + queue->in_trans++; + + return SQLITE_OK; +} + +int _sqlite_commit(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue) +{ + if (! queue->in_trans) + { + /* not in transaction */ + return SQLITE_OK; + } + + sqlite3_stmt* sth; + int ret= _sqlite_query(server, queue, STRING_WITH_LEN("COMMIT"), &sth); + if (ret != SQLITE_OK) + { + gearmand_log_error("_sqlite_commit", + "failed to commit transaction: %s", + sqlite3_errmsg(queue->db)); + if (sth) + { + sqlite3_finalize(sth); + } + + return ret; + } + + ret= sqlite3_step(sth); + if (ret != SQLITE_DONE) + { + gearmand_log_error("_sqlite_commit", "commit error: %s", sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return ret; + } + sqlite3_finalize(sth); + queue->in_trans= 0; + return SQLITE_OK; +} + +int _sqlite_rollback(gearman_server_st *server, + gearmand::plugins::queue::Sqlite *queue) +{ + if (! queue->in_trans) + { + /* not in transaction */ + return SQLITE_OK; + } + + sqlite3_stmt* sth; + int ret= _sqlite_query(server, queue, STRING_WITH_LEN("ROLLBACK"), &sth); + if (ret != SQLITE_OK) + { + gearmand_log_error("_sqlite_rollback", + "failed to rollback transaction: %s", + sqlite3_errmsg(queue->db)); + if (sth) + { + sqlite3_finalize(sth); + } + + return ret; + } + ret= sqlite3_step(sth); + if (ret != SQLITE_DONE) + { + gearmand_log_error("_sqlite_rollback", "rollback error: %s", + sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return ret; + } + sqlite3_finalize(sth); + queue->in_trans= 0; + + return SQLITE_OK; +} + +static gearmand_error_t _sqlite_add(gearman_server_st *server, void *context, + const char *unique, size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when) +{ + gearmand::plugins::queue::Sqlite *queue= (gearmand::plugins::queue::Sqlite *)context; + sqlite3_stmt* sth; + + if (when and not queue->epoch_support()) + { + return gearmand_gerror("Table lacks when_to_run field", GEARMAN_QUEUE_ERROR); + } + + if (unique_size > UINT32_MAX || function_name_size > UINT32_MAX || + data_size > UINT32_MAX) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "size too big [%u]", (uint32_t)unique_size); + return GEARMAN_QUEUE_ERROR; + } + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite add: %.*s at %ld", (uint32_t)unique_size, (char *)unique, (long int)when); + + if (_sqlite_lock(server, queue) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + if (_sqlite_query(server, queue, queue->insert_query().c_str(), queue->insert_query().size(), &sth) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + if (sqlite3_bind_int(sth, 1, priority) != SQLITE_OK) + { + _sqlite_rollback(server, queue); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "failed to bind int [%d]: %s", priority, sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_bind_text(sth, 2, (const char *)unique, (int)unique_size, + SQLITE_TRANSIENT) != SQLITE_OK) + { + _sqlite_rollback(server, queue); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "failed to bind text [%.*s]: %s", (uint32_t)unique_size, (char*)unique, sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_bind_text(sth, 3, (const char *)function_name, (int)function_name_size, + SQLITE_TRANSIENT) != SQLITE_OK) + { + _sqlite_rollback(server, queue); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "failed to bind text [%.*s]: %s", (uint32_t)function_name_size, (char*)function_name, sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_bind_blob(sth, 4, data, (int)data_size, + SQLITE_TRANSIENT) != SQLITE_OK) + { + _sqlite_rollback(server, queue); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "failed to bind blob: %s", sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return GEARMAN_QUEUE_ERROR; + } + + // epoch data + if (sqlite3_bind_int64(sth, 5, when) != SQLITE_OK) + { + _sqlite_rollback(server, queue); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "failed to bind int64_t(%ld): %s", (long int)when, sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_step(sth) != SQLITE_DONE) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "insert error: %s", sqlite3_errmsg(queue->db)); + if (sqlite3_finalize(sth) != SQLITE_OK ) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "finalize error: %s", sqlite3_errmsg(queue->db)); + } + + return GEARMAN_QUEUE_ERROR; + } + + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, + "sqlite data: priority: %d, unique_key: %s, function_name: %s", + priority, (char*)unique, (char*)function_name); + + sqlite3_finalize(sth); + + if (_sqlite_commit(server, queue) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _sqlite_flush(gearman_server_st *server, + void *context __attribute__((unused))) +{ + (void)server; + gearmand_debug("sqlite flush"); + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _sqlite_done(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name __attribute__((unused)), + size_t function_name_size __attribute__((unused))) +{ + gearmand::plugins::queue::Sqlite *queue= (gearmand::plugins::queue::Sqlite *)context; + sqlite3_stmt* sth; + + if (unique_size > UINT32_MAX) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "unique key size too big [%u]", (uint32_t)unique_size); + return GEARMAN_QUEUE_ERROR; + } + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite done: %.*s", (uint32_t)unique_size, (char *)unique); + + if (_sqlite_lock(server, queue) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + if (_sqlite_query(server, queue, queue->delete_query().c_str(), queue->delete_query().size(), &sth) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + sqlite3_bind_text(sth, 1, (const char *)unique, (int)unique_size, SQLITE_TRANSIENT); + sqlite3_bind_text(sth, 2, (const char *)function_name, (int)function_name_size, SQLITE_TRANSIENT); + + if (sqlite3_step(sth) != SQLITE_DONE) + { + gearmand_log_error("_sqlite_done", "delete error: %s", + sqlite3_errmsg(queue->db)); + sqlite3_finalize(sth); + return GEARMAN_QUEUE_ERROR; + } + + sqlite3_finalize(sth); + + if (_sqlite_commit(server, queue) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _sqlite_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context) +{ + gearmand::plugins::queue::Sqlite *queue= (gearmand::plugins::queue::Sqlite *)context; + + gearmand_info("sqlite replay start"); + + std::string query; + if (queue->epoch_support()) + { + query+= "SELECT unique_key,function_name,priority,data,when_to_run FROM "; + } + else + { + query+= "SELECT unique_key,function_name,priority,data FROM "; + } + query+= queue->table; + + sqlite3_stmt* sth; + if (_sqlite_query(server, queue, query.c_str(), query.size(), &sth) != SQLITE_OK) + return GEARMAN_QUEUE_ERROR; + + while (sqlite3_step(sth) == SQLITE_ROW) + { + const char *unique, *function_name; + void *data; + size_t unique_size, function_name_size, data_size; + + if (sqlite3_column_type(sth,0) == SQLITE_TEXT) + { + unique= (char *)sqlite3_column_text(sth,0); + unique_size= (size_t) sqlite3_column_bytes(sth,0); + } + else + { + sqlite3_finalize(sth); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "column %d is not type TEXT", 0); + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_column_type(sth,1) == SQLITE_TEXT) + { + function_name= (char *)sqlite3_column_text(sth,1); + function_name_size= (size_t)sqlite3_column_bytes(sth,1); + } + else + { + sqlite3_finalize(sth); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "column %d is not type TEXT", 1); + return GEARMAN_QUEUE_ERROR; + } + + gearmand_job_priority_t priority; + if (sqlite3_column_type(sth,2) == SQLITE_INTEGER) + { + priority= (gearmand_job_priority_t)sqlite3_column_int64(sth,2); + } + else + { + sqlite3_finalize(sth); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "column %d is not type INTEGER", 2); + return GEARMAN_QUEUE_ERROR; + } + + if (sqlite3_column_type(sth,3) == SQLITE_BLOB) + { + data_size= (size_t)sqlite3_column_bytes(sth,3); + /* need to make a copy here ... gearman_server_job_free will free it later */ + data= (void *)malloc(data_size); + if (data == NULL) + { + sqlite3_finalize(sth); + gearmand_perror("malloc"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + memcpy(data, sqlite3_column_blob(sth,3), data_size); + } + else + { + sqlite3_finalize(sth); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "column %d is not type TEXT", 3); + return GEARMAN_QUEUE_ERROR; + } + + int64_t when; + if (queue->epoch_support()) + { + if (sqlite3_column_type(sth, 4) == SQLITE_INTEGER) + { + when= (int64_t)sqlite3_column_int64(sth, 4); + } + else + { + sqlite3_finalize(sth); + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "column %d is not type INTEGER", 3); + return GEARMAN_QUEUE_ERROR; + } + } + else + { + when= 0; + } + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite replay: %s", (char*)function_name); + + gearmand_error_t gret= (*add_fn)(server, add_context, + unique, unique_size, + function_name, function_name_size, + data, data_size, + priority, when); + if (gearmand_failed(gret)) + { + sqlite3_finalize(sth); + return gret; + } + } + + sqlite3_finalize(sth); + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/libgearman-server/plugins/queue/sqlite/queue.h gearmand-0.23/libgearman-server/plugins/queue/sqlite/queue.h --- gearmand-0.14/libgearman-server/plugins/queue/sqlite/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/sqlite/queue.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +namespace gearmand { +namespace plugins { +namespace queue { + +void initialize_sqlite(); + +} // namespace queue +} // namespace plugin +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/queue/tokyocabinet/include.am gearmand-0.23/libgearman-server/plugins/queue/tokyocabinet/include.am --- gearmand-0.14/libgearman-server/plugins/queue/tokyocabinet/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/tokyocabinet/include.am 2011-04-28 21:35:10.000000000 +0200 @@ -0,0 +1,20 @@ +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +if HAVE_LIBTOKYOCABINET +noinst_HEADERS+= libgearman-server/plugins/queue/tokyocabinet/queue.h + +libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/tokyocabinet/queue.cc + +libgearman_server_libgearman_server_la_LIBADD+= $(LTLIBTOKYOCABINET) + +endif + diff -Nru gearmand-0.14/libgearman-server/plugins/queue/tokyocabinet/queue.cc gearmand-0.23/libgearman-server/plugins/queue/tokyocabinet/queue.cc --- gearmand-0.14/libgearman-server/plugins/queue/tokyocabinet/queue.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/tokyocabinet/queue.cc 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,409 @@ +/** + * @file + * @brief Tokyo Cabinet Queue Storage Definitions + */ + +#include +#include + +#include +#include + +#include +#include + +namespace gearmand { namespace plugins { namespace queue { class TokyoCabinet; }}} + +/** + * It is unclear from tokyocabinet's public headers what, if any, limit there is. 4k seems sane. + */ + +#define GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN 4096 +gearmand_error_t _initialize(gearman_server_st *server, + gearmand::plugins::queue::TokyoCabinet *queue); + +namespace gearmand { +namespace plugins { +namespace queue { + +class TokyoCabinet : public Queue { +public: + TokyoCabinet(); + ~TokyoCabinet(); + + gearmand_error_t initialize(); + + TCADB *db; + std::string filename; + bool optimize; +}; + +TokyoCabinet::TokyoCabinet() : + Queue("libtokyocabinet"), + db(NULL), + optimize(false) +{ + command_line_options().add_options() + ("libtokyocabinet-file", boost::program_options::value(&filename), "File name of the database. [see: man tcadb, tcadbopen() for name guidelines]") + ("libtokyocabinet-optimize", boost::program_options::bool_switch(&optimize)->default_value(true), "Optimize database on open. [default=true]"); + + db= tcadbnew(); +} + +TokyoCabinet::~TokyoCabinet() +{ + tcadbdel(db); +} + +gearmand_error_t TokyoCabinet::initialize() +{ + return _initialize(&Gearmand()->server, this); +} + +void initialize_tokyocabinet() +{ + static TokyoCabinet local_instance; +} + +} // namespace queue +} // namespace plugins +} // namespace gearmand + + +/** + * @addtogroup gearman_queue_libtokyocabinet libtokyocabinet Queue Storage Functions + * @ingroup gearman_queue + * @{ + */ + +/* + * Private declarations + */ + +/* Queue callback functions. */ +static gearmand_error_t _libtokyocabinet_add(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when); + +static gearmand_error_t _libtokyocabinet_flush(gearman_server_st *server, void *context); + +static gearmand_error_t _libtokyocabinet_done(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size); + +static gearmand_error_t _libtokyocabinet_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context); + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +/** + * Missing function from tcadb.c ?? + */ +static const char * _libtokyocabinet_tcaerrmsg(TCADB *db) +{ + switch (tcadbomode(db)) + { + case ADBOHDB: + return tcerrmsg(tchdbecode((TCHDB *)tcadbreveal(db))); + case ADBOBDB: + return tcerrmsg(tcbdbecode((TCBDB *)tcadbreveal(db))); + default: + return tcerrmsg(TCEMISC); + } +} + +gearmand_error_t _initialize(gearman_server_st *server, + gearmand::plugins::queue::TokyoCabinet *queue) +{ + gearmand_info("Initializing libtokyocabinet module"); + + if ((queue->db= tcadbnew()) == NULL) + { + gearmand_error("tcadbnew"); + return GEARMAN_QUEUE_ERROR; + } + + if (queue->filename.empty()) + { + gearmand_error("No --file given"); + return GEARMAN_QUEUE_ERROR; + } + + if (not tcadbopen(queue->db, queue->filename.c_str())) + { + tcadbdel(queue->db); + + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, + "tcadbopen(%s): %s", queue->filename.c_str(), _libtokyocabinet_tcaerrmsg(queue->db)); + + return GEARMAN_QUEUE_ERROR; + } + + if (queue->optimize) + { + gearmand_info("libtokyocabinet optimizing database file"); + if (not tcadboptimize(queue->db, NULL)) + { + tcadbdel(queue->db); + return gearmand_gerror("tcadboptimize", GEARMAN_QUEUE_ERROR); + } + } + + gearman_server_set_queue(server, queue, _libtokyocabinet_add, _libtokyocabinet_flush, _libtokyocabinet_done, _libtokyocabinet_replay); + + return GEARMAN_SUCCESS; +} + +/* + * Private definitions + */ + +static gearmand_error_t _libtokyocabinet_add(gearman_server_st *server, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when) +{ + (void)server; + gearmand::plugins::queue::TokyoCabinet *queue= (gearmand::plugins::queue::TokyoCabinet *)context; + TCXSTR *key; + TCXSTR *job_data; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet add: %.*s at %lld", (uint32_t)unique_size, (char *)unique, (long long int)when); + + char key_str[GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN]; + size_t key_length= (size_t)snprintf(key_str, GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN, "%.*s-%.*s", + (int)function_name_size, + (const char *)function_name, (int)unique_size, + (const char *)unique); + + key= tcxstrnew(); + tcxstrcat(key, key_str, (int)key_length); + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet key: %.*s", (int)key_length, key_str); + + job_data= tcxstrnew(); + + tcxstrcat(job_data, (const char *)function_name, (int)function_name_size); + tcxstrcat(job_data, "\0", 1); + tcxstrcat(job_data, (const char *)unique, (int)unique_size); + tcxstrcat(job_data, "\0", 1); + + switch (priority) + { + case GEARMAND_JOB_PRIORITY_HIGH: + case GEARMAND_JOB_PRIORITY_MAX: + tcxstrcat2(job_data, "0"); + break; + case GEARMAND_JOB_PRIORITY_LOW: + tcxstrcat2(job_data, "2"); + break; + case GEARMAND_JOB_PRIORITY_NORMAL: + default: + tcxstrcat2(job_data, "1"); + } + + // get int64_t as string + char timestr[32]; + snprintf(timestr, sizeof(timestr), "%lld", (long long int)when); + + // append to job_data + tcxstrcat(job_data, (const char *)timestr, (int)strlen(timestr)); + tcxstrcat(job_data, "\0", 1); + + // add the rest... + tcxstrcat(job_data, (const char *)data, (int)data_size); + + bool rc= tcadbput(queue->db, tcxstrptr(key), tcxstrsize(key), + tcxstrptr(job_data), tcxstrsize(job_data)); + + tcxstrdel(key); + tcxstrdel(job_data); + + if (rc) // Success + return GEARMAN_SUCCESS; + + return GEARMAN_QUEUE_ERROR; +} + +static gearmand_error_t _libtokyocabinet_flush(gearman_server_st *, void *context) +{ + gearmand::plugins::queue::TokyoCabinet *queue= (gearmand::plugins::queue::TokyoCabinet *)context; + + gearmand_debug("libtokyocabinet flush"); + + if (not tcadbsync(queue->db)) + return GEARMAN_QUEUE_ERROR; + + return GEARMAN_SUCCESS; +} + +static gearmand_error_t _libtokyocabinet_done(gearman_server_st *, void *context, + const char *unique, + size_t unique_size, + const char *function_name, + size_t function_name_size) +{ + gearmand::plugins::queue::TokyoCabinet *queue= (gearmand::plugins::queue::TokyoCabinet *)context; + TCXSTR *key; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet add: %.*s", (uint32_t)unique_size, (char *)unique); + + char key_str[GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN]; + size_t key_length= (size_t)snprintf(key_str, GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN, "%.*s-%.*s", + (int)function_name_size, + (const char *)function_name, (int)unique_size, + (const char *)unique); + + key= tcxstrnew(); + tcxstrcat(key, key_str, (int)key_length); + bool rc= tcadbout(queue->db, tcxstrptr(key), tcxstrsize(key)); + tcxstrdel(key); + + if (rc) + return GEARMAN_SUCCESS; + + return GEARMAN_QUEUE_ERROR; +} + +static gearmand_error_t _callback_for_record(gearman_server_st *server, + TCXSTR *key, TCXSTR *data, + gearman_queue_add_fn *add_fn, + void *add_context) +{ + char *data_cstr; + size_t data_cstr_size; + const char *function; + size_t function_len; + char *unique; + size_t unique_len; + gearmand_job_priority_t priority; + gearmand_error_t gret; + int64_t when; + + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "replaying: %s", (char *) tcxstrptr(key)); + + data_cstr= (char *)tcxstrptr(data); + data_cstr_size= (size_t)tcxstrsize(data); + + function= data_cstr; + function_len= strlen(function); + + unique= data_cstr+function_len+1; + unique_len= strlen(unique); // strlen is only safe because tcxstrptr guarantees nul term + + // +2 for nulls + data_cstr += unique_len+function_len+2; + data_cstr_size -= unique_len+function_len+2; + + assert(unique); + assert(unique_len); + assert(function); + assert(function_len); + + // single char for priority + if (*data_cstr == '2') + priority = GEARMAND_JOB_PRIORITY_LOW; + else if (*data_cstr == '0') + priority = GEARMAND_JOB_PRIORITY_HIGH; + else + priority = GEARMAND_JOB_PRIORITY_NORMAL; + + ++data_cstr; + --data_cstr_size; + + // out ptr for strtoul + char *new_data_cstr= NULL; + + // parse time from record + when= (int64_t)strtoul(data_cstr, &new_data_cstr, 10); + + // decrease opaque data size by the length of the numbers read by strtoul + data_cstr_size -= (new_data_cstr - data_cstr) + 1; + + // move data pointer to end of timestamp + 1 (null) + data_cstr= new_data_cstr + 1; + + // data is freed later so we must make a copy + void *data_ptr= (void *)malloc(data_cstr_size); + if (data_ptr == NULL) + { + return GEARMAN_QUEUE_ERROR; + } + memcpy(data_ptr, data_cstr, data_cstr_size); + + gret = (*add_fn)(server, add_context, unique, unique_len, + function, function_len, + data_ptr, data_cstr_size, + priority, when); + + if (gret != GEARMAN_SUCCESS) + { + return gret; + } + return GEARMAN_SUCCESS; +} + + +static gearmand_error_t _libtokyocabinet_replay(gearman_server_st *server, void *context, + gearman_queue_add_fn *add_fn, + void *add_context) +{ + gearmand::plugins::queue::TokyoCabinet *queue= (gearmand::plugins::queue::TokyoCabinet *)context; + TCXSTR *key; + TCXSTR *data; + void *iter= NULL; + int iter_size= 0; + gearmand_error_t gret; + gearmand_error_t tmp_gret; + + gearmand_info("libtokyocabinet replay start"); + + if (!tcadbiterinit(queue->db)) + { + return GEARMAN_QUEUE_ERROR; + } + key= tcxstrnew(); + data= tcxstrnew(); + gret= GEARMAN_SUCCESS; + uint64_t x= 0; + while ((iter= tcadbiternext(queue->db, &iter_size))) + { + tcxstrclear(key); + tcxstrclear(data); + tcxstrcat(key, iter, iter_size); + free(iter); + iter= tcadbget(queue->db, tcxstrptr(key), tcxstrsize(key), &iter_size); + if (not iter) + { + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet replay key disappeared: %s", (char *)tcxstrptr(key)); + continue; + } + tcxstrcat(data, iter, iter_size); + free(iter); + tmp_gret= _callback_for_record(server, key, data, add_fn, add_context); + if (tmp_gret != GEARMAN_SUCCESS) + { + gret= GEARMAN_QUEUE_ERROR; + break; + } + ++x; + } + tcxstrdel(key); + tcxstrdel(data); + + gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet replayed %ld records", x); + + return gret; +} diff -Nru gearmand-0.14/libgearman-server/plugins/queue/tokyocabinet/queue.h gearmand-0.23/libgearman-server/plugins/queue/tokyocabinet/queue.h --- gearmand-0.14/libgearman-server/plugins/queue/tokyocabinet/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue/tokyocabinet/queue.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +namespace gearmand { +namespace plugins { +namespace queue { + +void initialize_tokyocabinet(); + +} // namespace queue +} // namespace plugin +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins/queue.h gearmand-0.23/libgearman-server/plugins/queue.h --- gearmand-0.14/libgearman-server/plugins/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins/queue.h 2011-03-15 23:57:33.000000000 +0100 @@ -0,0 +1,58 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef HAVE_LIBDRIZZLE +#include +#endif + +#ifdef HAVE_LIBMEMCACHED +#include +#endif + +#ifdef HAVE_LIBSQLITE3 +#include +#endif + +#ifdef HAVE_LIBPQ +#include +#endif + +#ifdef HAVE_LIBTOKYOCABINET +#include +#endif diff -Nru gearmand-0.14/libgearman-server/plugins.cc gearmand-0.23/libgearman-server/plugins.cc --- gearmand-0.14/libgearman-server/plugins.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins.cc 2011-06-11 00:15:38.000000000 +0200 @@ -0,0 +1,75 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +#include + +#include +#include + +namespace gearmand { +namespace plugins { + +void initialize(boost::program_options::options_description &all) +{ +#ifdef HAVE_LIBDRIZZLE + queue::initialize_drizzle(); +#endif + +#ifdef HAVE_LIBMEMCACHED + queue::initialize_libmemcached(); +#endif + +#ifdef HAVE_LIBSQLITE3 + queue::initialize_sqlite(); +#endif + +#ifdef HAVE_LIBPQ + queue::initialize_postgres(); +#endif + +#ifdef HAVE_LIBTOKYOCABINET + queue::initialize_tokyocabinet(); +#endif + + gearmand::queue::load_options(all); +} + +} //namespace plugins +} //namespace gearmand diff -Nru gearmand-0.14/libgearman-server/plugins.h gearmand-0.23/libgearman-server/plugins.h --- gearmand-0.14/libgearman-server/plugins.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/plugins.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,50 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +namespace boost { namespace program_options { class options_description; } } + +#include + +namespace gearmand { +namespace plugins { + +void initialize(boost::program_options::options_description &all); + +} //namespace plugins +} //namespace gearmand diff -Nru gearmand-0.14/libgearman-server/port.h gearmand-0.23/libgearman-server/port.h --- gearmand-0.14/libgearman-server/port.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/port.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,48 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +struct gearmand_port_st +{ + char port[NI_MAXSERV]; + uint32_t listen_count; + gearmand_connection_add_fn *add_fn; + int *listen_fd; + struct event *listen_event; +}; + diff -Nru gearmand-0.14/libgearman-server/protocol_http.c gearmand-0.23/libgearman-server/protocol_http.c --- gearmand-0.14/libgearman-server/protocol_http.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/protocol_http.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,390 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief HTTP Protocol Definitions - */ - -#include "common.h" -#include "gearmand.h" - -#include - -/** - * @addtogroup gearman_protocol_http_static Static HTTP Protocol Definitions - * @ingroup gearman_protocol_http - * @{ - */ - -/** - * Default values. - */ -#define GEARMAN_PROTOCOL_HTTP_DEFAULT_PORT 8080 - -/** - * Structure for HTTP specific data. - */ -typedef struct -{ - bool background; - bool keep_alive; -} gearman_protocol_http_st; - -/* Protocol callback functions. */ -static gearman_return_t _http_con_add(gearman_connection_st *connection); -static void _http_free(gearman_connection_st *connection, void *context); -static size_t _http_pack(const gearman_packet_st *packet, gearman_connection_st *connection, - void *data, size_t data_size, - gearman_return_t *ret_ptr); -static size_t _http_unpack(gearman_packet_st *packet, gearman_connection_st *connection, - const void *data, size_t data_size, - gearman_return_t *ret_ptr); - -/* Line parsing helper function. */ -static const char *_http_line(const void *data, size_t data_size, - size_t *line_size, size_t *offset); - -/** @} */ - -/* - * Public definitions - */ - -gearman_return_t gearmand_protocol_http_conf(gearman_conf_st *conf) -{ - gearman_conf_module_st *module; - - module= gearman_conf_module_create(conf, NULL, "http"); - if (module == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - - gearman_conf_module_add_option(module, "port", 0, "PORT", - "Port to listen on."); - - return gearman_conf_return(conf); -} - -gearman_return_t gearmand_protocol_http_init(gearmand_st *gearmand, - gearman_conf_st *conf) -{ - in_port_t port= GEARMAN_PROTOCOL_HTTP_DEFAULT_PORT; - gearman_conf_module_st *module; - const char *name; - const char *value; - - gearmand_log_info(gearmand, "Initializing http module"); - - /* Get module and parse the option values that were given. */ - module= gearman_conf_module_find(conf, "http"); - if (module == NULL) - { - gearmand_log_fatal(gearmand, "gearman_protocol_http_init:gearman_conf_module_find:NULL"); - return GEARMAN_QUEUE_ERROR; - } - - while (gearman_conf_module_value(module, &name, &value)) - { - if (!strcmp(name, "port")) - port= (in_port_t)atoi(value); - else - { - gearmand_protocol_http_deinit(gearmand); - gearmand_log_fatal(gearmand, "gearman_protocol_http_init:Unknown argument: %s", name); - return GEARMAN_QUEUE_ERROR; - } - } - - return gearmand_port_add(gearmand, port, _http_con_add); -} - -gearman_return_t gearmand_protocol_http_deinit(gearmand_st *gearmand __attribute__ ((unused))) -{ - return GEARMAN_SUCCESS; -} - -/* - * Static definitions - */ - -static gearman_return_t _http_con_add(gearman_connection_st *connection) -{ - gearman_protocol_http_st *http; - - http= (gearman_protocol_http_st *)malloc(sizeof(gearman_protocol_http_st)); - if (http == NULL) - { - gearman_log_error(connection->universal, "_http_con_add", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - http->background= false; - http->keep_alive= false; - - gearman_connection_set_protocol_context(connection, http); - gearman_connection_set_protocol_context_free_fn(connection, _http_free); - gearman_connection_set_packet_pack_fn(connection, _http_pack); - gearman_connection_set_packet_unpack_fn(connection, _http_unpack); - - return GEARMAN_SUCCESS; -} - -static void _http_free(gearman_connection_st *connection __attribute__ ((unused)), - void *context) -{ - free((gearman_protocol_http_st *)context); -} - -static size_t _http_pack(const gearman_packet_st *packet, gearman_connection_st *connection, - void *data, size_t data_size, - gearman_return_t *ret_ptr) -{ - size_t pack_size; - gearman_protocol_http_st *http; - - http= (gearman_protocol_http_st *)gearman_connection_protocol_context(connection); - - if (packet->command != GEARMAN_COMMAND_WORK_COMPLETE && - packet->command != GEARMAN_COMMAND_WORK_FAIL && - (http->background == false || - packet->command != GEARMAN_COMMAND_JOB_CREATED)) - { - *ret_ptr= GEARMAN_IGNORE_PACKET; - return 0; - } - - pack_size= (size_t)snprintf((char *)data, data_size, - "HTTP/1.0 200 OK\r\n" - "X-Gearman-Job-Handle: %.*s\r\n" - "Content-Length: %"PRIu64"\r\n" - "Server: Gearman/" PACKAGE_VERSION "\r\n" - "\r\n", - packet->command == GEARMAN_COMMAND_JOB_CREATED ? - (uint32_t)packet->arg_size[0] : - (uint32_t)packet->arg_size[0] - 1, - packet->arg[0], - (uint64_t)packet->data_size); - - if (pack_size > data_size) - { - *ret_ptr= GEARMAN_FLUSH_DATA; - return 0; - } - - if (! (http->keep_alive)) - { - gearman_connection_set_option(connection, GEARMAN_CON_CLOSE_AFTER_FLUSH, true); - } - - *ret_ptr= GEARMAN_SUCCESS; - return pack_size; -} - -static size_t _http_unpack(gearman_packet_st *packet, gearman_connection_st *connection, - const void *data, size_t data_size, - gearman_return_t *ret_ptr) -{ - gearman_protocol_http_st *http; - size_t offset= 0; - const char *request; - size_t request_size; - const char *method; - ptrdiff_t method_size; - const char *uri; - ptrdiff_t uri_size; - const char *version; - size_t version_size; - const char *header; - size_t header_size; - char content_length[11]; /* 11 bytes to fit max display length of uint32_t */ - const char *unique= "-"; - size_t unique_size= 2; - gearman_job_priority_t priority= GEARMAN_JOB_PRIORITY_NORMAL; - - /* Get the request line first. */ - request= _http_line(data, data_size, &request_size, &offset); - if (request == NULL || request_size == 0) - { - *ret_ptr= GEARMAN_IO_WAIT; - return offset; - } - - http= (gearman_protocol_http_st *)gearman_connection_protocol_context(connection); - http->background= false; - http->keep_alive= false; - - /* Parse out the method, URI, and HTTP version from the request line. */ - method= request; - uri= memchr(request, ' ', request_size); - if (uri == NULL) - { - gearman_log_error(packet->universal, "_http_unpack", "bad request line: %.*s", (uint32_t)request_size, request); - *ret_ptr= GEARMAN_INVALID_PACKET; - return 0; - } - - method_size= uri - request; - if ((method_size != 3 || - (strncasecmp(method, "GET", 3) && strncasecmp(method, "PUT", 3))) && - (method_size != 4 || strncasecmp(method, "POST", 4))) - { - gearman_log_error(packet->universal, "_http_unpack", "bad method: %.*s", (uint32_t)method_size, method); - *ret_ptr= GEARMAN_INVALID_PACKET; - return 0; - } - - while (*uri == ' ') - uri++; - - while (*uri == '/') - uri++; - - version= memchr(uri, ' ', request_size - (size_t)(uri - request)); - if (version == NULL) - { - gearman_log_error(packet->universal, "_http_unpack", "bad request line: %.*s", - (uint32_t)request_size, request); - *ret_ptr= GEARMAN_INVALID_PACKET; - return 0; - } - - uri_size= version - uri; - if (uri_size == 0) - { - gearman_log_error(packet->universal, "_http_unpack", - "must give function name in URI"); - *ret_ptr= GEARMAN_INVALID_PACKET; - return 0; - } - - while (*version == ' ') - version++; - - version_size= request_size - (size_t)(version - request); - - if (version_size == 8 && !strncasecmp(version, "HTTP/1.1", 8)) - http->keep_alive= true; - else if (version_size != 8 || strncasecmp(version, "HTTP/1.0", 8)) - { - gearman_log_error(packet->universal, "_http_unpack", "bad version: %.*s", - (uint32_t)version_size, version); - *ret_ptr= GEARMAN_INVALID_PACKET; - return 0; - } - - /* Loop through all the headers looking for ones of interest. */ - while ((header= _http_line(data, data_size, &header_size, &offset)) != NULL) - { - if (header_size == 0) - break; - - if (header_size > 16 && !strncasecmp(header, "Content-Length: ", 16)) - { - if ((method_size == 4 && !strncasecmp(method, "POST", 4)) || - (method_size == 3 && !strncasecmp(method, "PUT", 3))) - { - snprintf(content_length, 11, "%.*s", (uint32_t)header_size - 16, - header + 16); - packet->data_size= (size_t)atoi(content_length); - } - } - else if (header_size == 22 && - !strncasecmp(header, "Connection: Keep-Alive", 22)) - { - http->keep_alive= true; - } - else if (header_size > 18 && !strncasecmp(header, "X-Gearman-Unique: ", 18)) - { - unique= header + 18; - unique_size= header_size - 18; - } - else if (header_size == 26 && - !strncasecmp(header, "X-Gearman-Background: true", 26)) - { - http->background= true; - } - else if (header_size == 24 && - !strncasecmp(header, "X-Gearman-Priority: high", 24)) - { - priority= GEARMAN_JOB_PRIORITY_HIGH; - } - else if (header_size == 23 && - !strncasecmp(header, "X-Gearman-Priority: low", 23)) - { - priority= GEARMAN_JOB_PRIORITY_LOW; - } - } - - /* Make sure we received the end of headers. */ - if (header == NULL) - { - *ret_ptr= GEARMAN_IO_WAIT; - return 0; - } - - /* Request and all headers complete, build a packet based on HTTP request. */ - packet->magic= GEARMAN_MAGIC_REQUEST; - - if (http->background) - { - if (priority == GEARMAN_JOB_PRIORITY_NORMAL) - packet->command= GEARMAN_COMMAND_SUBMIT_JOB_BG; - else if (priority == GEARMAN_JOB_PRIORITY_HIGH) - packet->command= GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG; - else - packet->command= GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG; - } - else - { - if (priority == GEARMAN_JOB_PRIORITY_NORMAL) - packet->command= GEARMAN_COMMAND_SUBMIT_JOB; - else if (priority == GEARMAN_JOB_PRIORITY_HIGH) - packet->command= GEARMAN_COMMAND_SUBMIT_JOB_HIGH; - else - packet->command= GEARMAN_COMMAND_SUBMIT_JOB_LOW; - } - - *ret_ptr= gearman_packet_pack_header(packet); - if (*ret_ptr != GEARMAN_SUCCESS) - return 0; - - *ret_ptr= gearman_packet_create_arg(packet, uri, (size_t)uri_size + 1); - if (*ret_ptr != GEARMAN_SUCCESS) - return 0; - - *ret_ptr= gearman_packet_create_arg(packet, unique, unique_size + 1); - if (*ret_ptr != GEARMAN_SUCCESS) - return 0; - - /* Make sure function and unique are NULL terminated. */ - packet->arg[0][uri_size]= 0; - packet->arg[1][unique_size]= 0; - - *ret_ptr= GEARMAN_SUCCESS; - return offset; -} - -static const char *_http_line(const void *data, size_t data_size, - size_t *line_size, size_t *offset) -{ - const char *start= (const char *)data + *offset; - const char *end; - - end= memchr(start, '\n', data_size - *offset); - if (end == NULL) - return NULL; - - *offset+= (size_t)(end - start) + 1; - - if (end != start && *(end - 1) == '\r') - end--; - - *line_size= (size_t)(end - start); - - return start; -} diff -Nru gearmand-0.14/libgearman-server/protocol_http.h gearmand-0.23/libgearman-server/protocol_http.h --- gearmand-0.14/libgearman-server/protocol_http.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/protocol_http.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,68 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief HTTP Protocol Declarations - */ - -#ifndef __GEARMAN_PROTOCOL_HTTP_H__ -#define __GEARMAN_PROTOCOL_HTTP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_protocol_http HTTP Protocol Declarations - * @ingroup gearman_server_protocol - * - * This module provides a simple HTTP interface into the Gearman job server. It - * is also meant to serve as an example of how other protocols can plug into - * the server. This module will ignore all headers except: - * - * Content-Length: SIZE - * Connection: Keep-Alive - * X-Gearman-Unique: UNIQUE_KEY - * X-Gearman-Background: true - * X-Gearman-Priority: HIGH | LOW - * - * All HTTP requests are translated into SUBMIT_JOB requests, and only - * WORK_COMPLETE, WORK_FAIL, and JOB_CREATED responses are returned. - * JOB_CREATED packet are only sent back if the "X-Gearman-Background: true" - * header is given. - * - * @{ - */ - -/** - * Get module configuration options. - */ -GEARMAN_API -gearman_return_t gearmand_protocol_http_conf(gearman_conf_st *conf); - -/** - * Initialize the HTTP protocol module. - */ -GEARMAN_API -gearman_return_t gearmand_protocol_http_init(gearmand_st *gearmand, - gearman_conf_st *conf); - -/** - * De-initialize the HTTP protocol module. - */ -GEARMAN_API -gearman_return_t gearmand_protocol_http_deinit(gearmand_st *gearmand); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_PROTOCOL_HTTP_H__ */ diff -Nru gearmand-0.14/libgearman-server/queue.cc gearmand-0.23/libgearman-server/queue.cc --- gearmand-0.14/libgearman-server/queue.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/queue.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,112 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include + +#include + +#include +#include +#include + + +namespace gearmand { + +namespace queue { + +plugins::Queue::vector all_queue_modules; + +void add(plugins::Queue* arg) +{ + all_queue_modules.push_back(arg); +} + +void load_options(boost::program_options::options_description &all) +{ + for (plugins::Queue::vector::iterator iter= all_queue_modules.begin(); + iter != all_queue_modules.end(); + iter++) + { + all.add((*iter)->command_line_options()); + } +} + +gearmand_error_t initialize(gearmand_st *, const std::string &name) +{ + bool launched= false; + + if (name.empty()) + return GEARMAN_SUCCESS; + + for (plugins::Queue::vector::iterator iter= all_queue_modules.begin(); + iter != all_queue_modules.end(); + iter++) + { + if (not name.compare((*iter)->name())) + { + if (launched) + { + return gearmand_gerror("Attempt to initialize multiple queues", GEARMAN_UNKNOWN_OPTION); + } + + gearmand_error_t rc; + if (gearmand_failed(rc= (*iter)->initialize())) + { + std::string error_string("Failed to initialize "); + error_string+= name; + + return gearmand_gerror(error_string.c_str(), rc); + } + + launched= true; + } + } + + if (not launched) + { + std::string error_string("Unknown queue "); + error_string+= name; + return gearmand_gerror(error_string.c_str(), GEARMAN_UNKNOWN_OPTION); + } + + return GEARMAN_SUCCESS; +} + +} // namespace queue +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/queue.h gearmand-0.23/libgearman-server/queue.h --- gearmand-0.14/libgearman-server/queue.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/queue.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,57 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +struct gearmand_st; + +namespace boost { namespace program_options { class options_description; } } + +namespace gearmand { + +namespace plugins { class Queue; } + +namespace queue { + +void add(plugins::Queue* queue); +void load_options(boost::program_options::options_description &all); +gearmand_error_t initialize(gearmand_st *gearmand, const std::string &name); + +} // namespace queue +} // namespace gearmand diff -Nru gearmand-0.14/libgearman-server/queue_libdrizzle.c gearmand-0.23/libgearman-server/queue_libdrizzle.c --- gearmand-0.14/libgearman-server/queue_libdrizzle.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libdrizzle.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,519 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libdrizzle Queue Storage Definitions - */ - -#include "common.h" - -#include -#include - -/** - * @addtogroup gearman_queue_libdrizzle_static Static libdrizzle Queue Storage Definitions - * @ingroup gearman_queue_libdrizzle - * @{ - */ - -/** - * Default values. - */ -#define GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_DATABASE "test" -#define GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_TABLE "queue" -#define GEARMAN_QUEUE_QUERY_BUFFER 256 - -/** - * Structure for libdrizzle specific data. - */ -typedef struct -{ - drizzle_st drizzle; - drizzle_con_st con; - drizzle_result_st result; - char table[DRIZZLE_MAX_TABLE_SIZE]; - char *query; - size_t query_size; -} gearman_queue_libdrizzle_st; - -/** - * Query error handling function. - */ -static drizzle_return_t _libdrizzle_query(gearman_server_st *server, - gearman_queue_libdrizzle_st *queue, - const char *query, size_t query_size); - -/* Queue callback functions. */ -static gearman_return_t _libdrizzle_add(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority); -static gearman_return_t _libdrizzle_flush(gearman_server_st *gearman, - void *context); -static gearman_return_t _libdrizzle_done(gearman_server_st *gearman, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size); -static gearman_return_t _libdrizzle_replay(gearman_server_st *gearman, - void *context, - gearman_queue_add_fn *add_fn, - void *add_context); - -/** @} */ - -/* - * Public definitions - */ - -gearman_return_t gearman_server_queue_libdrizzle_conf(gearman_conf_st *conf) -{ - gearman_conf_module_st *module; - - module= gearman_conf_module_create(conf, NULL, "libdrizzle"); - if (module == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - -#define MCO(__name, __value, __help) \ - gearman_conf_module_add_option(module, __name, 0, __value, __help); - - MCO("host", "HOST", "Host of server.") - MCO("port", "PORT", "Port of server.") - MCO("uds", "UDS", "Unix domain socket for server.") - MCO("user", "USER", "User name for authentication.") - MCO("password", "PASSWORD", "Password for authentication.") - MCO("db", "DB", "Database to use.") - MCO("table", "TABLE", "Table to use.") - MCO("mysql", NULL, "Use MySQL protocol.") - - return gearman_conf_return(conf); -} - -gearman_return_t gearman_server_queue_libdrizzle_init(gearman_server_st *server, - gearman_conf_st *conf) -{ - gearman_queue_libdrizzle_st *queue; - gearman_conf_module_st *module; - const char *name; - const char *value; - const char *host= NULL; - in_port_t port= 0; - const char *uds= NULL; - const char *user= NULL; - const char *password= NULL; - drizzle_row_t row; - char create[1024]; - - gearman_log_info(server->gearman, "Initializing libdrizzle module"); - - queue= (gearman_queue_libdrizzle_st *)malloc(sizeof(gearman_queue_libdrizzle_st)); - if (queue == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libdrizzle_init", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - memset(queue, 0, sizeof(gearman_queue_libdrizzle_st)); - snprintf(queue->table, DRIZZLE_MAX_TABLE_SIZE, - GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_TABLE); - - if (drizzle_create(&(queue->drizzle)) == NULL) - { - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libdrizzle_init", "drizzle_create"); - return GEARMAN_QUEUE_ERROR; - } - - if (drizzle_con_create(&(queue->drizzle), &(queue->con)) == NULL) - { - drizzle_free(&(queue->drizzle)); - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libdrizzle_init", "drizzle_con_create"); - return GEARMAN_QUEUE_ERROR; - } - - gearman_server_set_queue_context(server, queue); - - drizzle_con_set_db(&(queue->con), GEARMAN_QUEUE_LIBDRIZZLE_DEFAULT_DATABASE); - - /* Get module and parse the option values that were given. */ - module= gearman_conf_module_find(conf, "libdrizzle"); - if (module == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libdrizzle_init", "gearman_conf_module_find:NULL"); - return GEARMAN_QUEUE_ERROR; - } - - while (gearman_conf_module_value(module, &name, &value)) - { - if (!strcmp(name, "host")) - host= value; - else if (!strcmp(name, "port")) - port= (in_port_t)atoi(value); - else if (!strcmp(name, "uds")) - uds= value; - else if (!strcmp(name, "user")) - user= value; - else if (!strcmp(name, "password")) - password= value; - else if (!strcmp(name, "db")) - drizzle_con_set_db(&(queue->con), value); - else if (!strcmp(name, "table")) - snprintf(queue->table, DRIZZLE_MAX_TABLE_SIZE, "%s", value); - else if (!strcmp(name, "mysql")) - drizzle_con_set_options(&(queue->con), DRIZZLE_CON_MYSQL); - else - { - gearman_server_queue_libdrizzle_deinit(server); - gearman_log_error(server->gearman, "gearman_queue_libdrizzle_init", "Unknown argument: %s", name); - return GEARMAN_QUEUE_ERROR; - } - } - - if (uds == NULL) - drizzle_con_set_tcp(&(queue->con), host, port); - else - drizzle_con_set_uds(&(queue->con), uds); - - drizzle_con_set_auth(&(queue->con), user, password); - - /* Overwrite password string so it does not appear in 'ps' output. */ - if (password != NULL) - memset((void *)password, 'x', strlen(password)); - - if (_libdrizzle_query(server, queue, "SHOW TABLES", 11) != DRIZZLE_RETURN_OK) - { - gearman_server_queue_libdrizzle_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - if (drizzle_result_buffer(&(queue->result)) != DRIZZLE_RETURN_OK) - { - drizzle_result_free(&(queue->result)); - gearman_server_queue_libdrizzle_deinit(server); - gearman_log_error(server->gearman, "gearman_queue_libdrizzle_init", "drizzle_result_buffer:%s", drizzle_error(&(queue->drizzle))); - return GEARMAN_QUEUE_ERROR; - } - - while ((row= drizzle_row_next(&(queue->result))) != NULL) - { - if (!strcasecmp(queue->table, row[0])) - { - gearman_log_info(server->gearman, "libdrizzle module using table '%s.%s'", drizzle_con_db(&queue->con), row[0]); - - break; - } - } - - drizzle_result_free(&(queue->result)); - - if (row == NULL) - { - snprintf(create, 1024, - "CREATE TABLE %s" - "(" - "unique_key VARCHAR(%d) PRIMARY KEY," - "function_name VARCHAR(255)," - "priority INT," - "data LONGBLOB" - ")", - queue->table, GEARMAN_UNIQUE_SIZE); - - gearman_log_info(server->gearman, "libdrizzle module creating table '%s.%s'", - drizzle_con_db(&queue->con), queue->table); - - if (_libdrizzle_query(server, queue, create, strlen(create)) - != DRIZZLE_RETURN_OK) - { - gearman_server_queue_libdrizzle_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - drizzle_result_free(&(queue->result)); - } - - gearman_server_set_queue_add_fn(server, _libdrizzle_add); - gearman_server_set_queue_flush_fn(server, _libdrizzle_flush); - gearman_server_set_queue_done_fn(server, _libdrizzle_done); - gearman_server_set_queue_replay_fn(server, _libdrizzle_replay); - - return GEARMAN_SUCCESS; -} - -gearman_return_t -gearman_server_queue_libdrizzle_deinit(gearman_server_st *server) -{ - gearman_queue_libdrizzle_st *queue; - - gearman_log_info(server->gearman, "Shutting down libdrizzle queue module"); - - queue= (gearman_queue_libdrizzle_st *)gearman_server_queue_context(server); - gearman_server_set_queue_context(server, NULL); - drizzle_con_free(&(queue->con)); - drizzle_free(&(queue->drizzle)); - if (queue->query != NULL) - free(queue->query); - free(queue); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearmand_queue_libdrizzle_init(gearmand_st *gearmand, - gearman_conf_st *conf) -{ - return gearman_server_queue_libdrizzle_init(&(gearmand->server), conf); -} - -gearman_return_t gearmand_queue_libdrizzle_deinit(gearmand_st *gearmand) -{ - return gearman_server_queue_libdrizzle_deinit(&(gearmand->server)); -} - -/* - * Static definitions - */ - -static drizzle_return_t _libdrizzle_query(gearman_server_st *server, - gearman_queue_libdrizzle_st *queue, - const char *query, size_t query_size) -{ - drizzle_return_t ret; - - gearman_log_crazy(server->gearman, "libdrizzle query: %.*s", (uint32_t)query_size, query); - - (void)drizzle_query(&(queue->con), &(queue->result), query, query_size, &ret); - if (ret != DRIZZLE_RETURN_OK) - { - /* If we lost the connection, try one more time before exiting. */ - if (ret == DRIZZLE_RETURN_LOST_CONNECTION) - { - (void)drizzle_query(&(queue->con), &(queue->result), query, query_size, - &ret); - } - - if (ret != DRIZZLE_RETURN_OK) - { - gearman_log_error(server->gearman, "_libdrizzle_query", "drizzle_query:%s", - drizzle_error(&(queue->drizzle))); - return ret; - } - } - - return DRIZZLE_RETURN_OK; -} - -static gearman_return_t _libdrizzle_add(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority) -{ - gearman_queue_libdrizzle_st *queue= (gearman_queue_libdrizzle_st *)context; - char *query; - size_t query_size; - - gearman_log_debug(server->gearman, "libdrizzle add: %.*s", (uint32_t)unique_size, (char *)unique); - - /* This is not used currently, it will be once batch writes are supported - inside of the Gearman job server. */ -#if 0 - if (!not started) - { - if (_query(drizzle, "BEGIN", 5) != DRIZZLE_RETURN_OK) - return REPQ_RETURN_EXTERNAL; - - drizzle_result_free(&(drizzle->result)); - } -#endif - - query_size= ((unique_size + function_name_size + data_size) * 2) + - GEARMAN_QUEUE_QUERY_BUFFER; - if (query_size > queue->query_size) - { - query= (char *)realloc(queue->query, query_size); - if (query == NULL) - { - gearman_log_error(server->gearman, "_libdrizzle_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= query_size; - } - else - { - query= queue->query; - } - - query_size= (size_t)snprintf(query, query_size, - "INSERT INTO %s SET priority=%u,unique_key='", - queue->table, (uint32_t)priority); - - query_size+= (size_t)drizzle_escape_string(query + query_size, unique, - unique_size); - memcpy(query + query_size, "',function_name='", 17); - query_size+= 17; - - query_size+= (size_t)drizzle_escape_string(query + query_size, function_name, - function_name_size); - memcpy(query + query_size, "',data='", 8); - query_size+= 8; - - query_size+= (size_t)drizzle_escape_string(query + query_size, data, - data_size); - memcpy(query + query_size, "'", 1); - query_size+= 1; - - if (_libdrizzle_query(server, queue, query, query_size) != DRIZZLE_RETURN_OK) - return GEARMAN_QUEUE_ERROR; - - drizzle_result_free(&(queue->result)); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libdrizzle_flush(gearman_server_st *server, - void *context __attribute__((unused))) -{ - gearman_log_debug(server->gearman, "libdrizzle flush"); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libdrizzle_done(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name __attribute__((unused)), - size_t function_name_size __attribute__((unused))) -{ - gearman_queue_libdrizzle_st *queue= (gearman_queue_libdrizzle_st *)context; - char *query; - size_t query_size; - - gearman_log_debug(server->gearman, "libdrizzle done: %.*s", (uint32_t)unique_size, (char *)unique); - - query_size= (unique_size * 2) + GEARMAN_QUEUE_QUERY_BUFFER; - if (query_size > queue->query_size) - { - query= (char *)realloc(queue->query, query_size); - if (query == NULL) - { - gearman_log_error(server->gearman, "_libdrizzle_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= query_size; - } - else - query= queue->query; - - query_size= (size_t)snprintf(query, query_size, - "DELETE FROM %s WHERE unique_key='", - queue->table); - - query_size+= (size_t)drizzle_escape_string(query + query_size, unique, - unique_size); - memcpy(query + query_size, "'", 1); - query_size+= 1; - - if (_libdrizzle_query(server, queue, query, query_size) != DRIZZLE_RETURN_OK) - return GEARMAN_QUEUE_ERROR; - - drizzle_result_free(&(queue->result)); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libdrizzle_replay(gearman_server_st *server, - void *context, - gearman_queue_add_fn *add_fn, - void *add_context) -{ - gearman_queue_libdrizzle_st *queue= (gearman_queue_libdrizzle_st *)context; - char *query; - size_t query_size; - drizzle_return_t ret; - drizzle_row_t row; - size_t *field_sizes; - gearman_return_t gret; - - gearman_log_info(server->gearman, "libdrizzle replay start"); - - if (GEARMAN_QUEUE_QUERY_BUFFER > queue->query_size) - { - query= (char *)realloc(queue->query, GEARMAN_QUEUE_QUERY_BUFFER); - if (query == NULL) - { - gearman_log_error(server->gearman, "_libdrizzle_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= GEARMAN_QUEUE_QUERY_BUFFER; - } - else - query= queue->query; - - query_size= (size_t)snprintf(query, GEARMAN_QUEUE_QUERY_BUFFER, - "SELECT unique_key,function_name,priority,data " - "FROM %s", - queue->table); - - if (_libdrizzle_query(server, queue, query, query_size) != DRIZZLE_RETURN_OK) - return GEARMAN_QUEUE_ERROR; - - if (drizzle_column_skip(&(queue->result)) != DRIZZLE_RETURN_OK) - { - drizzle_result_free(&(queue->result)); - gearman_log_error(server->gearman, "_libdrizzle_replay", "drizzle_column_skip:%s", drizzle_error(&(queue->drizzle))); - - return GEARMAN_QUEUE_ERROR; - } - - while (1) - { - row= drizzle_row_buffer(&(queue->result), &ret); - if (ret != DRIZZLE_RETURN_OK) - { - drizzle_result_free(&(queue->result)); - gearman_log_error(server->gearman, "_libdrizzle_replay", "drizzle_row_buffer:%s", drizzle_error(&(queue->drizzle))); - - return GEARMAN_QUEUE_ERROR; - } - - if (row == NULL) - break; - - field_sizes= drizzle_row_field_sizes(&(queue->result)); - - gearman_log_debug(server->gearman, "libdrizzle replay: %.*s", (uint32_t)field_sizes[0], row[1]); - - gret= (*add_fn)(server, add_context, row[0], field_sizes[0], row[1], - field_sizes[1], row[3], field_sizes[3], atoi(row[2])); - if (gret != GEARMAN_SUCCESS) - { - drizzle_row_free(&(queue->result), row); - drizzle_result_free(&(queue->result)); - return gret; - } - - row[3]= NULL; - drizzle_row_free(&(queue->result), row); - } - - drizzle_result_free(&(queue->result)); - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman-server/queue_libdrizzle.h gearmand-0.23/libgearman-server/queue_libdrizzle.h --- gearmand-0.14/libgearman-server/queue_libdrizzle.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libdrizzle.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,66 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libdrizzle Queue Storage Declarations - */ - -#ifndef __GEARMAN_SERVER_QUEUE_LIBDRIZZLE_H__ -#define __GEARMAN_SERVER_QUEUE_LIBDRIZZLE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_queue_libdrizzle libdrizzle Queue Storage Declarations - * @ingroup gearman_server_queue - * @{ - */ - -/** - * Get module configuration options. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libdrizzle_conf(gearman_conf_st *conf); - -/** - * Initialize the queue. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libdrizzle_init(gearman_server_st *server, - gearman_conf_st *conf); - -/** - * De-initialize the queue. - */ -GEARMAN_API -gearman_return_t -gearman_server_queue_libdrizzle_deinit(gearman_server_st *server); - -/** - * Initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libdrizzle_init(gearmand_st *gearmand, - gearman_conf_st *conf); - -/** - * De-initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libdrizzle_deinit(gearmand_st *gearmand); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_SERVER_QUEUE_LIBDRIZZLE_H__ */ diff -Nru gearmand-0.14/libgearman-server/queue_libmemcached.c gearmand-0.23/libgearman-server/queue_libmemcached.c --- gearmand-0.14/libgearman-server/queue_libmemcached.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libmemcached.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,350 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libmemcached Queue Storage Definitions - */ - -#include "common.h" - -#include -#include - -/** - * @addtogroup gearman_queue_libmemcached_static Static libmemcached Queue Storage Functions - * @ingroup gearman_queue_libmemcached - * @{ - */ - -/** - * Default values. - */ -#define GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX "gear_" - -/** - * Structure for libmemcached specific data. - */ -typedef struct -{ - memcached_st memc; -} gearman_queue_libmemcached_st; - -/* Queue callback functions. */ -static gearman_return_t _libmemcached_add(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority); -static gearman_return_t _libmemcached_flush(gearman_server_st *server, - void *context); -static gearman_return_t _libmemcached_done(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size); -static gearman_return_t _libmemcached_replay(gearman_server_st *server, - void *context, - gearman_queue_add_fn *add_fn, - void *add_context); - -/** @} */ - -/* - * Public definitions - */ - -gearman_return_t gearman_server_queue_libmemcached_conf(gearman_conf_st *conf) -{ - gearman_conf_module_st *module; - - module= gearman_conf_module_create(conf, NULL, "libmemcached"); - if (module == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - - gearman_conf_module_add_option(module, "servers", 0, "SERVER_LIST", - "List of Memcached servers to use."); - return gearman_conf_return(conf); -} - -gearman_return_t -gearman_server_queue_libmemcached_init(gearman_server_st *server, - gearman_conf_st *conf) -{ - gearman_queue_libmemcached_st *queue; - gearman_conf_module_st *module; - const char *name; - const char *value; - memcached_server_st *servers; - const char *opt_servers= NULL; - - gearman_log_info(server->gearman, "Initializing libmemcached module"); - - queue= calloc(1, sizeof(gearman_queue_libmemcached_st)); - if (queue == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libmemcached_init", "malloc"); - - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - if (memcached_create(&(queue->memc)) == NULL) - { - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libmemcached_init", "memcached_create"); - return GEARMAN_QUEUE_ERROR; - } - - /* Get module and parse the option values that were given. */ - module= gearman_conf_module_find(conf, "libmemcached"); - if (module == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libmemcached_init", "gearman_conf_module_find:NULL"); - - return GEARMAN_QUEUE_ERROR; - } - - while (gearman_conf_module_value(module, &name, &value)) - { - if (!strcmp(name, "servers")) - opt_servers= value; - else - { - memcached_free(&(queue->memc)); - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libmemcached_init", "Unknown argument: %s", name); - return GEARMAN_QUEUE_ERROR; - } - } - - if (opt_servers == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libmemcached_init", "No --servers given"); - return GEARMAN_QUEUE_ERROR; - } - - servers= memcached_servers_parse(opt_servers); - - if (servers == NULL) - { - memcached_free(&(queue->memc)); - free(queue); - - gearman_log_error(server->gearman, "gearman_queue_libmemcached_init", "memcached_servers_parse"); - - return GEARMAN_QUEUE_ERROR; - } - - memcached_server_push(&queue->memc, servers); - memcached_server_list_free(servers); - - gearman_server_set_queue_context(server, queue); - - gearman_server_set_queue_add_fn(server, _libmemcached_add); - gearman_server_set_queue_flush_fn(server, _libmemcached_flush); - gearman_server_set_queue_done_fn(server, _libmemcached_done); - gearman_server_set_queue_replay_fn(server, _libmemcached_replay); - - return GEARMAN_SUCCESS; -} - -gearman_return_t -gearman_server_queue_libmemcached_deinit(gearman_server_st *server) -{ - gearman_queue_libmemcached_st *queue; - - gearman_log_info(server->gearman, "Shutting down libmemcached queue module"); - - queue= (gearman_queue_libmemcached_st *)gearman_server_queue_context(server); - gearman_server_set_queue_context(server, NULL); - memcached_free(&(queue->memc)); - - free(queue); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearmand_queue_libmemcached_init(gearmand_st *gearmand, - gearman_conf_st *conf) -{ - return gearman_server_queue_libmemcached_init(&(gearmand->server), conf); -} - -gearman_return_t gearmand_queue_libmemcached_deinit(gearmand_st *gearmand) -{ - return gearman_server_queue_libmemcached_deinit(&(gearmand->server)); -} - -/* - * Static definitions - */ - -static gearman_return_t _libmemcached_add(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority) -{ - gearman_queue_libmemcached_st *queue= (gearman_queue_libmemcached_st *)context; - memcached_return rc; - char key[MEMCACHED_MAX_KEY]; - size_t key_length; - - gearman_log_debug(server->gearman, "libmemcached add: %.*s", (uint32_t)unique_size, (char *)unique); - - key_length= (size_t)snprintf(key, MEMCACHED_MAX_KEY, "%s%.*s-%.*s", - GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX, - (int)function_name_size, - (const char *)function_name, (int)unique_size, - (const char *)unique); - - rc= memcached_set(&queue->memc, (const char *)key, key_length, - (const char *)data, data_size, 0, (uint32_t)priority); - - if (rc != MEMCACHED_SUCCESS) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libmemcached_flush(gearman_server_st *server, - void *context __attribute__((unused))) -{ - gearman_log_debug(server->gearman, "libmemcached flush"); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libmemcached_done(gearman_server_st *server, - void *context, const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size) -{ - size_t key_length; - char key[MEMCACHED_MAX_KEY]; - memcached_return rc; - gearman_queue_libmemcached_st *queue= (gearman_queue_libmemcached_st *)context; - - gearman_log_debug(server->gearman, "libmemcached done: %.*s", (uint32_t)unique_size, (char *)unique); - - key_length= (size_t)snprintf(key, MEMCACHED_MAX_KEY, "%s%.*s-%.*s", - GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX, - (int)function_name_size, - (const char *)function_name, (int)unique_size, - (const char *)unique); - - /* For the moment we will assume it happened */ - rc= memcached_delete(&queue->memc, (const char *)key, key_length, 0); - - if (rc != MEMCACHED_SUCCESS) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -struct replay_context -{ - memcached_st clone; - gearman_server_st *server; - gearman_queue_add_fn *add_fn; - void *add_context; -}; - -static memcached_return callback_loader(const memcached_st *ptr __attribute__((unused)), - memcached_result_st *result __attribute__((unused)), - void *context) -{ - struct replay_context *container= (struct replay_context *)context; - const char *key; - const char *unique; - char *function; - size_t unique_len; - - key= memcached_result_key_value(result); - - if (strcmp(key, GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX)) - return MEMCACHED_SUCCESS; - - unique= key + strlen(GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX); - - function= index(unique, '-'); - unique_len= (size_t)(function - unique); - function++; - - assert(unique); - assert(unique_len); - assert(function); - assert(strlen(function)); - /* Currently not looking at failure cases */ - (void)(*container->add_fn)(container->server, container->add_context, - unique, unique_len, - function, strlen(function), - memcached_result_value(result), memcached_result_length(result), - memcached_result_flags(result)); - - - return MEMCACHED_SUCCESS; -} - -/* Grab the object and load it into the loader */ -static memcached_return callback_for_key(const memcached_st *ptr __attribute__((unused)), - const char *key, size_t key_length, - void *context) -{ - memcached_return rc; - struct replay_context *container= (struct replay_context *)context; - memcached_execute_function callbacks[1]; - char *passable[1]; - - callbacks[0]= (memcached_execute_fn)&callback_loader; - - passable[0]= (char *)key; - rc= memcached_mget(&container->clone, (void *)passable, &key_length, 1); - - /* Just void errors for the moment, since other treads might have picked up the object. */ - (void)memcached_fetch_execute(&container->clone, callbacks, context, 1); - - return MEMCACHED_SUCCESS; -} - -/* - If we have any failures for loading values back into replay we just ignore them. -*/ -static gearman_return_t _libmemcached_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context) -{ - gearman_queue_libmemcached_st *queue= (gearman_queue_libmemcached_st *)context; - struct replay_context container; - memcached_st *check_for_failure; - memcached_dump_func callbacks[1]; - - callbacks[0]= (memcached_dump_fn)&callback_for_key; - - gearman_log_info(server->gearman, "libmemcached replay start"); - - memset(&container, 0, sizeof(struct replay_context)); - check_for_failure= memcached_clone(&container.clone, &queue->memc); - container.server= server; - container.add_fn= add_fn; - container.add_context= add_context; - - assert(check_for_failure); - - - (void)memcached_dump(&queue->memc, callbacks, (void *)&container, 1); - - memcached_free(&container.clone); - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman-server/queue_libmemcached.h gearmand-0.23/libgearman-server/queue_libmemcached.h --- gearmand-0.14/libgearman-server/queue_libmemcached.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libmemcached.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,67 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libmemcached Queue Storage Declarations - */ - -#ifndef __GEARMAN_SERVER_QUEUE_LIBMEMCACHED_H__ -#define __GEARMAN_SERVER_QUEUE_LIBMEMCACHED_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_queue_libmemcached libmemcached Queue Storage Declarations - * @ingroup gearman_server_queue - * @{ - */ - -/** - * Get module configuration options. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libmemcached_conf(gearman_conf_st *conf); - -/** - * Initialize the queue. - */ -GEARMAN_API -gearman_return_t -gearman_server_queue_libmemcached_init(gearman_server_st *server, - gearman_conf_st *conf); - -/** - * De-initialize the queue. - */ -GEARMAN_API -gearman_return_t -gearman_server_queue_libmemcached_deinit(gearman_server_st *server); - -/** - * Initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libmemcached_init(gearmand_st *gearmand, - gearman_conf_st *conf); - -/** - * De-initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libmemcached_deinit(gearmand_st *gearmand); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_SERVER_QUEUE_LIBMEMCACHED_H__ */ diff -Nru gearmand-0.14/libgearman-server/queue_libpq.c gearmand-0.23/libgearman-server/queue_libpq.c --- gearmand-0.14/libgearman-server/queue_libpq.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libpq.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,453 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libpq Queue Storage Definitions - */ - -#include "common.h" - -#include - -#if defined(HAVE_LIBPQ_FE_H) -# include -# include -#else -# include -# include -#endif - -/** - * @addtogroup gearman_queue_libpq_static Static libpq Queue Storage Definitions - * @ingroup gearman_queue_libpq - * @{ - */ - -/** - * Default values. - */ -#define GEARMAN_QUEUE_LIBPQ_DEFAULT_TABLE "queue" -#define GEARMAN_QUEUE_QUERY_BUFFER 256 - -/** - * Structure for libpq specific data. - */ -typedef struct -{ - PGconn *con; - char table[NAMEDATALEN]; - char *query; - size_t query_size; -} gearman_queue_libpq_st; - -/** - * PostgreSQL notification callback. - */ -static void _libpq_notice_processor(void *arg, const char *message); - -/* Queue callback functions. */ -static gearman_return_t _libpq_add(gearman_server_st *server, void *context, - const void *unique, size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority); -static gearman_return_t _libpq_flush(gearman_server_st *server, void *context); -static gearman_return_t _libpq_done(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size); -static gearman_return_t _libpq_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context); - -/** @} */ - -/* - * Public definitions - */ - -gearman_return_t gearman_server_queue_libpq_conf(gearman_conf_st *conf) -{ - gearman_conf_module_st *module; - - module= gearman_conf_module_create(conf, NULL, "libpq"); - if (module == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - -#define MCO(__name, __value, __help) \ - gearman_conf_module_add_option(module, __name, 0, __value, __help); - - MCO("conninfo", "STRING", "PostgreSQL connection information string.") - MCO("table", "TABLE", "Table to use.") - - return gearman_conf_return(conf); -} - -gearman_return_t gearman_server_queue_libpq_init(gearman_server_st *server, - gearman_conf_st *conf) -{ - gearman_queue_libpq_st *queue; - gearman_conf_module_st *module; - const char *name; - const char *value; - const char *conninfo= ""; - char create[1024]; - PGresult *result; - - gearman_log_info(server->gearman, "Initializing libpq module"); - - queue= (gearman_queue_libpq_st *)malloc(sizeof(gearman_queue_libpq_st)); - if (queue == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libpq_init", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - memset(queue, 0, sizeof(gearman_queue_libpq_st)); - snprintf(queue->table, NAMEDATALEN, GEARMAN_QUEUE_LIBPQ_DEFAULT_TABLE); - - gearman_server_set_queue_context(server, queue); - - /* Get module and parse the option values that were given. */ - module= gearman_conf_module_find(conf, "libpq"); - if (module == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libpq_init", "gearman_conf_module_find:NULL"); - return GEARMAN_QUEUE_ERROR; - } - - while (gearman_conf_module_value(module, &name, &value)) - { - if (!strcmp(name, "conninfo")) - conninfo= value; - else if (!strcmp(name, "table")) - snprintf(queue->table, NAMEDATALEN, "%s", value); - else - { - gearman_server_queue_libpq_deinit(server); - gearman_log_error(server->gearman, "gearman_queue_libpq_init", "Unknown argument: %s", name); - return GEARMAN_QUEUE_ERROR; - } - } - - queue->con= PQconnectdb(conninfo); - - if (queue->con == NULL || PQstatus(queue->con) != CONNECTION_OK) - { - gearman_log_error(server->gearman, "gearman_queue_libpq_init", - "PQconnectdb: %s", PQerrorMessage(queue->con)); - gearman_server_queue_libpq_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - (void)PQsetNoticeProcessor(queue->con, _libpq_notice_processor, server); - - snprintf(create, 1024, "SELECT tablename FROM pg_tables WHERE tablename='%s'", - queue->table); - - result= PQexec(queue->con, create); - if (result == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) - { - gearman_log_error(server->gearman, "gearman_queue_libpq_init", "PQexec:%s", - PQerrorMessage(queue->con)); - PQclear(result); - gearman_server_queue_libpq_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - if (PQntuples(result) == 0) - { - PQclear(result); - - snprintf(create, 1024, - "CREATE TABLE %s" - "(" - "unique_key VARCHAR(%d) PRIMARY KEY," - "function_name VARCHAR(255)," - "priority INTEGER," - "data BYTEA" - ")", - queue->table, GEARMAN_UNIQUE_SIZE); - - gearman_log_info(server->gearman, "libpq module creating table '%s'", queue->table); - - result= PQexec(queue->con, create); - if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK) - { - gearman_log_error(server->gearman, "gearman_queue_libpq_init", "PQexec:%s", - PQerrorMessage(queue->con)); - PQclear(result); - gearman_server_queue_libpq_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - PQclear(result); - } - else - PQclear(result); - - gearman_server_set_queue_add_fn(server, _libpq_add); - gearman_server_set_queue_flush_fn(server, _libpq_flush); - gearman_server_set_queue_done_fn(server, _libpq_done); - gearman_server_set_queue_replay_fn(server, _libpq_replay); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_server_queue_libpq_deinit(gearman_server_st *server) -{ - gearman_queue_libpq_st *queue; - - gearman_log_info(server->gearman, "Shutting down libpq queue module"); - - queue= (gearman_queue_libpq_st *)gearman_server_queue_context(server); - gearman_server_set_queue_context(server, NULL); - - if (queue->con != NULL) - PQfinish(queue->con); - - if (queue->query != NULL) - free(queue->query); - - free(queue); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearmand_queue_libpq_init(gearmand_st *gearmand, - gearman_conf_st *conf) -{ - return gearman_server_queue_libpq_init(&(gearmand->server), conf); -} - -gearman_return_t gearmand_queue_libpq_deinit(gearmand_st *gearmand) -{ - return gearman_server_queue_libpq_deinit(&(gearmand->server)); -} - -/* - * Static definitions - */ - -static void _libpq_notice_processor(void *arg, const char *message) -{ - gearman_server_st *server= (gearman_server_st *)arg; - gearman_log_info(server->gearman, "PostgreSQL %s", message); -} - -static gearman_return_t _libpq_add(gearman_server_st *server, void *context, - const void *unique, size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority) -{ - gearman_queue_libpq_st *queue= (gearman_queue_libpq_st *)context; - char *query; - size_t query_size; - PGresult *result; - - const char *param_values[3]= { (char *)unique, - (char *)function_name, - (char *)data }; - int param_lengths[3]= { (int)unique_size, - (int)function_name_size, - (int)data_size }; - int param_formats[3]= { 0, 0, 1 }; - - gearman_log_debug(server->gearman, "libpq add: %.*s", (uint32_t)unique_size, (char *)unique); - - /* This is not used currently, it will be once batch writes are supported - inside of the Gearman job server. */ -#if 0 - if (!not started) - { - if (_query(pq, "BEGIN", 5) != PQ_RETURN_OK) - return REPQ_RETURN_EXTERNAL; - - pq_result_free(&(pq->result)); - } -#endif - - query_size= GEARMAN_QUEUE_QUERY_BUFFER; - if (query_size > queue->query_size) - { - query= (char *)realloc(queue->query, query_size); - if (query == NULL) - { - gearman_log_error(server->gearman, "_libpq_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= query_size; - } - else - query= queue->query; - - (void)snprintf(query, query_size, - "INSERT INTO %s (priority,unique_key,function_name,data) " - "VALUES(%u,$1,$2,$3)", queue->table, (uint32_t)priority); - result= PQexecParams(queue->con, query, 3, NULL, param_values, param_lengths, - param_formats, 0); - if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK) - { - gearman_log_error(server->gearman, "_libpq_command", "PQexec:%s", PQerrorMessage(queue->con)); - PQclear(result); - return GEARMAN_QUEUE_ERROR; - } - - PQclear(result); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libpq_flush(gearman_server_st *server, - void *context __attribute__((unused))) -{ - gearman_log_debug(server->gearman, "libpq flush"); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libpq_done(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name __attribute__((unused)), - size_t function_name_size __attribute__((unused))) -{ - gearman_queue_libpq_st *queue= (gearman_queue_libpq_st *)context; - char *query; - size_t query_size; - PGresult *result; - - gearman_log_debug(server->gearman, "libpq done: %.*s", (uint32_t)unique_size, (char *)unique); - - query_size= (unique_size * 2) + GEARMAN_QUEUE_QUERY_BUFFER; - if (query_size > queue->query_size) - { - query= (char *)realloc(queue->query, query_size); - if (query == NULL) - { - gearman_log_error(server->gearman, "_libpq_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= query_size; - } - else - query= queue->query; - - query_size= (size_t)snprintf(query, query_size, - "DELETE FROM %s WHERE unique_key='", - queue->table); - - query_size+= PQescapeStringConn(queue->con, query + query_size, unique, - unique_size, NULL); - memcpy(query + query_size, "'", 1); - query_size+= 1; - query[query_size]= 0; - - result= PQexec(queue->con, query); - if (result == NULL || PQresultStatus(result) != PGRES_COMMAND_OK) - { - gearman_log_error(server->gearman, "_libpq_add", "PQexec:%s", PQerrorMessage(queue->con)); - PQclear(result); - return GEARMAN_QUEUE_ERROR; - } - - PQclear(result); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libpq_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context) -{ - gearman_queue_libpq_st *queue= (gearman_queue_libpq_st *)context; - char *query; - gearman_return_t ret; - PGresult *result; - int row; - void *data; - - gearman_log_info(server->gearman, "libpq replay start"); - - if (GEARMAN_QUEUE_QUERY_BUFFER > queue->query_size) - { - query= (char *)realloc(queue->query, GEARMAN_QUEUE_QUERY_BUFFER); - if (query == NULL) - { - gearman_log_error(server->gearman, "_libpq_replay", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= GEARMAN_QUEUE_QUERY_BUFFER; - } - else - query= queue->query; - - (void)snprintf(query, GEARMAN_QUEUE_QUERY_BUFFER, - "SELECT unique_key,function_name,priority,data FROM %s", - queue->table); - - result= PQexecParams(queue->con, query, 0, NULL, NULL, NULL, NULL, 1); - if (result == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) - { - gearman_log_error(server->gearman, "_libpq_replay", "PQexecParams:%s", PQerrorMessage(queue->con)); - PQclear(result); - return GEARMAN_QUEUE_ERROR; - } - - for (row= 0; row < PQntuples(result); row++) - { - gearman_log_debug(server->gearman, "libpq replay: %.*s", - PQgetlength(result, row, 0), - PQgetvalue(result, row, 0)); - - if (PQgetlength(result, row, 3) == 0) - { - data= NULL; - } - else - { - data= (void *)malloc((size_t)PQgetlength(result, row, 3)); - if (query == NULL) - { - PQclear(result); - gearman_log_error(server->gearman, "_libpq_replay", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - memcpy(data, PQgetvalue(result, row, 3), - (size_t)PQgetlength(result, row, 3)); - } - - ret= (*add_fn)(server, add_context, PQgetvalue(result, row, 0), - (size_t)PQgetlength(result, row, 0), - PQgetvalue(result, row, 1), - (size_t)PQgetlength(result, row, 1), - data, (size_t)PQgetlength(result, row, 3), - atoi(PQgetvalue(result, row, 2))); - if (ret != GEARMAN_SUCCESS) - { - PQclear(result); - return ret; - } - } - - PQclear(result); - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman-server/queue_libpq.h gearmand-0.23/libgearman-server/queue_libpq.h --- gearmand-0.14/libgearman-server/queue_libpq.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libpq.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libpq Queue Storage Declarations - */ - -#ifndef __GEARMAN_SERVER_QUEUE_LIBPQ_H__ -#define __GEARMAN_SERVER_QUEUE_LIBPQ_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_queue_libpq libpq Queue Storage Declarations - * @ingroup gearman_server_queue - * @{ - */ - -/** - * Get module configuration options. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libpq_conf(gearman_conf_st *conf); - -/** - * Initialize the queue. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libpq_init(gearman_server_st *server, - gearman_conf_st *conf); - -/** - * De-initialize the queue. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libpq_deinit(gearman_server_st *server); - -/** - * Initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libpq_init(gearmand_st *gearmand, - gearman_conf_st *conf); - -/** - * De-initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libpq_deinit(gearmand_st *gearmand); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_SERVER_QUEUE_LIBPQ_H__ */ diff -Nru gearmand-0.14/libgearman-server/queue_libsqlite3.c gearmand-0.23/libgearman-server/queue_libsqlite3.c --- gearmand-0.14/libgearman-server/queue_libsqlite3.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libsqlite3.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,744 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2009 Cory Bennett - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libsqlite3 Queue Storage Definitions - */ - -#include "common.h" - -#include -#include - -/** - * @addtogroup gearman_queue_libsqlite3_static Static libsqlite3 Queue Storage Definitions - * @ingroup gearman_queue_libsqlite3 - * @{ - */ - -/** - * Default values. - */ -#define GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE "gearman_queue" -#define GEARMAN_QUEUE_QUERY_BUFFER 256 -#define SQLITE_MAX_TABLE_SIZE 256 -#define SQLITE_MAX_CREATE_TABLE_SIZE 1024 - -/** - * Structure for sqlite specific data. - */ -typedef struct -{ - sqlite3* db; - char table[SQLITE_MAX_TABLE_SIZE]; - char *query; - size_t query_size; - int in_trans; -} gearman_queue_sqlite_st; - -/** - * Query error handling function. - */ -static int _sqlite_query(gearman_server_st *server, - gearman_queue_sqlite_st *queue, - const char *query, size_t query_size, - sqlite3_stmt ** sth); -static int _sqlite_lock(gearman_server_st *server, - gearman_queue_sqlite_st *queue); -static int _sqlite_commit(gearman_server_st *server, - gearman_queue_sqlite_st *queue); -static int _sqlite_rollback(gearman_server_st *server, - gearman_queue_sqlite_st *queue); - -/* Queue callback functions. */ -static gearman_return_t _sqlite_add(gearman_server_st *server, void *context, - const void *unique, size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority); -static gearman_return_t _sqlite_flush(gearman_server_st *server, void *context); -static gearman_return_t _sqlite_done(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size); -static gearman_return_t _sqlite_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context); - -/** @} */ - -/* - * Public definitions - */ - -gearman_return_t gearman_server_queue_libsqlite3_conf(gearman_conf_st *conf) -{ - gearman_conf_module_st *module; - - module= gearman_conf_module_create(conf, NULL, "libsqlite3"); - if (module == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - -#define MCO(__name, __value, __help) \ - gearman_conf_module_add_option(module, __name, 0, __value, __help); - - MCO("db", "DB", "Database file to use.") - MCO("table", "TABLE", "Table to use.") - - return gearman_conf_return(conf); -} - -gearman_return_t gearman_server_queue_libsqlite3_init(gearman_server_st *server, - gearman_conf_st *conf) -{ - gearman_queue_sqlite_st *queue; - gearman_conf_module_st *module; - const char *name; - const char *value; - char *table= NULL; - const char *query; - sqlite3_stmt* sth; - char create[SQLITE_MAX_CREATE_TABLE_SIZE]; - - gearman_log_info(server->gearman, "Initializing libsqlite3 module"); - - queue= calloc(1, sizeof(gearman_queue_sqlite_st)); - if (queue == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - snprintf(queue->table, SQLITE_MAX_TABLE_SIZE, - GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE); - - /* Get module and parse the option values that were given. */ - module= gearman_conf_module_find(conf, "libsqlite3"); - if (module == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "gearman_conf_module_find:NULL"); - free(queue); - - return GEARMAN_QUEUE_ERROR; - } - - gearman_server_set_queue_context(server, queue); - - while (gearman_conf_module_value(module, &name, &value)) - { - if (! strcmp(name, "db")) - { - if (sqlite3_open(value, &(queue->db)) != SQLITE_OK) - { - gearman_server_queue_libsqlite3_deinit(server); - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "Can't open database: %s\n", - sqlite3_errmsg(queue->db)); - free(queue); - return GEARMAN_QUEUE_ERROR; - } - } - else if (! strcmp(name, "table")) - { - snprintf(queue->table, SQLITE_MAX_TABLE_SIZE, "%s", value); - } - else - { - gearman_server_queue_libsqlite3_deinit(server); - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "Unknown argument: %s", name); - return GEARMAN_QUEUE_ERROR; - } - } - - if (! queue->db) - { - gearman_server_queue_libsqlite3_deinit(server); - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "missing required --libsqlite3-db= argument"); - return GEARMAN_QUEUE_ERROR; - } - - query= "SELECT name FROM sqlite_master WHERE type='table'"; - if (_sqlite_query(server, queue, query, strlen(query), &sth) != SQLITE_OK) - { - gearman_server_queue_libsqlite3_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - while (sqlite3_step(sth) == SQLITE_ROW) - { - if (sqlite3_column_type(sth,0) == SQLITE_TEXT) - table= (char*)sqlite3_column_text(sth, 0); - else - { - sqlite3_finalize(sth); - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "column %d is not type TEXT", 0); - return GEARMAN_QUEUE_ERROR; - } - - if (! strcasecmp(queue->table, table)) - { - gearman_log_info(server->gearman, "sqlite module using table '%s'", table); - break; - } - } - - if (sqlite3_finalize(sth) != SQLITE_OK) - { - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "sqlite_finalize:%s", sqlite3_errmsg(queue->db)); - gearman_server_queue_libsqlite3_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - if (table == NULL) - { - snprintf(create, SQLITE_MAX_CREATE_TABLE_SIZE, - "CREATE TABLE %s" - "(" - "unique_key TEXT PRIMARY KEY," - "function_name TEXT," - "priority INTEGER," - "data BLOB" - ")", - queue->table); - - gearman_log_info(server->gearman, "sqlite module creating table '%s'", queue->table); - - if (_sqlite_query(server, queue, create, strlen(create), &sth) - != SQLITE_OK) - { - gearman_server_queue_libsqlite3_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_step(sth) != SQLITE_DONE) - { - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "create table error: %s", - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_finalize(sth) != SQLITE_OK) - { - gearman_log_error(server->gearman, "gearman_queue_libsqlite3_init", - "sqlite_finalize:%s", - sqlite3_errmsg(queue->db)); - gearman_server_queue_libsqlite3_deinit(server); - return GEARMAN_QUEUE_ERROR; - } - } - - gearman_server_set_queue_add_fn(server, _sqlite_add); - gearman_server_set_queue_flush_fn(server, _sqlite_flush); - gearman_server_set_queue_done_fn(server, _sqlite_done); - gearman_server_set_queue_replay_fn(server, _sqlite_replay); - - return GEARMAN_SUCCESS; -} - -gearman_return_t -gearman_server_queue_libsqlite3_deinit(gearman_server_st *server) -{ - gearman_queue_sqlite_st *queue; - - gearman_log_info(server->gearman, "Shutting down sqlite queue module"); - - queue= (gearman_queue_sqlite_st *)gearman_server_queue_context(server); - gearman_server_set_queue_context(server, NULL); - sqlite3_close(queue->db); - if (queue->query != NULL) - free(queue->query); - free(queue); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearmand_queue_libsqlite3_init(gearmand_st *gearmand, - gearman_conf_st *conf) -{ - return gearman_server_queue_libsqlite3_init(&(gearmand->server), conf); -} - -gearman_return_t gearmand_queue_libsqlite3_deinit(gearmand_st *gearmand) -{ - return gearman_server_queue_libsqlite3_deinit(&(gearmand->server)); -} - -/* - * Static definitions - */ - -int _sqlite_query(gearman_server_st *server, - gearman_queue_sqlite_st *queue, - const char *query, size_t query_size, - sqlite3_stmt ** sth) -{ - int ret; - - if (query_size > UINT32_MAX) - { - gearman_log_error(server->gearman, "_sqlite_query", "query size too big [%u]", - (uint32_t)query_size); - return SQLITE_ERROR; - } - - gearman_log_crazy(server->gearman, "sqlite query: %s", query); - ret= sqlite3_prepare(queue->db, query, (int)query_size, sth, NULL); - if (ret != SQLITE_OK) - { - if (*sth) - { - sqlite3_finalize(*sth); - } - *sth= NULL; - gearman_log_error(server->gearman, "_sqlite_query", "sqlite_prepare:%s", - sqlite3_errmsg(queue->db)); - } - - return ret; -} - -int _sqlite_lock(gearman_server_st *server, - gearman_queue_sqlite_st *queue) -{ - sqlite3_stmt* sth; - int ret; - if (queue->in_trans) - { - /* already in transaction */ - return SQLITE_OK; - } - - ret= _sqlite_query(server, queue, "BEGIN TRANSACTION", - sizeof("BEGIN TRANSACTION") - 1, &sth); - if (ret != SQLITE_OK) - { - gearman_log_error(server->gearman, "_sqlite_lock", - "failed to begin transaction: %s", - sqlite3_errmsg(queue->db)); - if (sth) - { - sqlite3_finalize(sth); - } - - return ret; - } - - ret= sqlite3_step(sth); - if (ret != SQLITE_DONE) - { - gearman_log_error(server->gearman, "_sqlite_lock", "lock error: %s", - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return ret; - } - - sqlite3_finalize(sth); - queue->in_trans++; - - return SQLITE_OK; -} - -int _sqlite_commit(gearman_server_st *server, - gearman_queue_sqlite_st *queue) -{ - sqlite3_stmt* sth; - int ret; - - if (! queue->in_trans) - { - /* not in transaction */ - return SQLITE_OK; - } - - ret= _sqlite_query(server, queue, "COMMIT", sizeof("COMMIT") - 1, &sth); - if (ret != SQLITE_OK) - { - gearman_log_error(server->gearman, "_sqlite_commit", - "failed to commit transaction: %s", - sqlite3_errmsg(queue->db)); - if (sth) - { - sqlite3_finalize(sth); - } - - return ret; - } - ret= sqlite3_step(sth); - if (ret != SQLITE_DONE) - { - gearman_log_error(server->gearman, "_sqlite_commit", "commit error: %s", - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return ret; - } - sqlite3_finalize(sth); - queue->in_trans= 0; - return SQLITE_OK; -} - -int _sqlite_rollback(gearman_server_st *server, - gearman_queue_sqlite_st *queue) -{ - sqlite3_stmt* sth; - int ret; - const char* query; - - if (! queue->in_trans) - { - /* not in transaction */ - return SQLITE_OK; - } - - query= "ROLLBACK"; - ret= _sqlite_query(server, queue, query, strlen(query), &sth); - if (ret != SQLITE_OK) - { - gearman_log_error(server->gearman, "_sqlite_rollback", - "failed to rollback transaction: %s", - sqlite3_errmsg(queue->db)); - if (sth) - { - sqlite3_finalize(sth); - } - - return ret; - } - ret= sqlite3_step(sth); - if (ret != SQLITE_DONE) - { - gearman_log_error(server->gearman, "_sqlite_rollback", "rollback error: %s", - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return ret; - } - sqlite3_finalize(sth); - queue->in_trans= 0; - - return SQLITE_OK; -} - -static gearman_return_t _sqlite_add(gearman_server_st *server, void *context, - const void *unique, size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority) -{ - gearman_queue_sqlite_st *queue= (gearman_queue_sqlite_st *)context; - char *query; - size_t query_size; - sqlite3_stmt* sth; - - if (unique_size > UINT32_MAX || function_name_size > UINT32_MAX || - data_size > UINT32_MAX) - { - gearman_log_error(server->gearman, "_sqlite_add", "size too big [%u]", - (uint32_t)unique_size); - return SQLITE_ERROR; - } - - gearman_log_debug(server->gearman, "sqlite add: %.*s", (uint32_t)unique_size, (char *)unique); - - if (_sqlite_lock(server, queue) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - - query_size= ((unique_size + function_name_size + data_size) * 2) + - GEARMAN_QUEUE_QUERY_BUFFER; - if (query_size > queue->query_size) - { - query= (char *)realloc(queue->query, query_size); - if (query == NULL) - { - gearman_log_error(server->gearman, "_sqlite_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= query_size; - } - else - { - query= queue->query; - } - - query_size= (size_t)snprintf(query, query_size, - "INSERT OR REPLACE INTO %s (priority,unique_key," - "function_name,data) VALUES (?,?,?,?)", - queue->table); - - if (_sqlite_query(server, queue, query, query_size, &sth) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - - if (sqlite3_bind_int(sth, 1, priority) != SQLITE_OK) - { - _sqlite_rollback(server, queue); - gearman_log_error(server->gearman, "_sqlite_add", "failed to bind int [%d]: %s", priority, sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_bind_text(sth, 2, unique, (int)unique_size, - SQLITE_TRANSIENT) != SQLITE_OK) - { - _sqlite_rollback(server, queue); - gearman_log_error(server->gearman, "_sqlite_add", - "failed to bind text [%.*s]: %s", - (uint32_t)unique_size, (char*)unique, - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_bind_text(sth, 3, function_name, (int)function_name_size, - SQLITE_TRANSIENT) != SQLITE_OK) - { - _sqlite_rollback(server, queue); - gearman_log_error(server->gearman, "_sqlite_add", - "failed to bind text [%.*s]: %s", - (uint32_t)function_name_size, (char*)function_name, - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_bind_blob(sth, 4, data, (int)data_size, - SQLITE_TRANSIENT) != SQLITE_OK) - { - _sqlite_rollback(server, queue); - gearman_log_error(server->gearman, "_sqlite_add", "failed to bind blob: %s", - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_step(sth) != SQLITE_DONE) - { - gearman_log_error(server->gearman, "_sqlite_add", "insert error: %s", - sqlite3_errmsg(queue->db)); - if (sqlite3_finalize(sth) != SQLITE_OK ) - { - gearman_log_error(server->gearman, "_sqlite_add", "finalize error: %s", - sqlite3_errmsg(queue->db)); - } - - return GEARMAN_QUEUE_ERROR; - } - - gearman_log_crazy(server->gearman, - "sqlite data: priority: %d, unique_key: %s, function_name: %s", - priority, (char*)unique, (char*)function_name); - - sqlite3_finalize(sth); - - if (_sqlite_commit(server, queue) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _sqlite_flush(gearman_server_st *server, - void *context __attribute__((unused))) -{ - gearman_log_debug(server->gearman, "sqlite flush"); - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _sqlite_done(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name __attribute__((unused)), - size_t function_name_size __attribute__((unused))) -{ - gearman_queue_sqlite_st *queue= (gearman_queue_sqlite_st *)context; - char *query; - size_t query_size; - sqlite3_stmt* sth; - - if (unique_size > UINT32_MAX) - { - gearman_log_error(server->gearman, - "_sqlite_query", "unique key size too big [%u]", - (uint32_t)unique_size); - return SQLITE_ERROR; - } - - gearman_log_debug(server->gearman, "sqlite done: %.*s", (uint32_t)unique_size, (char *)unique); - - if (_sqlite_lock(server, queue) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - - query_size= (unique_size * 2) + GEARMAN_QUEUE_QUERY_BUFFER; - if (query_size > queue->query_size) - { - query= (char *)realloc(queue->query, query_size); - if (query == NULL) - { - gearman_log_error(server->gearman, "_sqlite_add", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= query_size; - } - else - query= queue->query; - - query_size= (size_t)snprintf(query, query_size, - "DELETE FROM %s WHERE unique_key=?", - queue->table); - - if (_sqlite_query(server, queue, query, query_size, &sth) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - - sqlite3_bind_text(sth, 1, unique, (int)unique_size, SQLITE_TRANSIENT); - - if (sqlite3_step(sth) != SQLITE_DONE) - { - gearman_log_error(server->gearman, "_sqlite_done", "delete error: %s", - sqlite3_errmsg(queue->db)); - sqlite3_finalize(sth); - return GEARMAN_QUEUE_ERROR; - } - - sqlite3_finalize(sth); - - if (_sqlite_commit(server, queue) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _sqlite_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context) -{ - gearman_queue_sqlite_st *queue= (gearman_queue_sqlite_st *)context; - char *query; - size_t query_size; - sqlite3_stmt* sth; - gearman_return_t gret; - - gearman_log_info(server->gearman, "sqlite replay start"); - - if (GEARMAN_QUEUE_QUERY_BUFFER > queue->query_size) - { - query= (char *)realloc(queue->query, GEARMAN_QUEUE_QUERY_BUFFER); - if (query == NULL) - { - gearman_log_error(server->gearman, "_sqlite_replay", "realloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - queue->query= query; - queue->query_size= GEARMAN_QUEUE_QUERY_BUFFER; - } - else - query= queue->query; - - query_size= (size_t)snprintf(query, GEARMAN_QUEUE_QUERY_BUFFER, - "SELECT unique_key,function_name,priority,data " - "FROM %s", - queue->table); - - if (_sqlite_query(server, queue, query, query_size, &sth) != SQLITE_OK) - return GEARMAN_QUEUE_ERROR; - while (sqlite3_step(sth) == SQLITE_ROW) - { - const void *unique, *function_name; - void *data; - size_t unique_size, function_name_size, data_size; - gearman_job_priority_t priority; - - if (sqlite3_column_type(sth,0) == SQLITE_TEXT) - { - unique= sqlite3_column_text(sth,0); - unique_size= (size_t) sqlite3_column_bytes(sth,0); - } - else - { - sqlite3_finalize(sth); - gearman_log_error(server->gearman, "_sqlite_replay", - "column %d is not type TEXT", 0); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_column_type(sth,1) == SQLITE_TEXT) - { - function_name= sqlite3_column_text(sth,1); - function_name_size= (size_t)sqlite3_column_bytes(sth,1); - } - else - { - sqlite3_finalize(sth); - gearman_log_error(server->gearman, "_sqlite_replay", - "column %d is not type TEXT", 1); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_column_type(sth,2) == SQLITE_INTEGER) - { - priority= (double)sqlite3_column_int64(sth,2); - } - else - { - sqlite3_finalize(sth); - gearman_log_error(server->gearman, "_sqlite_replay", - "column %d is not type INTEGER", 2); - return GEARMAN_QUEUE_ERROR; - } - - if (sqlite3_column_type(sth,3) == SQLITE_BLOB) - { - data_size= (size_t)sqlite3_column_bytes(sth,3); - /* need to make a copy here ... gearman_server_job_free will free it later */ - data= (void *)malloc(data_size); - if (data == NULL) - { - sqlite3_finalize(sth); - gearman_log_error(server->gearman, "_sqlite_replay", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - memcpy(data, sqlite3_column_blob(sth,3), data_size); - } - else - { - sqlite3_finalize(sth); - gearman_log_error(server->gearman, "_sqlite_replay", "column %d is not type TEXT", 3); - return GEARMAN_QUEUE_ERROR; - } - - gearman_log_debug(server->gearman, "sqlite replay: %s", (char*)function_name); - - gret= (*add_fn)(server, add_context, - unique, unique_size, - function_name, function_name_size, - data, data_size, - priority); - if (gret != GEARMAN_SUCCESS) - { - sqlite3_finalize(sth); - return gret; - } - } - - sqlite3_finalize(sth); - - return GEARMAN_SUCCESS; -} diff -Nru gearmand-0.14/libgearman-server/queue_libsqlite3.h gearmand-0.23/libgearman-server/queue_libsqlite3.h --- gearmand-0.14/libgearman-server/queue_libsqlite3.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libsqlite3.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,66 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2009 Cory Bennett - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief libsqlite3 Queue Storage Declarations - */ - -#ifndef __GEARMAN_SERVER_QUEUE_LIBSQLITE3_H__ -#define __GEARMAN_SERVER_QUEUE_LIBSQLITE3_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_queue_libsqlite3 libsqlite3 Queue Storage Declarations - * @ingroup gearman_server_queue - * @{ - */ - -/** - * Get module configuration options. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libsqlite3_conf(gearman_conf_st *conf); - -/** - * Initialize the queue. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libsqlite3_init(gearman_server_st *server, - gearman_conf_st *conf); - -/** - * De-initialize the queue. - */ -GEARMAN_API -gearman_return_t -gearman_server_queue_libsqlite3_deinit(gearman_server_st *server); - -/** - * Initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libsqlite3_init(gearmand_st *gearmand, - gearman_conf_st *conf); - -/** - * De-initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libsqlite3_deinit(gearmand_st *gearmand); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_SERVER_QUEUE_LIBSQLITE3_H__ */ diff -Nru gearmand-0.14/libgearman-server/queue_libtokyocabinet.c gearmand-0.23/libgearman-server/queue_libtokyocabinet.c --- gearmand-0.14/libgearman-server/queue_libtokyocabinet.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libtokyocabinet.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,427 +0,0 @@ -/** - * @file - * @brief Tokyo Cabinet Queue Storage Definitions - */ - -#include "common.h" - -#include -#include -#include - -/** - * @addtogroup gearman_queue_libtokyocabinet libtokyocabinet Queue Storage Functions - * @ingroup gearman_queue - * @{ - */ - -/* - * Private declarations - */ - -/** - * Structure for libtokyocabinet specific data. - */ -typedef struct -{ - TCADB *db; -} gearman_queue_libtokyocabinet_st; - -/* Queue callback functions. */ -static gearman_return_t _libtokyocabinet_add(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority); -static gearman_return_t _libtokyocabinet_flush(gearman_server_st *server, void *context); -static gearman_return_t _libtokyocabinet_done(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size); -static gearman_return_t _libtokyocabinet_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context); - -/** - * Missing function from tcadb.c ?? - */ -static const char * _libtokyocabinet_tcaerrmsg(TCADB *db) -{ - switch (tcadbomode(db)) - { - case ADBOHDB: - return tcerrmsg(tchdbecode((TCHDB *)tcadbreveal(db))); - case ADBOBDB: - return tcerrmsg(tcbdbecode((TCBDB *)tcadbreveal(db))); - default: - return tcerrmsg(TCEMISC); - } -} - -/* - * Public definitions - */ - -gearman_return_t gearman_server_queue_libtokyocabinet_conf(gearman_conf_st *conf) -{ - gearman_conf_module_st *module; - - module= gearman_conf_module_create(conf, NULL, "libtokyocabinet"); - if (module == NULL) - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - - gearman_conf_module_add_option(module, "file", 0, "FILE_NAME", - "File name of the database. [see: man tcadb, tcadbopen() for name guidelines]"); - gearman_conf_module_add_option(module, "optimize", 0, "yes/no", - "Optimize database on open. [default=yes]"); - return gearman_conf_return(conf); -} - -gearman_return_t gearman_queue_libtokyocabinet_init(gearman_server_st *server, - gearman_conf_st *conf) -{ - gearman_queue_libtokyocabinet_st *queue; - gearman_conf_module_st *module; - const char *name; - const char *value; - const char *opt_file= NULL; - const char *opt_optimize= NULL; - - gearman_log_info(server->gearman, "Initializing libtokyocabinet module"); - - queue= calloc(1, sizeof(gearman_queue_libtokyocabinet_st)); - if (queue == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", "malloc"); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } - - if ((queue->db= tcadbnew()) == NULL) - { - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", - "tcadbnew"); - return GEARMAN_QUEUE_ERROR; - } - - /* Get module and parse the option values that were given. */ - module= gearman_conf_module_find(conf, "libtokyocabinet"); - if (module == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", - "modconf_module_find:NULL"); - return GEARMAN_QUEUE_ERROR; - } - - while (gearman_conf_module_value(module, &name, &value)) - { - if (!strcmp(name, "file")) - opt_file= value; - else if (!strcmp(name, "optimize")) - opt_optimize= value; - else - { - tcadbdel(queue->db); - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", - "Unknown argument: %s", name); - return GEARMAN_QUEUE_ERROR; - } - } - - if (opt_file == NULL) - { - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", - "No --file given"); - return GEARMAN_QUEUE_ERROR; - } - - if (!tcadbopen(queue->db, opt_file)) - { - tcadbdel(queue->db); - free(queue); - - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", - "tcadbopen(%s): %s", opt_file, _libtokyocabinet_tcaerrmsg(queue->db)); - - return GEARMAN_QUEUE_ERROR; - } - - if (opt_optimize == NULL || !strcasecmp(opt_optimize, "yes")) - { - gearman_log_info(server->gearman, "libtokyocabinet optimizing database file"); - if (!tcadboptimize(queue->db, NULL)) - { - tcadbdel(queue->db); - free(queue); - gearman_log_error(server->gearman, "gearman_queue_libtokyocabinet_init", - "tcadboptimize"); - - return GEARMAN_QUEUE_ERROR; - } - } - - gearman_server_set_queue_context(server, queue); - - gearman_server_set_queue_add_fn(server, _libtokyocabinet_add); - gearman_server_set_queue_flush_fn(server, _libtokyocabinet_flush); - gearman_server_set_queue_done_fn(server, _libtokyocabinet_done); - gearman_server_set_queue_replay_fn(server, _libtokyocabinet_replay); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearman_queue_libtokyocabinet_deinit(gearman_server_st *server) -{ - gearman_queue_libtokyocabinet_st *queue; - - gearman_log_info(server->gearman, "Shutting down libtokyocabinet queue module"); - - queue= (gearman_queue_libtokyocabinet_st *)gearman_server_queue_context(server); - gearman_server_set_queue_context(server, NULL); - tcadbdel(queue->db); - - free(queue); - - return GEARMAN_SUCCESS; -} - -gearman_return_t gearmand_queue_libtokyocabinet_init(gearmand_st *gearmand, - gearman_conf_st *conf) -{ - return gearman_queue_libtokyocabinet_init(&(gearmand->server), conf); -} - -gearman_return_t gearmand_queue_libtokyocabinet_deinit(gearmand_st *gearmand) -{ - return gearman_queue_libtokyocabinet_deinit(&(gearmand->server)); -} - -/* - * Private definitions - */ - -static gearman_return_t _libtokyocabinet_add(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size, - const void *data, size_t data_size, - gearman_job_priority_t priority) -{ - gearman_queue_libtokyocabinet_st *queue= (gearman_queue_libtokyocabinet_st *)context; - bool rc; - TCXSTR *key; - TCXSTR *job_data; - - gearman_log_debug(server->gearman, "libtokyocabinet add: %.*s", (uint32_t)unique_size, (char *)unique); - - char key_str[GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN]; - size_t key_length= (size_t)snprintf(key_str, GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN, "%.*s-%.*s", - (int)function_name_size, - (const char *)function_name, (int)unique_size, - (const char *)unique); - - key= tcxstrnew(); - tcxstrcat(key, key_str, (int)key_length); - - gearman_log_debug(server->gearman, "libtokyocabinet key: %.*s", (int)key_length, key_str); - - job_data= tcxstrnew(); - - tcxstrcat(job_data, (const char *)function_name, (int)function_name_size); - tcxstrcat(job_data, "\0", 1); - tcxstrcat(job_data, (const char *)unique, (int)unique_size); - tcxstrcat(job_data, "\0", 1); - - switch (priority) - { - case GEARMAN_JOB_PRIORITY_HIGH: - case GEARMAN_JOB_PRIORITY_MAX: - tcxstrcat2(job_data,"0"); - break; - case GEARMAN_JOB_PRIORITY_LOW: - tcxstrcat2(job_data,"2"); - break; - case GEARMAN_JOB_PRIORITY_NORMAL: - default: - tcxstrcat2(job_data,"1"); - } - - tcxstrcat(job_data, (const char *)data, (int)data_size); - - rc= tcadbput(queue->db, tcxstrptr(key), tcxstrsize(key), - tcxstrptr(job_data), tcxstrsize(job_data)); - - tcxstrdel(key); - tcxstrdel(job_data); - - if (!rc) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libtokyocabinet_flush(gearman_server_st *server, - void *context __attribute__((unused))) -{ - gearman_queue_libtokyocabinet_st *queue= (gearman_queue_libtokyocabinet_st *)context; - - gearman_log_debug(server->gearman, "libtokyocabinet flush"); - - if (!tcadbsync(queue->db)) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _libtokyocabinet_done(gearman_server_st *server, void *context, - const void *unique, - size_t unique_size, - const void *function_name, - size_t function_name_size) -{ - gearman_queue_libtokyocabinet_st *queue= (gearman_queue_libtokyocabinet_st *)context; - bool rc; - TCXSTR *key; - - (void) function_name; - (void) function_name_size; - gearman_log_debug(server->gearman, "libtokyocabinet add: %.*s", (uint32_t)unique_size, (char *)unique); - - char key_str[GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN]; - size_t key_length= (size_t)snprintf(key_str, GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN, "%.*s-%.*s", - (int)function_name_size, - (const char *)function_name, (int)unique_size, - (const char *)unique); - - key= tcxstrnew(); - tcxstrcat(key, key_str, (int)key_length); - rc= tcadbout(queue->db, tcxstrptr(key), tcxstrsize(key)); - tcxstrdel(key); - - if (!rc) - return GEARMAN_QUEUE_ERROR; - - return GEARMAN_SUCCESS; -} - -static gearman_return_t _callback_for_record(gearman_server_st *server, - TCXSTR *key, TCXSTR *data, - gearman_queue_add_fn *add_fn, - void *add_context) -{ - char *data_cstr; - size_t data_cstr_size; - const char *function; - size_t function_len; - char *unique; - size_t unique_len; - gearman_job_priority_t priority; - gearman_return_t gret; - - gearman_log_debug(server->gearman, "replaying: %s", (char *) tcxstrptr(key)); - - data_cstr= (char *)tcxstrptr(data); - data_cstr_size= (size_t)tcxstrsize(data); - - function= data_cstr; - function_len= strlen(function); - - unique= data_cstr+function_len+1; - unique_len= strlen(unique); // strlen is only safe because tcxstrptr guarantees nul term - - // +2 for nulls - data_cstr += unique_len+function_len+2; - data_cstr_size -= unique_len+function_len+2; - - assert(unique); - assert(unique_len); - assert(function); - assert(function_len); - - // single char for priority - if (*data_cstr == '2') - priority = GEARMAN_JOB_PRIORITY_LOW; - else if (*data_cstr == '0') - priority = GEARMAN_JOB_PRIORITY_HIGH; - else - priority = GEARMAN_JOB_PRIORITY_NORMAL; - - ++data_cstr; - --data_cstr_size; - - // data is freed later so we must make a copy - void *data_ptr= (void *)malloc(data_cstr_size); - if (data_ptr == NULL) - { - return GEARMAN_QUEUE_ERROR; - } - memcpy(data_ptr, data_cstr, data_cstr_size); - - gret = (*add_fn)(server, add_context, unique, unique_len, - function, function_len, - data_ptr, data_cstr_size, - priority); - - if (gret != GEARMAN_SUCCESS) - { - return gret; - } - return GEARMAN_SUCCESS; -} - - -static gearman_return_t _libtokyocabinet_replay(gearman_server_st *server, void *context, - gearman_queue_add_fn *add_fn, - void *add_context) -{ - gearman_queue_libtokyocabinet_st *queue= (gearman_queue_libtokyocabinet_st *)context; - TCXSTR *key; - TCXSTR *data; - void *iter= NULL; - int iter_size= 0; - gearman_return_t gret; - gearman_return_t tmp_gret; - - gearman_log_info(server->gearman, "libtokyocabinet replay start"); - - if (!tcadbiterinit(queue->db)) - { - return GEARMAN_QUEUE_ERROR; - } - key= tcxstrnew(); - data= tcxstrnew(); - gret= GEARMAN_SUCCESS; - uint64_t x= 0; - while ((iter= tcadbiternext(queue->db, &iter_size))) - { - tcxstrclear(key); - tcxstrclear(data); - tcxstrcat(key, iter, iter_size); - free(iter); - iter= tcadbget(queue->db, tcxstrptr(key), tcxstrsize(key), &iter_size); - if (! iter) { - gearman_log_info(server->gearman, "libtokyocabinet replay key disappeared: %s", (char *)tcxstrptr(key)); - continue; - } - tcxstrcat(data, iter, iter_size); - free(iter); - tmp_gret= _callback_for_record(server, key, data, add_fn, add_context); - if (tmp_gret != GEARMAN_SUCCESS) - { - gret= GEARMAN_QUEUE_ERROR; - break; - } - ++x; - } - tcxstrdel(key); - tcxstrdel(data); - - gearman_log_info(server->gearman, "libtokyocabinet replayed %ld records", x); - - return gret; -} diff -Nru gearmand-0.14/libgearman-server/queue_libtokyocabinet.h gearmand-0.23/libgearman-server/queue_libtokyocabinet.h --- gearmand-0.14/libgearman-server/queue_libtokyocabinet.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/queue_libtokyocabinet.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,62 +0,0 @@ -/** - * @file - * @brief libtokyocabinet Queue Storage Declarations - */ - -#ifndef __GEARMAN_QUEUE_LIBTOKYOCABINET_H__ -#define __GEARMAN_QUEUE_LIBTOKYOCABINET_H__ - -/** - * It is unclear from tokyocabinet's public headers what, if any, limit there is. 4k seems sane. - */ -#define GEARMAN_QUEUE_TOKYOCABINET_MAX_KEY_LEN 4096 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup gearman_queue_libtokyocabinet libtokyocabinet Queue Storage Functions - * @ingroup gearman_queue - * @{ - */ - -/** - * Get module configuration options. - */ -GEARMAN_API -gearman_return_t gearman_server_queue_libtokyocabinet_conf(gearman_conf_st *conf); - -/** - * Initialize the queue. - */ -GEARMAN_API -gearman_return_t gearman_queue_libtokyocabinet_init(gearman_server_st *server, - gearman_conf_st *conf); - -/** - * De-initialize the queue. - */ -GEARMAN_API -gearman_return_t gearman_queue_libtokyocabinet_deinit(gearman_server_st *server); - -/** - * Initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libtokyocabinet_init(gearmand_st *gearmand, - gearman_conf_st *conf); - -/** - * De-initialize the queue for a gearmand object. - */ -GEARMAN_API -gearman_return_t gearmand_queue_libtokyocabinet_deinit(gearmand_st *server); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __GEARMAN_QUEUE_LIBTOKYOCABINET_H__ */ diff -Nru gearmand-0.14/libgearman-server/server.c gearmand-0.23/libgearman-server/server.c --- gearmand-0.14/libgearman-server/server.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/server.c 2011-06-29 22:18:02.000000000 +0200 @@ -11,12 +11,24 @@ * @brief Server Definitions */ -#include "common.h" +#include + +#include +#include +#include +#include /* * Private declarations */ + +#define TEXT_SUCCESS "OK\r\n" +#define TEXT_ERROR_ARGS "ERR INVALID_ARGUMENTS An+incomplete+set+of+arguments+was+sent+to+this+command+%.*s\r\n" +#define TEXT_ERROR_CREATE_FUNCTION "ERR CREATE_FUNCTION %.*s\r\n" +#define TEXT_ERROR_UNKNOWN_COMMAND "ERR UNKNOWN_COMMAND Unknown+server+command%.*s\r\n" +#define TEXT_ERROR_INTERNAL_ERROR "ERR UNKNOWN_ERROR\r\n" + /** * @addtogroup gearman_server_private Private Server Functions * @ingroup gearman_server @@ -26,37 +38,32 @@ /** * Add job to queue wihle replaying queue during startup. */ -gearman_return_t _queue_replay_add(gearman_server_st *server, void *context, - const void *unique, size_t unique_size, - const void *function_name, - size_t function_name_size, const void *data, - size_t data_size, - gearman_job_priority_t priority); +static gearmand_error_t _queue_replay_add(gearman_server_st *server, void *context, + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when); /** * Queue an error packet. */ -static gearman_return_t _server_error_packet(gearman_server_con_st *server_con, +static gearmand_error_t _server_error_packet(gearman_server_con_st *server_con, const char *error_code, const char *error_string); /** * Process text commands for a connection. */ -static gearman_return_t _server_run_text(gearman_server_con_st *server_con, - gearman_packet_st *packet); +static gearmand_error_t _server_run_text(gearman_server_con_st *server_con, + gearmand_packet_st *packet); /** * Send work result packets with data back to clients. */ -static gearman_return_t +static gearmand_error_t _server_queue_work_data(gearman_server_job_st *server_job, - gearman_packet_st *packet, gearman_command_t command); - -/** - * Wrapper for log handling. - */ -static void _log(const char *line, gearman_verbose_t verbose, void *context); + gearmand_packet_st *packet, gearman_command_t command); /** @} */ @@ -64,171 +71,31 @@ * Public definitions */ -gearman_server_st *gearman_server_create(gearman_server_st *server) +gearmand_error_t gearman_server_run_command(gearman_server_con_st *server_con, + gearmand_packet_st *packet) { - struct utsname un; - - if (server == NULL) - { - server= (gearman_server_st *)malloc(sizeof(gearman_server_st)); - if (server == NULL) - return NULL; - - server->options.allocated= true; - } - else - server->options.allocated= false; - - server->state.queue_startup= false; - server->flags.round_robin= false; - server->flags.threaded= false; - server->shutdown= false; - server->shutdown_graceful= false; - server->proc_wakeup= false; - server->proc_shutdown= false; - server->job_retries= 0; - server->worker_wakeup= 0; - server->thread_count= 0; - server->free_packet_count= 0; - server->function_count= 0; - server->job_count= 0; - server->unique_count= 0; - server->free_job_count= 0; - server->free_client_count= 0; - server->free_worker_count= 0; - server->thread_list= NULL; - server->free_packet_list= NULL; - server->function_list= NULL; - server->free_job_list= NULL; - server->free_client_list= NULL; - server->free_worker_list= NULL; - server->log_fn= NULL; - server->log_context= NULL; - server->queue_context= NULL; - server->queue_add_fn= NULL; - server->queue_flush_fn= NULL; - server->queue_done_fn= NULL; - server->queue_replay_fn= NULL; - memset(server->job_hash, 0, - sizeof(gearman_server_job_st *) * GEARMAN_JOB_HASH_SIZE); - memset(server->unique_hash, 0, - sizeof(gearman_server_job_st *) * GEARMAN_JOB_HASH_SIZE); - - server->gearman= gearman_universal_create(&(server->gearman_universal_static), NULL); - if (server->gearman == NULL) - { - gearman_server_free(server); - return NULL; - } - - if (uname(&un) == -1) - { - gearman_server_free(server); - return NULL; - } - - snprintf(server->job_handle_prefix, GEARMAN_JOB_HANDLE_SIZE, "H:%s", - un.nodename); - server->job_handle_count= 1; - - return server; -} - -void gearman_server_free(gearman_server_st *server) -{ - uint32_t key; - gearman_server_packet_st *packet; - gearman_server_job_st *job; - gearman_server_client_st *client; - gearman_server_worker_st *worker; - - /* All threads should be cleaned up before calling this. */ - assert(server->thread_list == NULL); - - for (key= 0; key < GEARMAN_JOB_HASH_SIZE; key++) - { - while (server->job_hash[key] != NULL) - gearman_server_job_free(server->job_hash[key]); - } - - while (server->function_list != NULL) - gearman_server_function_free(server->function_list); - - while (server->free_packet_list != NULL) - { - packet= server->free_packet_list; - server->free_packet_list= packet->next; - free(packet); - } - - while (server->free_job_list != NULL) - { - job= server->free_job_list; - server->free_job_list= job->next; - free(job); - } - - while (server->free_client_list != NULL) - { - client= server->free_client_list; - server->free_client_list= client->con_next; - free(client); - } - - while (server->free_worker_list != NULL) - { - worker= server->free_worker_list; - server->free_worker_list= worker->con_next; - free(worker); - } - - if (server->gearman != NULL) - gearman_universal_free(server->gearman); - - if (server->options.allocated) - free(server); -} - -void gearman_server_set_job_retries(gearman_server_st *server, - uint8_t job_retries) -{ - server->job_retries= job_retries; -} - -void gearman_server_set_worker_wakeup(gearman_server_st *server, - uint8_t worker_wakeup) -{ - server->worker_wakeup= worker_wakeup; -} - -void gearman_server_set_log_fn(gearman_server_st *server, - gearman_log_fn *function, - void *context, gearman_verbose_t verbose) -{ - server->log_fn= function; - server->log_context= context; - gearman_set_log_fn(server->gearman, _log, server, verbose); -} - -gearman_return_t gearman_server_run_command(gearman_server_con_st *server_con, - gearman_packet_st *packet) -{ - gearman_return_t ret; + gearmand_error_t ret; gearman_server_job_st *server_job; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; + char job_handle[GEARMAND_JOB_HANDLE_SIZE]; char option[GEARMAN_OPTION_SIZE]; - gearman_server_client_st *server_client; + gearman_server_client_st *server_client= NULL; char numerator_buffer[11]; /* Max string size to hold a uint32_t. */ char denominator_buffer[11]; /* Max string size to hold a uint32_t. */ - gearman_job_priority_t priority; - gearman_server_st *server= server_con->thread->server; + gearmand_job_priority_t priority; + + int checked_length; if (packet->magic == GEARMAN_MAGIC_RESPONSE) { - return _server_error_packet(server_con, "bad_magic", - "Request magic expected"); + return _server_error_packet(server_con, "bad_magic", "Request magic expected"); } + gearmand_log_crazy(GEARMAN_DEFAULT_LOG_PARAM, + "%15s:%5s packet command %s", + server_con->con.context == NULL ? "-" : server_con->con.context->host, + server_con->con.context == NULL ? "-" : server_con->con.context->port, + gearmand_strcommand(packet)); + switch (packet->command) { /* Client/worker requests. */ @@ -237,11 +104,76 @@ ret= gearman_server_io_packet_add(server_con, true, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_ECHO_RES, packet->data, packet->data_size, NULL); - if (ret != GEARMAN_SUCCESS) - return ret; + if (gearmand_failed(ret)) + { + return gearmand_gerror("gearman_server_io_packet_add", ret); + } packet->options.free_data= false; + break; + case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: // Reduce request + server_client= gearman_server_client_add(server_con); + if (server_client == NULL) + { + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: + { + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Received reduce submission, Partitioner: %.*s(%lu) Reducer: %.*s(%lu) Unique: %.*s(%lu) with %d arguments", + packet->arg_size[0] -1, packet->arg[0], packet->arg_size[0] -1, + packet->arg_size[2] -1, packet->arg[2], packet->arg_size[2] -1, // reducer + packet->arg_size[1] -1, packet->arg[1], packet->arg_size[1] -1, + (int)packet->argc); + if (packet->arg_size[2] -1 > GEARMAN_UNIQUE_SIZE) + { + gearman_server_client_free(server_client); + gearmand_gerror("unique value too large", GEARMAN_ARGUMENT_TOO_LARGE); + return _server_error_packet(server_con, "job failure", "Unique value too large"); + } + + gearmand_job_priority_t map_priority= GEARMAND_JOB_PRIORITY_NORMAL; + + /* Schedule job. */ + server_job= gearman_server_job_add_reducer(Server, + (char *)(packet->arg[0]), packet->arg_size[0] -1, // Function + (char *)(packet->arg[1]), packet->arg_size[1] -1, // unique + (char *)(packet->arg[2]), packet->arg_size[2] -1, // reducer + packet->data, packet->data_size, map_priority, + server_client, &ret, 0); + + if (gearmand_success(ret)) + { + packet->options.free_data= false; + } + else if (ret == GEARMAN_JOB_QUEUE_FULL) + { + gearman_server_client_free(server_client); + return _server_error_packet(server_con, "queue_full", + "Job queue is full"); + } + else if (ret != GEARMAN_JOB_EXISTS) + { + gearman_server_client_free(server_client); + gearmand_gerror("gearman_server_job_add", ret); + return ret; + } + + /* Queue the job created packet. */ + ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_JOB_CREATED, + server_job->job_handle, + (size_t)strlen(server_job->job_handle), + NULL); + if (gearmand_failed(ret)) + { + gearman_server_client_free(server_client); + gearmand_gerror("gearman_server_io_packet_add", ret); + return ret; + } + } break; /* Client requests. */ @@ -251,23 +183,28 @@ case GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG: case GEARMAN_COMMAND_SUBMIT_JOB_LOW: case GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG: + case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: if (packet->command == GEARMAN_COMMAND_SUBMIT_JOB || - packet->command == GEARMAN_COMMAND_SUBMIT_JOB_BG) + packet->command == GEARMAN_COMMAND_SUBMIT_JOB_BG || + packet->command == GEARMAN_COMMAND_SUBMIT_JOB_EPOCH) { - priority= GEARMAN_JOB_PRIORITY_NORMAL; + priority= GEARMAND_JOB_PRIORITY_NORMAL; } else if (packet->command == GEARMAN_COMMAND_SUBMIT_JOB_HIGH || packet->command == GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG) { - priority= GEARMAN_JOB_PRIORITY_HIGH; + priority= GEARMAND_JOB_PRIORITY_HIGH; } else - priority= GEARMAN_JOB_PRIORITY_LOW; + { + priority= GEARMAND_JOB_PRIORITY_LOW; + } if (packet->command == GEARMAN_COMMAND_SUBMIT_JOB_BG || packet->command == GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG || - packet->command == GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG) + packet->command == GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG || + packet->command == GEARMAN_COMMAND_SUBMIT_JOB_EPOCH) { server_client= NULL; } @@ -275,28 +212,59 @@ { server_client= gearman_server_client_add(server_con); if (server_client == NULL) + { return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } } - /* Create a job. */ - server_job= gearman_server_job_add(server_con->thread->server, - (char *)(packet->arg[0]), - packet->arg_size[0] - 1, - (char *)(packet->arg[1]), - packet->arg_size[1] - 1, packet->data, - packet->data_size, priority, - server_client, &ret); - if (ret == GEARMAN_SUCCESS) + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Received submission, %.*s/%.*s with %d arguments", + packet->arg_size[0], packet->arg[0], + packet->arg_size[1], packet->arg[1], + (int)packet->argc); + int64_t when= 0; + if (packet->command == GEARMAN_COMMAND_SUBMIT_JOB_EPOCH) + { + sscanf((char *)packet->arg[2], "%lld", (long long *)&when); + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Received EPOCH job submission, %.*s/%.*s, with data for %jd at %jd, args %d", + packet->arg_size[0], packet->arg[0], + packet->arg_size[1], packet->arg[1], + when, time(NULL), + (int)packet->argc); + } + + if (packet->arg_size[1] -1 > GEARMAN_UNIQUE_SIZE) + { + gearmand_gerror("unique value too large", GEARMAN_ARGUMENT_TOO_LARGE); + gearman_server_client_free(server_client); + return _server_error_packet(server_con, "job failure", "Unique value too large"); + } + + /* Schedule job. */ + server_job= gearman_server_job_add(Server, + (char *)(packet->arg[0]), packet->arg_size[0] -1, // Function + (char *)(packet->arg[1]), packet->arg_size[1] -1, // unique + packet->data, packet->data_size, priority, + server_client, &ret, + when); + + if (gearmand_success(ret)) { packet->options.free_data= false; } else if (ret == GEARMAN_JOB_QUEUE_FULL) { + gearman_server_client_free(server_client); return _server_error_packet(server_con, "queue_full", "Job queue is full"); } else if (ret != GEARMAN_JOB_EXISTS) + { + gearman_server_client_free(server_client); + gearmand_gerror("gearman_server_job_add", ret); return ret; + } /* Queue the job created packet. */ ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, @@ -304,58 +272,92 @@ server_job->job_handle, (size_t)strlen(server_job->job_handle), NULL); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearman_server_client_free(server_client); + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } break; case GEARMAN_COMMAND_GET_STATUS: - /* This may not be NULL terminated, so copy to make sure it is. */ - snprintf(job_handle, GEARMAN_JOB_HANDLE_SIZE, "%.*s", - (uint32_t)(packet->arg_size[0]), (char *)(packet->arg[0])); + { + /* This may not be NULL terminated, so copy to make sure it is. */ + checked_length= snprintf(job_handle, GEARMAND_JOB_HANDLE_SIZE, "%.*s", + (int)(packet->arg_size[0]), (char *)(packet->arg[0])); - server_job= gearman_server_job_get(server_con->thread->server, job_handle, NULL); + if (checked_length >= GEARMAND_JOB_HANDLE_SIZE || checked_length < 0) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", checked_length); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } - /* Queue status result packet. */ - if (server_job == NULL) - { - ret= gearman_server_io_packet_add(server_con, false, - GEARMAN_MAGIC_RESPONSE, - GEARMAN_COMMAND_STATUS_RES, job_handle, - (size_t)(strlen(job_handle) + 1), - "0", (size_t)2, "0", (size_t)2, "0", - (size_t)2, "0", (size_t)1, NULL); - } - else - { - snprintf(numerator_buffer, 11, "%u", server_job->numerator); - snprintf(denominator_buffer, 11, "%u", server_job->denominator); + server_job= gearman_server_job_get(Server, job_handle, NULL); - ret= gearman_server_io_packet_add(server_con, false, - GEARMAN_MAGIC_RESPONSE, - GEARMAN_COMMAND_STATUS_RES, job_handle, - (size_t)(strlen(job_handle) + 1), - "1", (size_t)2, - server_job->worker == NULL ? "0" : "1", - (size_t)2, numerator_buffer, - (size_t)(strlen(numerator_buffer) + 1), - denominator_buffer, - (size_t)strlen(denominator_buffer), - NULL); - } + /* Queue status result packet. */ + if (server_job == NULL) + { + ret= gearman_server_io_packet_add(server_con, false, + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_STATUS_RES, job_handle, + (size_t)(strlen(job_handle) + 1), + "0", (size_t)2, "0", (size_t)2, "0", + (size_t)2, "0", (size_t)1, NULL); + } + else + { + checked_length= snprintf(numerator_buffer, sizeof(numerator_buffer), "%u", server_job->numerator); + if ((size_t)checked_length >= sizeof(numerator_buffer) || checked_length < 0) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", checked_length); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } - if (ret != GEARMAN_SUCCESS) - return ret; + checked_length= snprintf(denominator_buffer, sizeof(denominator_buffer), "%u", server_job->denominator); + if ((size_t)checked_length >= sizeof(denominator_buffer) || checked_length < 0) + { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", checked_length); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + ret= gearman_server_io_packet_add(server_con, false, + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_STATUS_RES, job_handle, + (size_t)(strlen(job_handle) + 1), + "1", (size_t)2, + server_job->worker == NULL ? "0" : "1", + (size_t)2, numerator_buffer, + (size_t)(strlen(numerator_buffer) + 1), + denominator_buffer, + (size_t)strlen(denominator_buffer), + NULL); + } + + if (ret != GEARMAN_SUCCESS) + { + gearmand_gerror("gearman_server_io_packet_add", ret); + return ret; + } + } break; case GEARMAN_COMMAND_OPTION_REQ: /* This may not be NULL terminated, so copy to make sure it is. */ - snprintf(option, GEARMAN_OPTION_SIZE, "%.*s", - (uint32_t)(packet->arg_size[0]), (char *)(packet->arg[0])); + checked_length= snprintf(option, GEARMAN_OPTION_SIZE, "%.*s", + (int)(packet->arg_size[0]), (char *)(packet->arg[0])); - if (!strcasecmp(option, "exceptions")) + if (checked_length >= GEARMAN_OPTION_SIZE || checked_length < 0) { + gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", checked_length); + return _server_error_packet(server_con, "unknown_option", + "Server does not recognize given option"); + } + + if (! strcasecmp(option, "exceptions")) + { + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "'exceptions'"); server_con->is_exceptions= true; } else @@ -369,7 +371,10 @@ packet->arg[0], packet->arg_size[0], NULL); if (ret != GEARMAN_SUCCESS) + { + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } break; @@ -417,13 +422,17 @@ GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_NOOP, NULL); if (ret != GEARMAN_SUCCESS) + { + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } } break; case GEARMAN_COMMAND_GRAB_JOB: case GEARMAN_COMMAND_GRAB_JOB_UNIQ: + case GEARMAN_COMMAND_GRAB_JOB_ALL: server_con->is_sleeping= false; server_con->is_noop_sent= false; @@ -437,38 +446,72 @@ } else if (packet->command == GEARMAN_COMMAND_GRAB_JOB_UNIQ) { - /* We found a runnable job, queue job assigned packet and take the job - off the queue. */ + /* + We found a runnable job, queue job assigned packet and take the job off the queue. + */ + ret= gearman_server_io_packet_add(server_con, false, + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_JOB_ASSIGN_UNIQ, + server_job->job_handle, (size_t)(strlen(server_job->job_handle) + 1), + server_job->function->function_name, server_job->function->function_name_size + 1, + server_job->unique, (size_t)(strlen(server_job->unique) + 1), + server_job->data, server_job->data_size, + NULL); + } + else if (packet->command == GEARMAN_COMMAND_GRAB_JOB_ALL and server_job->reducer) + { + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Sending reduce submission, Partitioner: %.*s(%lu) Reducer: %.*s(%lu) Unique: %.*s(%lu) with data sized (%lu)" , + server_job->function->function_name_size, server_job->function->function_name, server_job->function->function_name_size, + strlen(server_job->reducer), server_job->reducer, strlen(server_job->reducer), + strlen(server_job->unique), server_job->unique, strlen(server_job->unique), + (unsigned long)server_job->data_size); + /* + We found a runnable job, queue job assigned packet and take the job off the queue. + */ ret= gearman_server_io_packet_add(server_con, false, - GEARMAN_MAGIC_RESPONSE, - GEARMAN_COMMAND_JOB_ASSIGN_UNIQ, - server_job->job_handle, - (size_t)(strlen(server_job->job_handle) + 1), - server_job->function->function_name, - server_job->function->function_name_size + 1, - server_job->unique, - (size_t)(strlen(server_job->unique) + 1), - server_job->data, server_job->data_size, - NULL); + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_JOB_ASSIGN_ALL, + server_job->job_handle, (size_t)(strlen(server_job->job_handle) + 1), + server_job->function->function_name, server_job->function->function_name_size + 1, + server_job->unique, (size_t)(strlen(server_job->unique) + 1), + server_job->reducer, (size_t)(strlen(server_job->reducer) +1), + server_job->data, server_job->data_size, + NULL); + } + else if (packet->command == GEARMAN_COMMAND_GRAB_JOB_ALL) + { + /* + We found a runnable job, queue job assigned packet and take the job off the queue. + */ + ret= gearman_server_io_packet_add(server_con, false, + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_JOB_ASSIGN_UNIQ, + server_job->job_handle, (size_t)(strlen(server_job->job_handle) +1), + server_job->function->function_name, server_job->function->function_name_size +1, + server_job->unique, (size_t)(strlen(server_job->unique) +1), + server_job->data, server_job->data_size, + NULL); } else { /* Same, but without unique ID. */ ret= gearman_server_io_packet_add(server_con, false, - GEARMAN_MAGIC_RESPONSE, - GEARMAN_COMMAND_JOB_ASSIGN, - server_job->job_handle, - (size_t)(strlen(server_job->job_handle) + 1), - server_job->function->function_name, - server_job->function->function_name_size + 1, - server_job->data, server_job->data_size, - NULL); + GEARMAN_MAGIC_RESPONSE, + GEARMAN_COMMAND_JOB_ASSIGN, + server_job->job_handle, (size_t)(strlen(server_job->job_handle) + 1), + server_job->function->function_name, server_job->function->function_name_size + 1, + server_job->data, server_job->data_size, + NULL); } - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) { - if (server_job != NULL) + gearmand_gerror("gearman_server_io_packet_add", ret); + + if (server_job) return gearman_server_job_queue(server_job); + return ret; } @@ -476,7 +519,7 @@ case GEARMAN_COMMAND_WORK_DATA: case GEARMAN_COMMAND_WORK_WARNING: - server_job= gearman_server_job_get(server_con->thread->server, + server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), server_con); if (server_job == NULL) @@ -487,13 +530,16 @@ /* Queue the data/warning packet for all clients. */ ret= _server_queue_work_data(server_job, packet, packet->command); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearmand_gerror("_server_queue_work_data", ret); return ret; + } break; case GEARMAN_COMMAND_WORK_STATUS: - server_job= gearman_server_job_get(server_con->thread->server, + server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), server_con); if (server_job == NULL) @@ -506,8 +552,16 @@ server_job->numerator= (uint32_t)atoi((char *)(packet->arg[1])); /* This may not be NULL terminated, so copy to make sure it is. */ - snprintf(denominator_buffer, 11, "%.*s", (uint32_t)(packet->arg_size[2]), - (char *)(packet->arg[2])); + checked_length= snprintf(denominator_buffer, sizeof(denominator_buffer), "%.*s", (int)(packet->arg_size[2]), + (char *)(packet->arg[2])); + + if ((size_t)checked_length > sizeof(denominator_buffer) || checked_length < 0) + { + gearmand_error("snprintf"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + server_job->denominator= (uint32_t)atoi(denominator_buffer); /* Queue the status packet for all clients. */ @@ -521,14 +575,17 @@ packet->arg[1], packet->arg_size[1], packet->arg[2], packet->arg_size[2], NULL); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } } break; case GEARMAN_COMMAND_WORK_COMPLETE: - server_job= gearman_server_job_get(server_con->thread->server, + server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), server_con); if (server_job == NULL) @@ -540,19 +597,25 @@ /* Queue the complete packet for all clients. */ ret= _server_queue_work_data(server_job, packet, GEARMAN_COMMAND_WORK_COMPLETE); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearmand_gerror("_server_queue_work_data", ret); return ret; + } /* Remove from persistent queue if one exists. */ - if (server_job->job_queued && server->queue_done_fn != NULL) + if (server_job->job_queued && Server->queue._done_fn != NULL) { - ret= (*(server->queue_done_fn))(server, (void *)server->queue_context, - server_job->unique, - (size_t)strlen(server_job->unique), - server_job->function->function_name, - server_job->function->function_name_size); - if (ret != GEARMAN_SUCCESS) + ret= (*(Server->queue._done_fn))(Server, (void *)Server->queue._context, + server_job->unique, + (size_t)strlen(server_job->unique), + server_job->function->function_name, + server_job->function->function_name_size); + if (gearmand_failed(ret)) + { + gearmand_gerror("Remove from persistent queue", ret); return ret; + } } /* Job is done, remove it. */ @@ -560,7 +623,7 @@ break; case GEARMAN_COMMAND_WORK_EXCEPTION: - server_job= gearman_server_job_get(server_con->thread->server, + server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), server_con); if (server_job == NULL) @@ -572,16 +635,25 @@ /* Queue the exception packet for all clients. */ ret= _server_queue_work_data(server_job, packet, GEARMAN_COMMAND_WORK_EXCEPTION); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearmand_gerror("_server_queue_work_data", ret); return ret; + } break; case GEARMAN_COMMAND_WORK_FAIL: /* This may not be NULL terminated, so copy to make sure it is. */ - snprintf(job_handle, GEARMAN_JOB_HANDLE_SIZE, "%.*s", - (uint32_t)(packet->arg_size[0]), (char *)(packet->arg[0])); + checked_length= snprintf(job_handle, GEARMAND_JOB_HANDLE_SIZE, "%.*s", + (int)(packet->arg_size[0]), (char *)(packet->arg[0])); + + if (checked_length >= GEARMAND_JOB_HANDLE_SIZE || checked_length < 0) + { + return _server_error_packet(server_con, "job_name_too_large", + "Error occured due to GEARMAND_JOB_HANDLE_SIZE being too small from snprintf"); + } - server_job= gearman_server_job_get(server_con->thread->server, job_handle, + server_job= gearman_server_job_get(Server, job_handle, server_con); if (server_job == NULL) { @@ -598,24 +670,31 @@ GEARMAN_COMMAND_WORK_FAIL, packet->arg[0], packet->arg_size[0], NULL); - if (ret != GEARMAN_SUCCESS) + if (gearmand_failed(ret)) + { + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } } /* Remove from persistent queue if one exists. */ - if (server_job->job_queued && server->queue_done_fn != NULL) + if (server_job->job_queued && Server->queue._done_fn != NULL) { - ret= (*(server->queue_done_fn))(server, (void *)server->queue_context, - server_job->unique, - (size_t)strlen(server_job->unique), - server_job->function->function_name, - server_job->function->function_name_size); - if (ret != GEARMAN_SUCCESS) + ret= (*(Server->queue._done_fn))(Server, (void *)Server->queue._context, + server_job->unique, + (size_t)strlen(server_job->unique), + server_job->function->function_name, + server_job->function->function_name_size); + if (gearmand_failed(ret)) + { + gearmand_gerror("Remove from persistent queue", ret); return ret; + } } /* Job is done, remove it. */ gearman_server_job_free(server_job); + break; case GEARMAN_COMMAND_SET_CLIENT_ID: @@ -637,18 +716,17 @@ case GEARMAN_COMMAND_ALL_YOURS: case GEARMAN_COMMAND_OPTION_RES: case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: - case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: + case GEARMAN_COMMAND_JOB_ASSIGN_ALL: case GEARMAN_COMMAND_MAX: default: - return _server_error_packet(server_con, "bad_command", - "Command not expected"); + return _server_error_packet(server_con, "bad_command", "Command not expected"); } return GEARMAN_SUCCESS; } -gearman_return_t gearman_server_shutdown_graceful(gearman_server_st *server) +gearmand_error_t gearman_server_shutdown_graceful(gearman_server_st *server) { server->shutdown_graceful= true; @@ -658,17 +736,17 @@ return GEARMAN_SHUTDOWN_GRACEFUL; } -gearman_return_t gearman_server_queue_replay(gearman_server_st *server) +gearmand_error_t gearman_server_queue_replay(gearman_server_st *server) { - gearman_return_t ret; + gearmand_error_t ret; - if (server->queue_replay_fn == NULL) + if (server->queue._replay_fn == NULL) return GEARMAN_SUCCESS; server->state.queue_startup= true; - ret= (*(server->queue_replay_fn))(server, (void *)server->queue_context, - _queue_replay_add, server); + ret= (*(server->queue._replay_fn))(server, (void *)server->queue._context, + _queue_replay_add, server); server->state.queue_startup= false; @@ -677,60 +755,49 @@ void *gearman_server_queue_context(const gearman_server_st *server) { - return (void *)server->queue_context; + return (void *)server->queue._context; } -void gearman_server_set_queue_context(gearman_server_st *server, - void *context) +void gearman_server_set_queue(gearman_server_st *server, + void *context, + gearman_queue_add_fn *add, + gearman_queue_flush_fn *flush, + gearman_queue_done_fn *done, + gearman_queue_replay_fn *replay) { - server->queue_context= context; -} - -void gearman_server_set_queue_add_fn(gearman_server_st *server, - gearman_queue_add_fn *function) -{ - server->queue_add_fn= function; -} - -void gearman_server_set_queue_flush_fn(gearman_server_st *server, - gearman_queue_flush_fn *function) -{ - server->queue_flush_fn= function; -} - -void gearman_server_set_queue_done_fn(gearman_server_st *server, - gearman_queue_done_fn *function) -{ - server->queue_done_fn= function; -} - -void gearman_server_set_queue_replay_fn(gearman_server_st *server, - gearman_queue_replay_fn *function) -{ - server->queue_replay_fn= function; + server->queue._context= context; + server->queue._add_fn= add; + server->queue._flush_fn= flush; + server->queue._done_fn= done; + server->queue._replay_fn= replay; } /* * Private definitions */ -gearman_return_t _queue_replay_add(gearman_server_st *server, +gearmand_error_t _queue_replay_add(gearman_server_st *server, void *context __attribute__ ((unused)), - const void *unique, size_t unique_size, - const void *function_name, - size_t function_name_size, const void *data, - size_t data_size, - gearman_job_priority_t priority) + const char *unique, size_t unique_size, + const char *function_name, size_t function_name_size, + const void *data, size_t data_size, + gearmand_job_priority_t priority, + int64_t when) { - gearman_return_t ret; + gearmand_error_t ret= GEARMAN_SUCCESS; + + (void)gearman_server_job_add(server, + function_name, function_name_size, + unique, unique_size, + data, data_size, priority, NULL, &ret, when); + + if (ret != GEARMAN_SUCCESS) + gearmand_gerror("gearman_server_job_add", ret); - (void)gearman_server_job_add(server, (char *)function_name, - function_name_size, (char *)unique, unique_size, - data, data_size, priority, NULL, &ret); return ret; } -static gearman_return_t _server_error_packet(gearman_server_con_st *server_con, +static gearmand_error_t _server_error_packet(gearman_server_con_st *server_con, const char *error_code, const char *error_string) { @@ -741,8 +808,8 @@ (size_t)strlen(error_string), NULL); } -static gearman_return_t _server_run_text(gearman_server_con_st *server_con, - gearman_packet_st *packet) +static gearmand_error_t _server_run_text(gearman_server_con_st *server_con, + gearmand_packet_st *packet) { char *data; char *new_data; @@ -752,86 +819,139 @@ gearman_server_thread_st *thread; gearman_server_con_st *con; gearman_server_worker_st *worker; - gearman_server_function_st *function; gearman_server_packet_st *server_packet; + int checked_length; - data= (char *)malloc(GEARMAN_TEXT_RESPONSE_SIZE); + data= (char *)(char *)malloc(GEARMAN_TEXT_RESPONSE_SIZE); if (data == NULL) { - gearman_log_error(packet->universal, "_server_run_text", "malloc"); + gearmand_perror("malloc"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } total= GEARMAN_TEXT_RESPONSE_SIZE; + data[0]= 0; + + if (packet->argc) + { + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "text command %.*s", packet->arg_size[0], packet->arg[0]); + } if (packet->argc == 0) { - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, - "ERR unknown_command Unknown+server+command\n"); + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_UNKNOWN_COMMAND, 4, "NULL"); } else if (!strcasecmp("workers", (char *)(packet->arg[0]))) { size= 0; - for (thread= server_con->thread->server->thread_list; thread != NULL; + for (thread= Server->thread_list; thread != NULL; thread= thread->next) { - (void) pthread_mutex_lock(&thread->lock); - - for (con= thread->con_list; con != NULL; con= con->next) + int error; + if (! (error= pthread_mutex_lock(&thread->lock))) { - if (con->host == NULL) - continue; + for (con= thread->con_list; con != NULL; con= con->next) + { + if (con->_host == NULL) + continue; - if (size > total) - size= total; + if (size > total) + size= total; - /* Make sure we have at least GEARMAN_TEXT_RESPONSE_SIZE bytes. */ - if (size + GEARMAN_TEXT_RESPONSE_SIZE > total) - { - new_data= (char *)realloc(data, total + GEARMAN_TEXT_RESPONSE_SIZE); - if (new_data == NULL) + /* Make sure we have at least GEARMAN_TEXT_RESPONSE_SIZE bytes. */ + if (size + GEARMAN_TEXT_RESPONSE_SIZE > total) + { + new_data= (char *)realloc(data, total + GEARMAN_TEXT_RESPONSE_SIZE); + if (new_data == NULL) + { + (void) pthread_mutex_unlock(&thread->lock); + gearmand_perror("realloc"); + gearmand_crazy("free"); + free(data); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + data= new_data; + total+= GEARMAN_TEXT_RESPONSE_SIZE; + } + + checked_length= snprintf(data + size, total - size, "%d %s %s :", + con->con.fd, con->_host, con->id); + + if ((size_t)checked_length > total - size || checked_length < 0) { (void) pthread_mutex_unlock(&thread->lock); + gearmand_crazy("free"); free(data); - gearman_log_error(packet->universal, "_server_run_text", "malloc"); + gearmand_perror("snprintf"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } - data= new_data; - total+= GEARMAN_TEXT_RESPONSE_SIZE; - } + size+= (size_t)checked_length; + if (size > total) + continue; - size+= (size_t)snprintf(data + size, total - size, "%d %s %s :", - con->con.fd, con->host, con->id); - if (size > total) - continue; + for (worker= con->worker_list; worker != NULL; worker= worker->con_next) + { + checked_length= snprintf(data + size, total - size, " %.*s", + (int)(worker->function->function_name_size), + worker->function->function_name); + + if ((size_t)checked_length > total - size || checked_length < 0) + { + (void) pthread_mutex_unlock(&thread->lock); + gearmand_crazy("free"); + free(data); + gearmand_perror("snprintf"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + size+= (size_t)checked_length; + if (size > total) + break; + } - for (worker= con->worker_list; worker != NULL; worker= worker->con_next) - { - size+= (size_t)snprintf(data + size, total - size, " %.*s", - (int)(worker->function->function_name_size), - worker->function->function_name); if (size > total) - break; - } + continue; - if (size > total) - continue; + checked_length= snprintf(data + size, total - size, "\n"); + if ((size_t)checked_length > total - size || checked_length < 0) + { + (void) pthread_mutex_unlock(&thread->lock); + gearmand_crazy("free"); + free(data); + gearmand_perror("snprintf"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + size+= (size_t)checked_length; + } - size+= (size_t)snprintf(data + size, total - size, "\n"); + (void) pthread_mutex_unlock(&thread->lock); + } + else + { + errno= error; + gearmand_error("pthread_mutex_lock"); + assert(! "pthread_mutex_lock"); } - - (void) pthread_mutex_unlock(&thread->lock); } if (size < total) - snprintf(data + size, total - size, ".\n"); + { + checked_length= snprintf(data + size, total - size, ".\n"); + if ((size_t)checked_length > total - size || checked_length < 0) + { + gearmand_perror("snprintf"); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + } } else if (!strcasecmp("status", (char *)(packet->arg[0]))) { size= 0; - for (function= server_con->thread->server->function_list; function != NULL; + gearman_server_function_st *function; + for (function= Server->function_list; function != NULL; function= function->next) { if (size + GEARMAN_TEXT_RESPONSE_SIZE > total) @@ -839,8 +959,9 @@ new_data= (char *)realloc(data, total + GEARMAN_TEXT_RESPONSE_SIZE); if (new_data == NULL) { + gearmand_perror("realloc"); + gearmand_crazy("free"); free(data); - gearman_log_error(packet->universal, "_server_run_text", "malloc"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } @@ -848,23 +969,99 @@ total+= GEARMAN_TEXT_RESPONSE_SIZE; } - size+= (size_t)snprintf(data + size, total - size, "%.*s\t%u\t%u\t%u\n", - (int)(function->function_name_size), - function->function_name, function->job_total, - function->job_running, function->worker_count); + checked_length= snprintf(data + size, total - size, "%.*s\t%u\t%u\t%u\n", + (int)(function->function_name_size), + function->function_name, function->job_total, + function->job_running, function->worker_count); + + if ((size_t)checked_length > total - size || checked_length < 0) + { + gearmand_perror("snprintf"); + gearmand_crazy("free"); + free(data); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + + size+= (size_t)checked_length; if (size > total) size= total; } if (size < total) - snprintf(data + size, total - size, ".\n"); + { + checked_length= snprintf(data + size, total - size, ".\n"); + if ((size_t)checked_length > total - size || checked_length < 0) + { + gearmand_perror("snprintf"); + gearmand_crazy("free"); + free(data); + return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } + } + } + else if (!strcasecmp("create", (char *)(packet->arg[0]))) + { + if (packet->argc == 3 && !strcasecmp("function", (char *)(packet->arg[1]))) + { + gearman_server_function_st *function; + function= gearman_server_function_get(Server, (char *)(packet->arg[2]), packet->arg_size[2] -2); + + if (function) + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_SUCCESS); + } + else + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_CREATE_FUNCTION, + (int)packet->arg_size[2], (char *)(packet->arg[2])); + } + } + else + { + // create + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); + } + } + else if (! strcasecmp("drop", (char *)(packet->arg[0]))) + { + if (packet->argc == 3 && !strcasecmp("function", (char *)(packet->arg[1]))) + { + bool success= false; + for (gearman_server_function_st *function= Server->function_list; function != NULL; function= function->next) + { + if (! strcasecmp(function->function_name, (char *)(packet->arg[2]))) + { + success++; + if (function->worker_count == 0 && function->job_running == 0) + { + gearman_server_function_free(Server, function); + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_SUCCESS); + } + else + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "ERR there are still connected workers or executing clients\r\n"); + } + break; + } + } + + if (! success) + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "ERR function not found\r\n"); + gearmand_debug(data); + } + } + else + { + // drop + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); + } } else if (!strcasecmp("maxqueue", (char *)(packet->arg[0]))) { if (packet->argc == 1) { - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "ERR incomplete_args " - "An+incomplete+set+of+arguments+was+sent+to+this+command\n"); + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); } else { @@ -877,7 +1074,8 @@ max_queue_size= 0; } - for (function= server_con->thread->server->function_list; + gearman_server_function_st *function; + for (function= Server->function_list; function != NULL; function= function->next) { if (strlen((char *)(packet->arg[1])) == function->function_name_size && @@ -888,83 +1086,103 @@ } } - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "OK\n"); + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_SUCCESS); } } else if (!strcasecmp("shutdown", (char *)(packet->arg[0]))) { if (packet->argc == 1) { - server_con->thread->server->shutdown= true; - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "OK\n"); + Server->shutdown= true; + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_SUCCESS); } else if (packet->argc == 2 && !strcasecmp("graceful", (char *)(packet->arg[1]))) { - server_con->thread->server->shutdown_graceful= true; - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "OK\n"); + Server->shutdown_graceful= true; + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_SUCCESS); } else { - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, - "ERR unknown_args Unknown+arguments+to+server+command\n"); + // shutdown + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); } } + else if (!strcasecmp("verbose", (char *)(packet->arg[0]))) + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "OK %s\n", gearmand_verbose_name(Gearmand()->verbose)); + } else if (!strcasecmp("version", (char *)(packet->arg[0]))) - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "%s\n", PACKAGE_VERSION); + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, "OK %s\n", PACKAGE_VERSION); + } else { - snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, - "ERR unknown_command Unknown+server+command\n"); + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Failed to find command %.*s(%llu)", packet->arg_size[0], packet->arg[0], + (unsigned long long)packet->arg_size[0]); + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_UNKNOWN_COMMAND, (int)packet->arg_size[0], (char *)(packet->arg[0])); } server_packet= gearman_server_packet_create(server_con->thread, false); if (server_packet == NULL) { + gearmand_crazy("free"); free(data); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } - if (gearman_packet_create(server_con->thread->gearman, - &(server_packet->packet)) == NULL) - { - free(data); - gearman_server_packet_free(server_packet, server_con->thread, false); - return GEARMAN_MEMORY_ALLOCATION_FAILURE; - } + gearmand_packet_init(&(server_packet->packet), GEARMAN_MAGIC_TEXT, GEARMAN_COMMAND_TEXT); server_packet->packet.magic= GEARMAN_MAGIC_TEXT; server_packet->packet.command= GEARMAN_COMMAND_TEXT; server_packet->packet.options.complete= true; server_packet->packet.options.free_data= true; + if (data[0] == 0) + { + snprintf(data, GEARMAN_TEXT_RESPONSE_SIZE, TEXT_ERROR_INTERNAL_ERROR); + } server_packet->packet.data= data; server_packet->packet.data_size= strlen(data); - (void) pthread_mutex_lock(&server_con->thread->lock); - GEARMAN_FIFO_ADD(server_con->io_packet, server_packet,) - (void) pthread_mutex_unlock(&server_con->thread->lock); + int error; + if (! (error= pthread_mutex_lock(&server_con->thread->lock))) + { + GEARMAN_FIFO_ADD(server_con->io_packet, server_packet,); + (void) pthread_mutex_unlock(&server_con->thread->lock); + } + else + { + errno= error; + gearmand_perror("pthread_mutex_lock"); + assert(!"pthread_mutex_lock"); + } gearman_server_con_io_add(server_con); return GEARMAN_SUCCESS; } -static gearman_return_t +static gearmand_error_t _server_queue_work_data(gearman_server_job_st *server_job, - gearman_packet_st *packet, gearman_command_t command) + gearmand_packet_st *packet, gearman_command_t command) { gearman_server_client_st *server_client; uint8_t *data; - gearman_return_t ret; + gearmand_error_t ret; for (server_client= server_job->client_list; server_client; server_client= server_client->job_next) { if (command == GEARMAN_COMMAND_WORK_EXCEPTION && !(server_client->con->is_exceptions)) { + gearmand_debug("Dropping GEARMAN_COMMAND_WORK_EXCEPTION"); continue; } + else if (command == GEARMAN_COMMAND_WORK_EXCEPTION) + { + gearmand_debug("Sending GEARMAN_COMMAND_WORK_EXCEPTION"); + } if (packet->data_size > 0) { @@ -979,7 +1197,7 @@ data= (uint8_t *)malloc(packet->data_size); if (data == NULL) { - gearman_log_error(packet->universal, "_server_run_command", "malloc"); + gearmand_perror("malloc"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } @@ -987,21 +1205,20 @@ } } else + { data= NULL; + } ret= gearman_server_io_packet_add(server_client->con, true, GEARMAN_MAGIC_RESPONSE, command, packet->arg[0], packet->arg_size[0], data, packet->data_size, NULL); if (ret != GEARMAN_SUCCESS) + { + gearmand_gerror("gearman_server_io_packet_add", ret); return ret; + } } return GEARMAN_SUCCESS; } - -static void _log(const char *line, gearman_verbose_t verbose, void *context) -{ - gearman_server_st *server= (gearman_server_st *)context; - (*(server->log_fn))(line, verbose, (void *)server->log_context); -} diff -Nru gearmand-0.14/libgearman-server/server.h gearmand-0.23/libgearman-server/server.h --- gearmand-0.14/libgearman-server/server.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/server.h 2011-03-08 07:00:29.000000000 +0100 @@ -18,6 +18,8 @@ extern "C" { #endif +#include + /** * @addtogroup gearman_server Gearman Server Declarations * This is the interface gearman servers should use. @@ -27,9 +29,11 @@ struct gearman_server_st { struct { - bool allocated; - } options; - struct { + /* + Sets the round-robin mode on the server object. RR will distribute work + fairly among every function assigned to a worker, instead of draining + each function before moving on to the next. + */ bool round_robin; bool threaded; } flags; @@ -40,8 +44,8 @@ bool shutdown_graceful; bool proc_wakeup; bool proc_shutdown; - uint8_t job_retries; - uint8_t worker_wakeup; + uint8_t job_retries; // Set maximum job retry count. + uint8_t worker_wakeup; // Set maximum number of workers to wake up per job. uint32_t job_handle_count; uint32_t thread_count; uint32_t function_count; @@ -51,79 +55,32 @@ uint32_t free_job_count; uint32_t free_client_count; uint32_t free_worker_count; - gearman_universal_st *gearman; gearman_server_thread_st *thread_list; gearman_server_function_st *function_list; gearman_server_packet_st *free_packet_list; gearman_server_job_st *free_job_list; gearman_server_client_st *free_client_list; gearman_server_worker_st *free_worker_list; - gearman_log_fn *log_fn; - void *log_context; - void *queue_context; - gearman_queue_add_fn *queue_add_fn; - gearman_queue_flush_fn *queue_flush_fn; - gearman_queue_done_fn *queue_done_fn; - gearman_queue_replay_fn *queue_replay_fn; - gearman_universal_st gearman_universal_static; + struct { + void *_context; + gearman_queue_add_fn *_add_fn; + gearman_queue_flush_fn *_flush_fn; + gearman_queue_done_fn *_done_fn; + gearman_queue_replay_fn *_replay_fn; + } queue; pthread_mutex_t proc_lock; pthread_cond_t proc_cond; pthread_t proc_id; - char job_handle_prefix[GEARMAN_JOB_HANDLE_SIZE]; - gearman_server_job_st *job_hash[GEARMAN_JOB_HASH_SIZE]; - gearman_server_job_st *unique_hash[GEARMAN_JOB_HASH_SIZE]; + char job_handle_prefix[GEARMAND_JOB_HANDLE_SIZE]; + gearman_server_job_st *job_hash[GEARMAND_JOB_HASH_SIZE]; + gearman_server_job_st *unique_hash[GEARMAND_JOB_HASH_SIZE]; }; -/** - * Initialize a server structure. This cannot fail if the caller supplies a - * server structure. - * @param server Caller allocated server structure, or NULL to allocate one. - * @return Pointer to an allocated server structure if server parameter was - * NULL, or the server parameter pointer if it was not NULL. - */ -GEARMAN_API -gearman_server_st *gearman_server_create(gearman_server_st *server); - -/** - * Free resources used by a server structure. - * @param server Server structure previously initialized with - * gearman_server_create. - */ -GEARMAN_API -void gearman_server_free(gearman_server_st *server); - -/** - * Set maximum job retry count. - * @param server Server structure previously initialized with - * gearman_server_create. - * @param job_retries Number of job attempts. - */ -GEARMAN_API -void gearman_server_set_job_retries(gearman_server_st *server, - uint8_t job_retries); - -/** - * Set maximum number of workers to wake up per job. - * @param server Server structure previously initialized with - * gearman_server_create. - * @param worker_wakeup Number of workers to wake up. - */ -GEARMAN_API -void gearman_server_set_worker_wakeup(gearman_server_st *server, - uint8_t worker_wakeup); -/** - * Set logging callback for server instance. - * @param server Server structure previously initialized with - * gearman_server_create. - * @param function Function to call when there is a logging message. - * @param context Argument to pass into the log callback function. - * @param verbose Verbosity level. - */ -GEARMAN_API -void gearman_server_set_log_fn(gearman_server_st *server, - gearman_log_fn *function, - void *context, gearman_verbose_t verbose); +inline static void gearmand_set_round_robin(gearman_server_st *server, bool round_robin) +{ + server->flags.round_robin= round_robin; +} /** * Process commands for a connection. @@ -132,8 +89,8 @@ * @return Standard gearman return value. */ GEARMAN_API -gearman_return_t gearman_server_run_command(gearman_server_con_st *server_con, - gearman_packet_st *packet); +gearmand_error_t gearman_server_run_command(gearman_server_con_st *server_con, + gearmand_packet_st *packet); /** * Tell server that it should enter a graceful shutdown state. @@ -143,7 +100,7 @@ * the server is ready to shutdown now. */ GEARMAN_API -gearman_return_t gearman_server_shutdown_graceful(gearman_server_st *server); +gearmand_error_t gearman_server_shutdown_graceful(gearman_server_st *server); /** * Replay the persistent queue to load all unfinshed jobs into the server. This @@ -154,7 +111,7 @@ * the server is ready to shutdown now. */ GEARMAN_API -gearman_return_t gearman_server_queue_replay(gearman_server_st *server); +gearmand_error_t gearman_server_queue_replay(gearman_server_st *server); /** * Get persistent queue context. @@ -167,37 +124,12 @@ * functions. */ GEARMAN_API -void gearman_server_set_queue_context(gearman_server_st *server, - void *context); - -/** - * Set function to call when jobs need to be stored in the persistent queue. - */ -GEARMAN_API -void gearman_server_set_queue_add_fn(gearman_server_st *server, - gearman_queue_add_fn *function); - -/** - * Set function to call when the persistent queue should be flushed to disk. - */ -GEARMAN_API -void gearman_server_set_queue_flush_fn(gearman_server_st *server, - gearman_queue_flush_fn *function); - -/** - * Set function to call when a job should be removed from the persistent queue. - */ -GEARMAN_API -void gearman_server_set_queue_done_fn(gearman_server_st *server, - gearman_queue_done_fn *function); - -/** - * Set function to call when jobs in the persistent queue should be replayed - * after a restart. - */ -GEARMAN_API -void gearman_server_set_queue_replay_fn(gearman_server_st *server, - gearman_queue_replay_fn *function); +void gearman_server_set_queue(gearman_server_st *server, + void *context, + gearman_queue_add_fn *add, + gearman_queue_flush_fn *flush, + gearman_queue_done_fn *done, + gearman_queue_replay_fn *replay); /** @} */ diff -Nru gearmand-0.14/libgearman-server/thread.c gearmand-0.23/libgearman-server/thread.c --- gearmand-0.14/libgearman-server/thread.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/thread.c 2011-06-03 04:13:30.000000000 +0200 @@ -11,7 +11,22 @@ * @brief Server Thread Definitions */ -#include "common.h" +#include + +#define GEARMAN_CORE +#include + +#ifdef __cplusplus + +#include +#include + +#else + +#include +#include + +#endif /* * Private declarations @@ -26,17 +41,17 @@ /** * Try reading packets for a connection. */ -gearman_return_t _thread_packet_read(gearman_server_con_st *con); +static gearmand_error_t _thread_packet_read(gearman_server_con_st *con); /** * Flush outgoing packets for a connection. */ -static gearman_return_t _thread_packet_flush(gearman_server_con_st *con); +static gearmand_error_t _thread_packet_flush(gearman_server_con_st *con); /** * Start processing thread for the server. */ -static gearman_return_t _proc_thread_start(gearman_server_st *server); +static gearmand_error_t _proc_thread_start(gearman_server_st *server); /** * Kill processing thread for the server. @@ -48,42 +63,27 @@ */ static void *_proc(void *data); -/** - * Wrapper for log handling. - */ -static void _log(const char *line, gearman_verbose_t verbose, void *context); - /** @} */ /* * Public definitions */ -gearman_server_thread_st * -gearman_server_thread_create(gearman_server_st *server, - gearman_server_thread_st *thread) +bool gearman_server_thread_init(gearman_server_st *server, + gearman_server_thread_st *thread, + gearman_log_server_fn *log_function, + gearmand_thread_st *context, + gearmand_event_watch_fn *event_watch) { + assert(server); + assert(thread); if (server->thread_count == 1) { /* The server is going to be multi-threaded, start processing thread. */ if (_proc_thread_start(server) != GEARMAN_SUCCESS) - return NULL; - } - - if (thread == NULL) - { - thread= (gearman_server_thread_st *)malloc(sizeof(gearman_server_thread_st)); - if (thread == NULL) { - _proc_thread_kill(server); - return NULL; + return false; } - - thread->options.allocated= true; - } - else - { - thread->options.allocated= false; } thread->con_count= 0; @@ -91,9 +91,8 @@ thread->proc_count= 0; thread->free_con_count= 0; thread->free_packet_count= 0; - thread->server= server; - thread->log_fn= NULL; - thread->log_context= NULL; + thread->log_fn= log_function; + thread->log_context= context; thread->run_fn= NULL; thread->run_fn_arg= NULL; thread->con_list= NULL; @@ -102,25 +101,20 @@ thread->free_con_list= NULL; thread->free_packet_list= NULL; - if (pthread_mutex_init(&(thread->lock), NULL) != 0) + int error; + if ((error= pthread_mutex_init(&(thread->lock), NULL))) { - if (thread->options.allocated) - free(thread); - - return NULL; + errno= error; + gearmand_perror("pthread_mutex_init"); + return false; } GEARMAN_LIST_ADD(server->thread, thread,); - gearman_universal_options_t options[]= { GEARMAN_NON_BLOCKING, GEARMAN_DONT_TRACK_PACKETS, GEARMAN_MAX}; - thread->gearman= gearman_universal_create(&(thread->gearman_universal_static), options); - if (thread->gearman == NULL) - { - gearman_server_thread_free(thread); - return NULL; - } + thread->gearman= &(thread->gearmand_connection_list_static); + gearmand_connection_list_init(thread->gearman, event_watch, NULL); - return thread; + return true; } void gearman_server_thread_free(gearman_server_thread_st *thread) @@ -128,15 +122,18 @@ gearman_server_con_st *con; gearman_server_packet_st *packet; - _proc_thread_kill(thread->server); + _proc_thread_kill(Server); while (thread->con_list != NULL) + { gearman_server_con_free(thread->con_list); + } while (thread->free_con_list != NULL) { con= thread->free_con_list; thread->free_con_list= con->next; + gearmand_crazy("free"); free(con); } @@ -144,35 +141,16 @@ { packet= thread->free_packet_list; thread->free_packet_list= packet->next; + gearmand_crazy("free"); free(packet); } if (thread->gearman != NULL) - gearman_universal_free(thread->gearman); + gearman_connection_list_free(thread->gearman); pthread_mutex_destroy(&(thread->lock)); - GEARMAN_LIST_DEL(thread->server->thread, thread,) - - if (thread->options.allocated) - free(thread); -} - -const char *gearman_server_thread_error(gearman_server_thread_st *thread) -{ - return gearman_universal_error(thread->gearman); -} - -int gearman_server_thread_errno(gearman_server_thread_st *thread) -{ - return gearman_universal_errno(thread->gearman); -} - -void gearman_server_thread_set_event_watch(gearman_server_thread_st *thread, - gearman_event_watch_fn *event_watch, - void *event_watch_arg) -{ - gearman_set_event_watch_fn(thread->gearman, event_watch, event_watch_arg); + GEARMAN_LIST_DEL(Server->thread, thread,) } void gearman_server_thread_set_run(gearman_server_thread_st *thread, @@ -183,33 +161,24 @@ thread->run_fn_arg= run_fn_arg; } -void gearman_server_thread_set_log_fn(gearman_server_thread_st *thread, - gearman_log_fn *function, - void *context, - gearman_verbose_t verbose) -{ - thread->log_fn= function; - thread->log_context= context; - gearman_set_log_fn(thread->gearman, _log, thread, verbose); -} - -gearman_server_con_st * +gearmand_con_st * gearman_server_thread_run(gearman_server_thread_st *thread, - gearman_return_t *ret_ptr) + gearmand_error_t *ret_ptr) { - gearman_connection_st *con; - gearman_server_con_st *server_con; - /* If we are multi-threaded, we may have packets to flush or connections that should start reading again. */ - if (thread->server->flags.threaded) + if (Server->flags.threaded) { + gearman_server_con_st *server_con; + while ((server_con= gearman_server_con_io_next(thread)) != NULL) { if (server_con->is_dead) { if (server_con->proc_removed) + { gearman_server_con_free(server_con); + } continue; } @@ -217,64 +186,78 @@ if (server_con->ret != GEARMAN_SUCCESS) { *ret_ptr= server_con->ret; - return server_con; + return gearman_server_con_data(server_con); } /* See if any outgoing packets were queued. */ *ret_ptr= _thread_packet_flush(server_con); if (*ret_ptr != GEARMAN_SUCCESS && *ret_ptr != GEARMAN_IO_WAIT) - return server_con; + { + return gearman_server_con_data(server_con); + } } } /* Check for new activity on connections. */ - while ((con= gearman_ready(thread->gearman)) != NULL) { - /* Inherited classes anyone? Some people would call this a hack, I call - it clean (avoids extra ptrs). Brian, I'll give you your C99 0-byte - arrays at the ends of structs for this. :) */ - server_con= (gearman_server_con_st *)con; + gearman_server_con_st *server_con; - /* Try to read new packets. */ - if (con->revents & POLLIN) + while ((server_con= gearmand_ready(thread->gearman))) { - *ret_ptr= _thread_packet_read(server_con); - if (*ret_ptr != GEARMAN_SUCCESS && *ret_ptr != GEARMAN_IO_WAIT) - return server_con; - } + /* Try to read new packets. */ + if (server_con->con.revents & POLLIN) + { + *ret_ptr= _thread_packet_read(server_con); + if (*ret_ptr != GEARMAN_SUCCESS && *ret_ptr != GEARMAN_IO_WAIT) + return gearman_server_con_data(server_con); + } - /* Flush existing outgoing packets. */ - if (con->revents & POLLOUT) - { - *ret_ptr= _thread_packet_flush(server_con); - if (*ret_ptr != GEARMAN_SUCCESS && *ret_ptr != GEARMAN_IO_WAIT) - return server_con; + /* Flush existing outgoing packets. */ + if (server_con->con.revents & POLLOUT) + { + *ret_ptr= _thread_packet_flush(server_con); + if (*ret_ptr != GEARMAN_SUCCESS && *ret_ptr != GEARMAN_IO_WAIT) + { + return gearman_server_con_data(server_con); + } + } } } /* Start flushing new outgoing packets if we are single threaded. */ - if (! (thread->server->flags.threaded)) + if (! (Server->flags.threaded)) { - while ((server_con= gearman_server_con_io_next(thread)) != NULL) + gearman_server_con_st *server_con; + while ((server_con= gearman_server_con_io_next(thread))) { *ret_ptr= _thread_packet_flush(server_con); if (*ret_ptr != GEARMAN_SUCCESS && *ret_ptr != GEARMAN_IO_WAIT) - return server_con; + { + return gearman_server_con_data(server_con); + } } } /* Check for the two shutdown modes. */ - if (thread->server->shutdown) + if (Server->shutdown) + { *ret_ptr= GEARMAN_SHUTDOWN; - else if (thread->server->shutdown_graceful) + } + else if (Server->shutdown_graceful) { - if (thread->server->job_count == 0) + if (Server->job_count == 0) + { *ret_ptr= GEARMAN_SHUTDOWN; + } else + { *ret_ptr= GEARMAN_SHUTDOWN_GRACEFUL; + } } else + { *ret_ptr= GEARMAN_SUCCESS; + } return NULL; } @@ -283,37 +266,39 @@ * Private definitions */ -gearman_return_t _thread_packet_read(gearman_server_con_st *con) +static gearmand_error_t _thread_packet_read(gearman_server_con_st *con) { - gearman_return_t ret; - while (1) { if (con->packet == NULL) { - con->packet= gearman_server_packet_create(con->thread, true); - if (con->packet == NULL) + if (! (con->packet= gearman_server_packet_create(con->thread, true))) + { return GEARMAN_MEMORY_ALLOCATION_FAILURE; + } } - (void)gearman_connection_recv(&(con->con), &(con->packet->packet), &ret, true); - if (ret != GEARMAN_SUCCESS) + gearmand_error_t ret; + if (gearmand_failed(ret= gearman_io_recv(con, true))) { if (ret == GEARMAN_IO_WAIT) + { break; + } gearman_server_packet_free(con->packet, con->thread, true); con->packet= NULL; return ret; } - gearman_log_debug(con->thread->gearman, "%15s:%5s Received %s", - con->host == NULL ? "-" : con->host, - con->port == NULL ? "-" : con->port, - gearman_command_info_list[con->packet->packet.command].name); + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Received %s %s:%u", + gearman_command_info(con->packet->packet.command)->name, + con->_host == NULL ? "-" : con->_host, + con->_port == NULL ? "-" : con->_port); /* We read a complete packet. */ - if (con->thread->server->flags.threaded) + if (Server->flags.threaded) { /* Multi-threaded, queue for the processing thread to run. */ gearman_server_proc_packet_add(con, con->packet); @@ -322,63 +307,82 @@ else { /* Single threaded, run the command here. */ - ret= gearman_server_run_command(con, &(con->packet->packet)); - gearman_packet_free(&(con->packet->packet)); + gearmand_error_t rc= gearman_server_run_command(con, &(con->packet->packet)); + gearmand_packet_free(&(con->packet->packet)); gearman_server_packet_free(con->packet, con->thread, true); con->packet= NULL; - if (ret != GEARMAN_SUCCESS) - return ret; + if (gearmand_failed(rc)) + return rc; } } return GEARMAN_SUCCESS; } -static gearman_return_t _thread_packet_flush(gearman_server_con_st *con) +static gearmand_error_t _thread_packet_flush(gearman_server_con_st *con) { - gearman_return_t ret; - /* Check to see if we've already tried to avoid excessive system calls. */ if (con->con.events & POLLOUT) return GEARMAN_IO_WAIT; - while (con->io_packet_list != NULL) + while (con->io_packet_list) { - ret= gearman_connection_send(&(con->con), &(con->io_packet_list->packet), - con->io_packet_list->next == NULL ? true : false); - if (ret != GEARMAN_SUCCESS) + gearmand_error_t ret; + + ret= gearman_io_send(con, &(con->io_packet_list->packet), + con->io_packet_list->next == NULL ? true : false); + if (gearmand_failed(ret)) + { return ret; + } - gearman_log_debug(con->thread->gearman, "%15s:%5s Sent %s", - con->host == NULL ? "-" : con->host, - con->port == NULL ? "-" : con->port, - gearman_command_info_list[con->io_packet_list->packet.command].name); + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Sent %s to %s:%d", + gearman_command_info(con->io_packet_list->packet.command)->name, + con->_host == NULL ? "-" : con->_host, + con->_port == NULL ? "-" : con->_port); gearman_server_io_packet_remove(con); } /* Clear the POLLOUT flag. */ - return gearman_connection_set_events(&(con->con), POLLIN); + return gearmand_io_set_events(con, POLLIN); } -static gearman_return_t _proc_thread_start(gearman_server_st *server) +static gearmand_error_t _proc_thread_start(gearman_server_st *server) { - pthread_attr_t attr; - - if (pthread_mutex_init(&(server->proc_lock), NULL) != 0) - return GEARMAN_PTHREAD; + if ((errno= pthread_mutex_init(&(server->proc_lock), NULL))) + { + gearmand_perror("pthread_mutex_init"); + return GEARMAN_ERRNO; + } - if (pthread_cond_init(&(server->proc_cond), NULL) != 0) - return GEARMAN_PTHREAD; + if ((errno= pthread_cond_init(&(server->proc_cond), NULL))) + { + gearmand_perror("pthread_cond_init"); + return GEARMAN_ERRNO; + } - if (pthread_attr_init(&attr) != 0) - return GEARMAN_PTHREAD; + pthread_attr_t attr; + if ((errno= pthread_attr_init(&attr))) + { + gearmand_perror("pthread_attr_init"); + return GEARMAN_ERRNO; + } - if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) != 0) - return GEARMAN_PTHREAD; + if ((errno= pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM))) + { + gearmand_perror("pthread_attr_setscope"); + (void) pthread_attr_destroy(&attr); + return GEARMAN_ERRNO; + } - if (pthread_create(&(server->proc_id), &attr, _proc, server) != 0) - return GEARMAN_PTHREAD; + if ((errno= pthread_create(&(server->proc_id), &attr, _proc, server))) + { + gearmand_perror("pthread_create"); + (void) pthread_attr_destroy(&attr); + return GEARMAN_ERRNO; + } (void) pthread_attr_destroy(&attr); @@ -412,6 +416,8 @@ gearman_server_con_st *con; gearman_server_packet_st *packet; + gearmand_initialize_thread_logging("[ proc ]"); + while (1) { (void) pthread_mutex_lock(&(server->proc_lock)); @@ -451,16 +457,10 @@ break; con->ret= gearman_server_run_command(con, &(packet->packet)); - gearman_packet_free(&(packet->packet)); + gearmand_packet_free(&(packet->packet)); gearman_server_packet_free(packet, con->thread, false); } } } } } - -static void _log(const char *line, gearman_verbose_t verbose, void *context) -{ - gearman_server_thread_st *thread= (gearman_server_thread_st *)context; - (*(thread->log_fn))(line, verbose, (void *)thread->log_context); -} diff -Nru gearmand-0.14/libgearman-server/thread.h gearmand-0.23/libgearman-server/thread.h --- gearmand-0.14/libgearman-server/thread.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/thread.h 2011-03-08 07:00:29.000000000 +0100 @@ -18,6 +18,8 @@ extern "C" { #endif +#include + /** * @addtogroup gearman_server_thread Thread Declarations * @ingroup gearman_server @@ -27,22 +29,20 @@ * @{ */ +// Owned by gearmand_thread_st + struct gearman_server_thread_st { - struct { - bool allocated; - } options; uint32_t con_count; uint32_t io_count; uint32_t proc_count; uint32_t free_con_count; uint32_t free_packet_count; - gearman_universal_st *gearman; - gearman_server_st *server; + gearmand_connection_list_st *gearman; gearman_server_thread_st *next; gearman_server_thread_st *prev; - gearman_log_fn *log_fn; - void *log_context; + gearman_log_server_fn *log_fn; + gearmand_thread_st *log_context; gearman_server_thread_run_fn *run_fn; void *run_fn_arg; gearman_server_con_st *con_list; @@ -50,7 +50,7 @@ gearman_server_con_st *proc_list; gearman_server_con_st *free_con_list; gearman_server_packet_st *free_packet_list; - gearman_universal_st gearman_universal_static; + gearmand_connection_list_st gearmand_connection_list_static; pthread_mutex_t lock; }; @@ -64,66 +64,24 @@ * NULL, or the thread parameter pointer if it was not NULL. */ GEARMAN_API -gearman_server_thread_st * -gearman_server_thread_create(gearman_server_st *server, - gearman_server_thread_st *thread); +bool gearman_server_thread_init(gearman_server_st *server, + gearman_server_thread_st *thread, + gearman_log_server_fn *function, + gearmand_thread_st *context, + gearmand_event_watch_fn *event_watch); /** * Free resources used by a thread structure. * @param thread Thread structure previously initialized with - * gearman_server_thread_create. + * gearman_server_thread_init. */ GEARMAN_API void gearman_server_thread_free(gearman_server_thread_st *thread); /** - * Return an error string for the last error encountered. - * @param thread Thread structure previously initialized with - * gearman_server_thread_create. - * @return Pointer to static buffer in library that holds an error string. - */ -GEARMAN_API -const char *gearman_server_thread_error(gearman_server_thread_st *thread); - -/** - * Value of errno in the case of a GEARMAN_ERRNO return value. - * @param thread Thread structure previously initialized with - * gearman_server_thread_create. - * @return An errno value as defined in your system errno.h file. - */ -GEARMAN_API -int gearman_server_thread_errno(gearman_server_thread_st *thread); - -/** - * Set custom I/O event watch callback. - * @param thread Thread structure previously initialized with - * gearman_server_thread_create. - * @param event_watch Function to be called when events need to be watched. - * @param event_watch_arg Argument to pass along to event_watch. - */ -GEARMAN_API -void gearman_server_thread_set_event_watch(gearman_server_thread_st *thread, - gearman_event_watch_fn *event_watch, - void *event_watch_arg); - -/** - * Set logging callback for server thread instance. - * @param thread Thread structure previously initialized with - * gearman_server_thread_create. - * @param function Function to call when there is a logging message. - * @param context Argument to pass into the log callback function. - * @param verbose Verbosity level. - */ -GEARMAN_API -void gearman_server_thread_set_log_fn(gearman_server_thread_st *thread, - gearman_log_fn *function, - void *context, - gearman_verbose_t verbose); - -/** * Set thread run callback. * @param thread Thread structure previously initialized with - * gearman_server_thread_create. + * gearman_server_thread_init. * @param run_fn Function to call when thread should be run. * @param run_arg Argument to pass along with run_fn. */ @@ -135,14 +93,14 @@ /** * Process server thread connections. * @param thread Thread structure previously initialized with - * gearman_server_thread_create. + * gearman_server_thread_init. * @param ret_ptr Pointer to hold a standard gearman return value. * @return On error, the server connection that encountered the error. */ GEARMAN_API -gearman_server_con_st * +gearmand_con_st * gearman_server_thread_run(gearman_server_thread_st *thread, - gearman_return_t *ret_ptr); + gearmand_error_t *ret_ptr); /** @} */ diff -Nru gearmand-0.14/libgearman-server/wakeup.cc gearmand-0.23/libgearman-server/wakeup.cc --- gearmand-0.14/libgearman-server/wakeup.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/wakeup.cc 2011-03-03 08:43:32.000000000 +0100 @@ -0,0 +1,38 @@ +/* Gearman server and library + * Copyright (C) 2011 DataDifferential + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include + +#include + +const char *gearmand_strwakeup(gearmand_wakeup_t arg) +{ + switch (arg) + { + case GEARMAND_WAKEUP_PAUSE: + return "GEARMAND_WAKEUP_PAUSE"; + + case GEARMAND_WAKEUP_SHUTDOWN: + return "GEARMAND_WAKEUP_SHUTDOWN"; + + case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: + return "GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL"; + + case GEARMAND_WAKEUP_CON: + return "GEARMAND_WAKEUP_CON"; + + case GEARMAND_WAKEUP_RUN: + return "GEARMAND_WAKEUP_RUN"; + + default: + abort(); + } +} + diff -Nru gearmand-0.14/libgearman-server/wakeup.h gearmand-0.23/libgearman-server/wakeup.h --- gearmand-0.14/libgearman-server/wakeup.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/wakeup.h 2011-03-03 08:43:32.000000000 +0100 @@ -0,0 +1,32 @@ +/* Gearman server and library + * Copyright (C) 2011 DataDifferential + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#include + +typedef enum +{ + GEARMAND_WAKEUP_PAUSE, + GEARMAND_WAKEUP_SHUTDOWN, + GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL, + GEARMAND_WAKEUP_CON, + GEARMAND_WAKEUP_RUN +} gearmand_wakeup_t; + +#ifdef __cplusplus +extern "C" { +#endif + +GEARMAN_INTERNAL_API +const char *gearmand_strwakeup(gearmand_wakeup_t arg); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libgearman-server/worker.c gearmand-0.23/libgearman-server/worker.c --- gearmand-0.14/libgearman-server/worker.c 2010-06-30 00:26:10.000000000 +0200 +++ gearmand-0.23/libgearman-server/worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,125 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/** - * @file - * @brief Server worker definitions - */ - -#include "common.h" - -/* - * Public definitions - */ - -gearman_server_worker_st * -gearman_server_worker_add(gearman_server_con_st *con, const char *function_name, - size_t function_name_size, uint32_t timeout) -{ - gearman_server_worker_st *worker; - gearman_server_function_st *function; - - function= gearman_server_function_get(con->thread->server, function_name, - function_name_size); - if (function == NULL) - return NULL; - - worker= gearman_server_worker_create(con, function, NULL); - if (worker == NULL) - return NULL; - - worker->timeout= timeout; - - return worker; -} - -gearman_server_worker_st * -gearman_server_worker_create(gearman_server_con_st *con, - gearman_server_function_st *function, - gearman_server_worker_st *worker) -{ - gearman_server_st *server= con->thread->server; - - if (worker == NULL) - { - if (server->free_worker_count > 0) - { - worker= server->free_worker_list; - GEARMAN_LIST_DEL(server->free_worker, worker, con_) - } - else - { - worker= (gearman_server_worker_st *)malloc(sizeof(gearman_server_worker_st)); - if (worker == NULL) - { - gearman_log_error(con->thread->gearman, "gearman_server_worker_create", "malloc"); - return NULL; - } - } - - worker->options.allocated= true; - } - else - worker->options.allocated= false; - - worker->job_count= 0; - worker->timeout= 0; - worker->con= con; - GEARMAN_LIST_ADD(con->worker, worker, con_) - worker->function= function; - - /* Add worker to the function list, which is a double-linked circular list. */ - if (function->worker_list == NULL) - { - function->worker_list= worker; - worker->function_next= worker; - worker->function_prev= worker; - } - else - { - worker->function_next= function->worker_list; - worker->function_prev= function->worker_list->function_prev; - worker->function_next->function_prev= worker; - worker->function_prev->function_next= worker; - } - function->worker_count++; - - worker->job_list= NULL; - - return worker; -} - -void gearman_server_worker_free(gearman_server_worker_st *worker) -{ - gearman_server_st *server= worker->con->thread->server; - - /* If the worker was in the middle of a job, requeue it. */ - while (worker->job_list != NULL) - (void)gearman_server_job_queue(worker->job_list); - - GEARMAN_LIST_DEL(worker->con->worker, worker, con_) - - if (worker == worker->function_next) - worker->function->worker_list= NULL; - else - { - worker->function_next->function_prev= worker->function_prev; - worker->function_prev->function_next= worker->function_next; - if (worker == worker->function->worker_list) - worker->function->worker_list= worker->function_next; - } - worker->function->worker_count--; - - if (worker->options.allocated) - { - if (server->free_worker_count < GEARMAN_MAX_FREE_SERVER_WORKER) - GEARMAN_LIST_ADD(server->free_worker, worker, con_) - else - free(worker); - } -} diff -Nru gearmand-0.14/libgearman-server/worker.cc gearmand-0.23/libgearman-server/worker.cc --- gearmand-0.14/libgearman-server/worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libgearman-server/worker.cc 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,131 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/** + * @file + * @brief Server worker definitions + */ + +#include + +static gearman_server_worker_st * +gearman_server_worker_create(gearman_server_con_st *con, + gearman_server_function_st *function); + +/* + * Public definitions + */ + +gearman_server_worker_st * +gearman_server_worker_add(gearman_server_con_st *con, const char *function_name, + size_t function_name_size, uint32_t timeout) +{ + gearman_server_worker_st *worker; + gearman_server_function_st *function; + + function= gearman_server_function_get(Server, function_name, + function_name_size); + if (function == NULL) + return NULL; + + worker= gearman_server_worker_create(con, function); + if (worker == NULL) + return NULL; + + worker->timeout= timeout; + + return worker; +} + +static gearman_server_worker_st * +gearman_server_worker_create(gearman_server_con_st *con, gearman_server_function_st *function) +{ + gearman_server_worker_st *worker; + + if (Server->free_worker_count > 0) + { + worker= Server->free_worker_list; + GEARMAN_LIST_DEL(Server->free_worker, worker, con_) + } + else + { + worker= static_cast(malloc(sizeof(gearman_server_worker_st))); + if (not worker) + { + gearmand_merror("malloc", 0, sizeof(gearman_server_worker_st)); + return NULL; + } + } + + + worker->job_count= 0; + worker->timeout= 0; + worker->con= con; + GEARMAN_LIST_ADD(con->worker, worker, con_) + worker->function= function; + + /* Add worker to the function list, which is a double-linked circular list. */ + if (function->worker_list == NULL) + { + function->worker_list= worker; + worker->function_next= worker; + worker->function_prev= worker; + } + else + { + worker->function_next= function->worker_list; + worker->function_prev= function->worker_list->function_prev; + worker->function_next->function_prev= worker; + worker->function_prev->function_next= worker; + } + function->worker_count++; + + worker->job_list= NULL; + + return worker; +} + +void gearman_server_worker_free(gearman_server_worker_st *worker) +{ + /* If the worker was in the middle of a job, requeue it. */ + while (worker->job_list != NULL) + { + gearmand_error_t ret; + ret= gearman_server_job_queue(worker->job_list); + if (ret != GEARMAN_SUCCESS) + { + gearmand_gerror("gearman_server_job_queue", ret); + } + } + + GEARMAN_LIST_DEL(worker->con->worker, worker, con_) + + if (worker == worker->function_next) + { + worker->function->worker_list= NULL; + } + else + { + worker->function_next->function_prev= worker->function_prev; + worker->function_prev->function_next= worker->function_next; + + if (worker == worker->function->worker_list) + worker->function->worker_list= worker->function_next; + } + worker->function->worker_count--; + + if (Server->free_worker_count < GEARMAN_MAX_FREE_SERVER_WORKER) + { + GEARMAN_LIST_ADD(Server->free_worker, worker, con_) + } + else + { + gearmand_crazy("free"); + free(worker); + } +} diff -Nru gearmand-0.14/libgearman-server/worker.h gearmand-0.23/libgearman-server/worker.h --- gearmand-0.14/libgearman-server/worker.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/libgearman-server/worker.h 2011-02-26 04:37:47.000000000 +0100 @@ -23,9 +23,6 @@ */ struct gearman_server_worker_st { - struct { - bool allocated; - } options; uint32_t job_count; uint32_t timeout; gearman_server_con_st *con; @@ -56,15 +53,6 @@ size_t function_name_size, uint32_t timeout); /** - * Initialize a server worker structure. - */ -GEARMAN_API -gearman_server_worker_st * -gearman_server_worker_create(gearman_server_con_st *con, - gearman_server_function_st *function, - gearman_server_worker_st *worker); - -/** * Free a server worker structure. */ GEARMAN_API diff -Nru gearmand-0.14/libtest/callbacks.h gearmand-0.23/libtest/callbacks.h --- gearmand-0.14/libtest/callbacks.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/callbacks.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,21 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* (test_callback_create_fn)(enum test_return_t*); +typedef enum test_return_t (test_callback_fn)(void *); +typedef enum test_return_t (test_callback_runner_fn)(test_callback_fn*, void *); +typedef enum test_return_t (test_callback_error_fn)(const enum test_return_t, void *); + +#ifdef __cplusplus +} +#endif + diff -Nru gearmand-0.14/libtest/cmdline.cc gearmand-0.23/libtest/cmdline.cc --- gearmand-0.14/libtest/cmdline.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/cmdline.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,36 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * uTest + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + diff -Nru gearmand-0.14/libtest/cmdline.h gearmand-0.23/libtest/cmdline.h --- gearmand-0.14/libtest/cmdline.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/cmdline.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,38 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * uTest + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + diff -Nru gearmand-0.14/libtest/collection.h gearmand-0.23/libtest/collection.h --- gearmand-0.14/libtest/collection.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/collection.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,19 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +/** + A structure which describes a collection of test cases. +*/ +struct collection_st { + const char *name; + test_callback_fn *pre; + test_callback_fn *post; + struct test_st *tests; +}; + + diff -Nru gearmand-0.14/libtest/common.h gearmand-0.23/libtest/common.h --- gearmand-0.14/libtest/common.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/common.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * uTest + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ All + * rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + Common include file for libmemached +*/ + +#pragma once + +#include + +#if defined(NDEBUG) +# undef NDEBUG +#endif + +#include +#include +#include + +#include diff -Nru gearmand-0.14/libtest/core.h gearmand-0.23/libtest/core.h --- gearmand-0.14/libtest/core.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/core.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,11 @@ +/* + * uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +LIBTEST_API +void create_core(void); diff -Nru gearmand-0.14/libtest/error.h gearmand-0.23/libtest/error.h --- gearmand-0.14/libtest/error.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/error.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,18 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +enum test_return_t { + TEST_SUCCESS= 0, /* Backwards compatibility */ + TEST_FAILURE, + TEST_MEMORY_ALLOCATION_FAILURE, + TEST_SKIPPED, + TEST_FATAL // Collection should not be continued +}; + + +#define test_failed(__test_return_t) ((__test_return_t) != TEST_SUCCESS) diff -Nru gearmand-0.14/libtest/framework.cc gearmand-0.23/libtest/framework.cc --- gearmand-0.14/libtest/framework.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/framework.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,59 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include + +test_return_t Framework::destroy(void* arg) +{ + if (_destroy) + { + return _destroy(arg); + } + + return TEST_SUCCESS; +} + +test_return_t Framework::Item::flush(void* arg, test_st* run) +{ + if (run->requires_flush and _flush) + { + return _flush(arg); + } + + return TEST_SUCCESS; +} + +test_return_t Framework::on_error(const test_return_t rc, void* arg) +{ + if (_on_error and test_failed(_on_error(rc, arg))) + { + return TEST_FAILURE; + } + + return TEST_SUCCESS; +} + +test_return_t Framework::startup(void* arg) +{ + if (collection_startup) + { + return collection_startup(arg); + } + + return TEST_SUCCESS; +} + +test_return_t Framework::Item::startup(void* arg) +{ + if (_startup) + { + return _startup(arg); + } + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/libtest/framework.h gearmand-0.23/libtest/framework.h --- gearmand-0.14/libtest/framework.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/framework.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,137 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +/** + Framework is the structure which is passed to the test implementation to be filled. + This must be implemented in order for the test framework to load the tests. We call + get_world() in order to fill this structure. +*/ + +struct Framework { + collection_st *collections; + + /* These methods are called outside of any collection call. */ + test_callback_create_fn *_create; + test_callback_fn *_destroy; + + void* create(test_return_t* arg) + { + if (_create) + { + return _create(arg); + } + + return NULL; + } + + test_return_t destroy(void*); + + /* This is called a the beginning of any collection run. */ + test_callback_fn *collection_startup; + + test_return_t startup(void*); + + /* This is called a the end of any collection run. */ + test_callback_fn *collection_shutdown; + + test_return_t shutdown(void* arg) + { + if (collection_shutdown) + { + return collection_shutdown(arg); + } + + return TEST_SUCCESS; + } + + /** + These are run before/after the test. If implemented. Their execution is not controlled + by the test. + */ + struct Item { + /* This is called a the beginning of any run. */ + test_callback_fn *_startup; + + test_return_t startup(void*); + + /* + This called on a test if the test requires a flush call (the bool is + from test_st) + */ + test_callback_fn *_flush; + + /* + Run before and after the runnner is executed. + */ + test_callback_fn *pre_run; + test_callback_fn *post_run; + + Item() : + _startup(NULL), + _flush(NULL), + pre_run(NULL), + post_run(NULL) + { } + + test_return_t flush(void* arg, test_st* run); + + void set_pre(test_callback_fn *arg) + { + pre_run= arg; + } + + void set_post(test_callback_fn *arg) + { + pre_run= arg; + } + + test_return_t pre(void *arg) + { + if (pre_run) + { + return pre_run(arg); + } + + return TEST_SUCCESS; + } + + test_return_t post(void *arg) + { + if (post_run) + { + return post_run(arg); + } + + return TEST_SUCCESS; + } + + } item; + + /** + If an error occurs during the test, this is called. + */ + test_callback_error_fn *_on_error; + + test_return_t on_error(const enum test_return_t, void *); + + /** + Runner represents the callers for the tests. If not implemented we will use + a set of default implementations. + */ + Runner *runner; + + Framework(); + + virtual ~Framework() + { } + + Framework(const Framework&); + +private: + Framework& operator=(const Framework&); +}; diff -Nru gearmand-0.14/libtest/gearmand.cc gearmand-0.23/libtest/gearmand.cc --- gearmand-0.14/libtest/gearmand.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/gearmand.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,235 @@ +/* Gearman server and library + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#if defined(NDEBUG) +# undef NDEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static bool wait_and_check_startup(const char *hostname, in_port_t port) +{ + gearman_client_st *client; + + client= gearman_client_create(NULL); + if (not client) + { + return false; + } + + gearman_return_t rc; + if ((rc= gearman_client_add_server(client, hostname, port)) == GEARMAN_SUCCESS) + { + int counter= 5; // sleep cycles + while (--counter) + { + rc= gearman_client_echo(client, gearman_literal_param("This is my echo test")); + + if (rc == GEARMAN_SUCCESS) + break; + + if (rc == GEARMAN_ERRNO && gearman_client_errno(client) == ECONNREFUSED) + { + sleep(1); + continue; + } + } + } + + if (rc != GEARMAN_SUCCESS) + { + std::cerr << "wait_and_check_startup(" << gearman_client_error(client) << ")" << std::endl; + } + gearman_client_free(client); + + return rc == GEARMAN_SUCCESS; +} + +#include + +pid_t test_gearmand_start(in_port_t port, int argc, const char *argv[]) +{ + std::stringstream buffer; + + char file_buffer[1024]; + char log_buffer[1024]; + + log_buffer[0]= 0; + file_buffer[0]= 0; + + if (getenv("GEARMAN_MANUAL_GDB")) + { + buffer << "libtool --mode=execute gdb gearmand/gearmand"; + } + else if (getenv("GEARMAN_VALGRIND")) + { + buffer << "libtool --mode=execute valgrind --log-file=tests/var/tmp/valgrind.out --leak-check=full --show-reachable=yes "; + } + + { + snprintf(file_buffer, sizeof(file_buffer), "tests/var/tmp/gearmand.pidXXXXXX"); + int fd; + if ((fd= mkstemp(file_buffer)) == -1) + { + perror("mkstemp"); + return -1; + } + close(fd); + } + + if (getenv("GEARMAN_MANUAL_GDB")) + { + buffer << std::endl << "run --pid-file=" << file_buffer << " -vvvvvv --port=" << port; + } + else if (getenv("GEARMAN_LOG")) + { + snprintf(log_buffer, sizeof(log_buffer), "tests/var/log/gearmand.logXXXXXX"); + int log_fd; + if ((log_fd= mkstemp(log_buffer)) == -1) + { + perror("mkstemp"); + return -1; + } + close(log_fd); + buffer << "./gearmand/gearmand --pid-file=" << file_buffer << " --daemon --port=" << port << " -vvvvvv --log-file=" << log_buffer; + } + else + { + buffer << "./gearmand/gearmand --pid-file=" << file_buffer << " --daemon --port=" << port; + } + + if (getuid() == 0 || geteuid() == 0) + { + buffer << " -u root "; + } + + for (int x= 1 ; x < argc ; x++) + { + buffer << " " << argv[x] << " "; + } + + if (getenv("GEARMAN_MANUAL_GDB")) + { + std::cerr << "Pausing for startup, hit return when ready." << std::endl; + getchar(); + } + else + { + setenv("GEARMAN_SERVER_STARTUP", buffer.str().c_str(), 1); + int err= system(buffer.str().c_str()); + assert(err != -1); + } + + libtest::Wait wait(file_buffer); + + if (not wait.successful()) + { + return -1; + } + + // Sleep to make sure the server is up and running (or we could poll....) + pid_t gearmand_pid= -1; + uint32_t counter= 3; + while (--counter) + { + sleep(1); + + FILE *file; + file= fopen(file_buffer, "r"); + if (file == NULL) + { + continue; + } + + char fgets_buffer[1024]; + char *found= fgets(fgets_buffer, sizeof(fgets_buffer), file); + fclose(file); + if (not found) + { + return -1; + } + gearmand_pid= atoi(fgets_buffer); + + if (gearmand_pid > 0) + { + break; + } + } + + if (gearmand_pid == -1) + { + std::cerr << "Could not attach to gearman server, could server already be running on port(" << port << ")?" << std::endl; + return -1; + } + + if (not wait_and_check_startup(NULL, port)) + { + test_gearmand_stop(gearmand_pid); + std::cerr << "Failed wait_and_check_startup()" << std::endl; + return -1; + } + + return gearmand_pid; +} + +void test_gearmand_stop(pid_t gearmand_pid) +{ + if ((kill(gearmand_pid, SIGTERM) == -1)) + { + switch (errno) + { + case EPERM: + perror(__func__); + std::cerr << __func__ << " -> Does someone else have a gearmand server running locally?" << std::endl; + return; + case ESRCH: + perror(__func__); + std::cerr << "Process " << (int)gearmand_pid << " not found." << std::endl; + return; + default: + case EINVAL: + perror(__func__); + return; + } + } + + int status= 0; + pid_t pid= waitpid(gearmand_pid, &status, 0); + (void)pid; // @todo update such that we look at the return value for waitpid() + + if (WCOREDUMP(status)) + { + std::cerr << "A core dump was created from the server." << std::endl; + } + + if (WIFEXITED(status)) + return; + + sleep(3); +} diff -Nru gearmand-0.14/libtest/get.h gearmand-0.23/libtest/get.h --- gearmand-0.14/libtest/get.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/get.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,22 @@ +/* + * uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + + /* How we make all of this work :) */ + LIBTEST_API + void get_world(Framework *world); + +#ifdef __cplusplus +} +#endif + + diff -Nru gearmand-0.14/libtest/include.am gearmand-0.23/libtest/include.am --- gearmand-0.14/libtest/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/include.am 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,53 @@ +# vim:ft=automake +# Copyright (C) 2011 Data Differential (http://datadifferential.com/) +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# included from Top Level Makefile.am +# All paths should be given relative to the root + +noinst_HEADERS+= \ + libtest/callbacks.h \ + libtest/cmdline.h \ + libtest/collection.h \ + libtest/common.h \ + libtest/core.h \ + libtest/error.h \ + libtest/framework.cc \ + libtest/framework.h \ + libtest/get.h \ + libtest/runner.h \ + libtest/server.h \ + libtest/stats.h \ + libtest/strerror.h \ + libtest/test.h \ + libtest/test.hpp \ + libtest/visibility.h \ + libtest/wait.h \ + libtest/worker.h + +noinst_LTLIBRARIES+= libtest/libserver.la +libtest_libserver_la_SOURCES= \ + libtest/gearmand.cc \ + libtest/worker.cc + +noinst_LTLIBRARIES+= libtest/libtest.la +libtest_libtest_la_SOURCES= \ + libtest/cmdline.cc \ + libtest/framework.cc \ + libtest/test.cc + +libtest_unittest_LDADD= \ + libtest/libtest.la +libtest_unittest_SOURCES= \ + libtest/unittest.cc + +noinst_PROGRAMS+= libtest/wait +noinst_PROGRAMS+= libtest/unittest + +check_PROGRAMS+= libtest/unittest + +libtest_wait_SOURCES= libtest/wait.cc + diff -Nru gearmand-0.14/libtest/runner.h gearmand-0.23/libtest/runner.h --- gearmand-0.14/libtest/runner.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/runner.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,19 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + + +/** + Structure which houses the actual callers for the test cases contained in + the collections. +*/ +struct Runner { + test_callback_runner_fn *pre; + test_callback_runner_fn *run; + test_callback_runner_fn *post; +}; + diff -Nru gearmand-0.14/libtest/server.h gearmand-0.23/libtest/server.h --- gearmand-0.14/libtest/server.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/server.h 2011-05-03 02:24:28.000000000 +0200 @@ -0,0 +1,31 @@ +/* Gearman server and library + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include "libtest/visibility.h" + +#include +#include + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +LIBTEST_API +pid_t test_gearmand_start(in_port_t port, int argc, const char *argv[]); + +LIBTEST_API +void test_gearmand_stop(pid_t gearmand_pid); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/libtest/stats.h gearmand-0.23/libtest/stats.h --- gearmand-0.14/libtest/stats.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/stats.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,30 @@ +/* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once +struct Stats { + int32_t collection_success; + int32_t collection_skipped; + int32_t collection_failed; + int32_t collection_total; + + uint32_t success; + uint32_t skipped; + uint32_t failed; + uint32_t total; + + Stats() : + collection_success(0), + collection_skipped(0), + collection_failed(0), + collection_total(0), + success(0), + skipped(0), + failed(0), + total(0) + { } +}; + diff -Nru gearmand-0.14/libtest/strerror.h gearmand-0.23/libtest/strerror.h --- gearmand-0.14/libtest/strerror.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/strerror.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,14 @@ +/* + * uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +/** + @note Friendly print function for errors. +*/ +LIBTEST_API +const char *test_strerror(test_return_t code); diff -Nru gearmand-0.14/libtest/test.cc gearmand-0.23/libtest/test.cc --- gearmand-0.14/libtest/test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,327 @@ +/* uTest + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char RED[]= "\x1b[31m"; +const char COLOR_RESET[]= "\x1b[0m"; + +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static in_port_t global_port= 0; + +in_port_t default_port() +{ + assert(global_port); + return global_port; +} + +void set_default_port(in_port_t port) +{ + global_port= port; +} + +static void stats_print(Stats *stats) +{ + std::cout << "\tTotal Collections\t\t\t\t" << stats->collection_total << std::endl; + std::cout << "\tFailed Collections\t\t\t\t" << stats->collection_failed << std::endl; + std::cout << "\tSkipped Collections\t\t\t\t" << stats->collection_skipped << std::endl; + std::cout << "\tSucceeded Collections\t\t\t\t" << stats->collection_success << std::endl; + std::cout << std::endl; + std::cout << "Total\t\t\t\t" << stats->total << std::endl; + std::cout << "\tFailed\t\t\t" << stats->failed << std::endl; + std::cout << "\tSkipped\t\t\t" << stats->skipped << std::endl; + std::cout << "\tSucceeded\t\t" << stats->success << std::endl; +} + +static long int timedif(struct timeval a, struct timeval b) +{ + long us, s; + + us = (long)(a.tv_usec - b.tv_usec); + us /= 1000; + s = (long)(a.tv_sec - b.tv_sec); + s *= 1000; + return s + us; +} + +const char *test_strerror(test_return_t code) +{ + switch (code) { + case TEST_SUCCESS: + return "ok"; + + case TEST_FAILURE: + return "failed"; + + case TEST_MEMORY_ALLOCATION_FAILURE: + return "memory allocation"; + + case TEST_SKIPPED: + return "skipped"; + + case TEST_FATAL: + break; + } + + return "failed"; +} + +bool test_is_local() +{ + return (getenv("LIBTEST_LOCAL")); +} + +void create_core(void) +{ + if (getenv("LIBTEST_NO_COREDUMP") == NULL) + { + pid_t pid= fork(); + + if (pid == 0) + { + abort(); + } + else + { + while (waitpid(pid, NULL, 0) != pid) {}; + } + } +} + + +static test_return_t _runner_default(test_callback_fn func, void *p) +{ + if (func) + { + return func(p); + } + + return TEST_SUCCESS; +} + +static Runner defualt_runners= { + _runner_default, + _runner_default, + _runner_default +}; + +static test_return_t _default_callback(void *p) +{ + (void)p; + + return TEST_SUCCESS; +} + +Framework::Framework() : + collections(NULL), + _create(NULL), + _destroy(NULL), + collection_startup(_default_callback), + collection_shutdown(_default_callback), + _on_error(NULL), + runner(&defualt_runners) +{ +} + + +int main(int argc, char *argv[]) +{ + Framework world; + + Stats stats; + + get_world(&world); + + if (not world.runner) + { + world.runner= &defualt_runners; + } + + test_return_t error; + void *world_ptr= world.create(&error); + if (test_failed(error)) + { + return EXIT_FAILURE; + } + + char *collection_to_run= NULL; + if (argc > 1) + { + collection_to_run= argv[1]; + } + else if (getenv("TEST_COLLECTION")) + { + collection_to_run= getenv("TEST_COLLECTION"); + } + + if (collection_to_run) + { + std::cout << "Only testing " << collection_to_run << std::endl; + } + + char *wildcard= NULL; + if (argc == 3) + { + wildcard= argv[2]; + } + + for (collection_st *next= world.collections; next->name; next++) + { + test_return_t collection_rc= TEST_SUCCESS; + bool failed= false; + bool skipped= false; + + if (collection_to_run && fnmatch(collection_to_run, next->name, 0)) + continue; + + stats.collection_total++; + + collection_rc= world.startup(world_ptr); + + if (collection_rc == TEST_SUCCESS and next->pre) + { + collection_rc= world.runner->pre(next->pre, world_ptr); + } + + switch (collection_rc) + { + case TEST_SUCCESS: + std::cerr << std::endl << next->name << std::endl << std::endl; + break; + + case TEST_FATAL: + case TEST_FAILURE: + std::cerr << std::endl << next->name << " [ failed ]" << std::endl << std::endl; + stats.collection_failed++; + goto cleanup; + + case TEST_SKIPPED: + std::cerr << std::endl << next->name << " [ skipping ]" << std::endl << std::endl; + stats.collection_skipped++; + goto cleanup; + + case TEST_MEMORY_ALLOCATION_FAILURE: + test_assert(0, "Allocation failure, or unknown return"); + } + + for (test_st *run= next->tests; run->name; run++) + { + struct timeval start_time, end_time; + long int load_time= 0; + + if (wildcard && fnmatch(wildcard, run->name, 0)) + { + continue; + } + + std::cerr << RED << "\tTesting " << run->name << COLOR_RESET; + + world.item.startup(world_ptr); + + world.item.flush(world_ptr, run); + + world.item.pre(world_ptr); + + test_return_t return_code; + { // Runner Code + gettimeofday(&start_time, NULL); + return_code= world.runner->run(run->test_fn, world_ptr); + gettimeofday(&end_time, NULL); + load_time= timedif(end_time, start_time); + } + + world.item.post(world_ptr); + + stats.total++; + + std::cerr << "\t\t\t\t\t"; + + switch (return_code) + { + case TEST_SUCCESS: + std::cerr << RED << load_time / 1000 << "." << load_time % 1000 << COLOR_RESET; + stats.success++; + break; + + case TEST_FATAL: + case TEST_FAILURE: + stats.failed++; + failed= true; + break; + + case TEST_SKIPPED: + stats.skipped++; + skipped= true; + break; + + case TEST_MEMORY_ALLOCATION_FAILURE: + test_assert(0, "Memory Allocation Error"); + } + + std::cerr << RED << "[ " << test_strerror(return_code) << " ]" << COLOR_RESET << std::endl; + + if (test_failed(world.on_error(return_code, world_ptr))) + { + break; + } + } + + if (next->post && world.runner->post) + { + (void) world.runner->post(next->post, world_ptr); + } + + if (failed == 0 and skipped == 0) + { + stats.collection_success++; + } +cleanup: + + world.shutdown(world_ptr); + } + + if (stats.collection_failed || stats.collection_skipped) + { + std::cerr << std::endl << std::endl << "Some test failures and/or skipped test occurred." << std::endl << std::endl; +#if 0 + print_failed_test(); +#endif + } + else + { + std::cout << std::endl << std::endl << "All tests completed successfully." << std::endl << std::endl; + } + + if (test_failed(world.destroy(world_ptr))) + { + stats.failed++; // We do this to make our exit code return EXIT_FAILURE + } + + stats_print(&stats); + + return stats.failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff -Nru gearmand-0.14/libtest/test.h gearmand-0.23/libtest/test.h --- gearmand-0.14/libtest/test.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/test.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,173 @@ +/* + * uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#pragma once + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/** + A structure describing the test case. +*/ +struct test_st { + const char *name; + bool requires_flush; + test_callback_fn *test_fn; +}; + +LIBTEST_API +bool test_is_local(void); + +#define test_assert_errno(A) \ +do \ +{ \ + if ((A)) { \ + fprintf(stderr, "\n%s:%d: Assertion failed for %s: ", __FILE__, __LINE__, __func__);\ + perror(#A); \ + fprintf(stderr, "\n"); \ + create_core(); \ + assert((A)); \ + } \ +} while (0) + +#define test_assert(A, B) \ +do \ +{ \ + if ((A)) { \ + fprintf(stderr, "\n%s:%d: Assertion failed %s, with message %s, in %s", __FILE__, __LINE__, (B), #A, __func__ );\ + fprintf(stderr, "\n"); \ + create_core(); \ + assert((A)); \ + } \ +} while (0) + +#define test_truth(A) \ +do \ +{ \ + if (! (A)) { \ + fprintf(stderr, "\n%s:%d: Assertion \"%s\" failed, in %s\n", __FILE__, __LINE__, #A, __func__);\ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_true(A) \ +do \ +{ \ + if (! (A)) { \ + fprintf(stderr, "\n%s:%d: Assertion \"%s\" failed, in %s\n", __FILE__, __LINE__, #A, __func__);\ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_true_got(A,B) \ +do \ +{ \ + if (! (A)) { \ + fprintf(stderr, "\n%s:%d: Assertion \"%s\" failed, received \"%s\"\n", __FILE__, __LINE__, #A, (B));\ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_skip(A,B) \ +do \ +{ \ + if ((A) != (B)) \ + { \ + return TEST_SKIPPED; \ + } \ +} while (0) + +#define test_fail(A) \ +do \ +{ \ + if (1) { \ + fprintf(stderr, "\n%s:%d: Failed with %s, in %s\n", __FILE__, __LINE__, #A, __func__);\ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + + +#define test_false(A) \ +do \ +{ \ + if ((A)) { \ + fprintf(stderr, "\n%s:%d: Assertion failed %s, in %s\n", __FILE__, __LINE__, #A, __func__);\ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_false_with(A,B) \ +do \ +{ \ + if ((A)) { \ + fprintf(stderr, "\n%s:%d: Assertion failed %s with %s\n", __FILE__, __LINE__, #A, (B));\ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + + +#define test_compare(A,B) \ +do \ +{ \ + if ((A) != (B)) \ + { \ + fprintf(stderr, "\n%s:%d: Expected %s, got %lu\n", __FILE__, __LINE__, #A, (unsigned long)(B)); \ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_compare_got(A,B,C) \ +do \ +{ \ + if ((A) != (B)) \ + { \ + fprintf(stderr, "\n%s:%d: Expected %s, got %s\n", __FILE__, __LINE__, #A, (C)); \ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + + +#define test_strcmp(A,B) \ +do \ +{ \ + if (strcmp((A), (B))) \ + { \ + fprintf(stderr, "\n%s:%d: Expected %s, got %s\n", __FILE__, __LINE__, (A), (B)); \ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_memcmp(A,B,C) \ +do \ +{ \ + if (memcmp((A), (B), (C))) \ + { \ + fprintf(stderr, "\n%s:%d: %.*s -> %.*s\n", __FILE__, __LINE__, (int)(C), (char *)(A), (int)(C), (char *)(B)); \ + create_core(); \ + return TEST_FAILURE; \ + } \ +} while (0) + +#define test_return_if(__test_return_t) \ +do \ +{ \ + if ((__test_return_t) != TEST_SUCCESS) \ + { \ + return __test_return_t; \ + } \ +} while (0) + diff -Nru gearmand-0.14/libtest/test.hpp gearmand-0.23/libtest/test.hpp --- gearmand-0.14/libtest/test.hpp 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/test.hpp 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,46 @@ +/* uTest + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +/* + Structures for generic tests. +*/ + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma once + +LIBTEST_API + in_port_t default_port(); + +LIBTEST_API + void set_default_port(in_port_t port); + +#ifdef __cplusplus +#define test_literal_param(X) (X), (static_cast((sizeof(X) - 1))) +#else +#define test_literal_param(X) (X), ((size_t)((sizeof(X) - 1))) +#endif + +#define test_string_make_from_cstr(X) (X), ((X) ? strlen(X) : 0) diff -Nru gearmand-0.14/libtest/unittest.cc gearmand-0.23/libtest/unittest.cc --- gearmand-0.14/libtest/unittest.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/unittest.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,87 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * uTest self unit test. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +static test_return_t test_success_test(void *) +{ + return TEST_SUCCESS; +} + +static test_return_t local_test(void *) +{ + char buffer[sizeof("LIBTEST_LOCAL=1")]; + + snprintf(buffer, sizeof(buffer), "%s", "LIBTEST_LOCAL=1"); + test_compare(0, putenv(buffer)); + + test_true(test_is_local()); + + return TEST_SUCCESS; +} + +static test_return_t local_not_test(void *) +{ + test_compare(0, unsetenv("LIBTEST_LOCAL")); + + test_false(test_is_local()); + + return TEST_SUCCESS; +} + +test_st tests_log[] ={ + {"TEST_SUCCESS", 0, test_success_test }, + {0, 0, 0} +}; + +test_st local_log[] ={ + {"test_is_local()", 0, local_test }, + {"test_is_local(NOT)", 0, local_not_test }, + {0, 0, 0} +}; + +collection_st collection[] ={ + {"return values", 0, 0, tests_log}, + {"local", 0, 0, local_log}, + {0, 0, 0, 0} +}; + +void get_world(Framework *arg) +{ + arg->collections= collection; +} diff -Nru gearmand-0.14/libtest/visibility.h gearmand-0.23/libtest/visibility.h --- gearmand-0.14/libtest/visibility.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/visibility.h 2011-03-16 23:22:58.000000000 +0100 @@ -0,0 +1,69 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#if defined(BUILDING_LIBTEST) +# if defined(HAVE_VISIBILITY) +# define LIBTEST_API __attribute__ ((visibility("default"))) +# define LIBTEST_INTERNAL_API __attribute__ ((visibility("hidden"))) +# define LIBTEST_API_DEPRECATED __attribute__ ((deprecated,visibility("default"))) +# define LIBTEST_LOCAL __attribute__ ((visibility("hidden"))) +# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) +# define LIBTEST_API __global +# define LIBTEST_INTERNAL_API __hidden +# define LIBTEST_API_DEPRECATED __global +# define LIBTEST_LOCAL __hidden +# elif defined(_MSC_VER) +# define LIBTEST_API extern __declspec(dllexport) +# define LIBTEST_INTERNAL_API extern __declspec(dllexport) +# define LIBTEST_DEPRECATED_API extern __declspec(dllexport) +# define LIBTEST_LOCAL +# endif /* defined(HAVE_VISIBILITY) */ +#else /* defined(BUILDING_LIBTEST) */ +# if defined(_MSC_VER) +# define LIBTEST_API extern __declspec(dllimport) +# define LIBTEST_INTERNAL_API extern __declspec(dllimport) +# define LIBTEST_API_DEPRECATED extern __declspec(dllimport) +# define LIBTEST_LOCAL +# else +# define LIBTEST_API +# define LIBTEST_INTERNAL_API +# define LIBTEST_API_DEPRECATED +# define LIBTEST_LOCAL +# endif /* defined(_MSC_VER) */ +#endif /* defined(BUILDING_LIBTEST) */ diff -Nru gearmand-0.14/libtest/wait.cc gearmand-0.23/libtest/wait.cc --- gearmand-0.14/libtest/wait.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/wait.cc 2011-03-27 01:23:59.000000000 +0100 @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc == 2) + { + libtest::Wait wait(argv[1]); + + if (wait.successful()) + return EXIT_SUCCESS; + } + + return EXIT_FAILURE; +} diff -Nru gearmand-0.14/libtest/wait.h gearmand-0.23/libtest/wait.h --- gearmand-0.14/libtest/wait.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/wait.h 2011-03-27 01:23:59.000000000 +0100 @@ -0,0 +1,78 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include + +namespace libtest { + +class Wait +{ +public: + + Wait(const std::string &filename, uint32_t timeout= 6) : + _successful(false) + { + uint32_t waited; + uint32_t this_wait; + uint32_t retry; + + for (waited= 0, retry= 1; ; retry++, waited+= this_wait) + { + if ((not access(filename.c_str(), R_OK)) or (waited >= timeout)) + { + _successful= true; + break; + } + + this_wait= retry * retry / 3 + 1; + sleep(this_wait); + } + } + + bool successful() const + { + return _successful; + } + +private: + bool _successful; +}; + +} // namespace libtest diff -Nru gearmand-0.14/libtest/worker.cc gearmand-0.23/libtest/worker.cc --- gearmand-0.14/libtest/worker.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/worker.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,142 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +struct context_st { + in_port_t port; + const char *function_name; + struct worker_handle_st *handle; + gearman_worker_options_t options; + gearman_function_t& worker_fn; + const char *namespace_key; + void *context; + + context_st(gearman_function_t& arg) : + port(0), + handle(0), + options(gearman_worker_options_t()), + worker_fn(arg), + namespace_key(NULL), + context(0) + { } +}; + +static void *thread_runner(void *con) +{ + struct context_st *context= (struct context_st *)con; + + assert(context); + + gearman_worker_st *worker= gearman_worker_create(NULL); + assert(worker); + + if (context->namespace_key) + { + gearman_worker_set_namespace(worker, context->namespace_key, strlen(context->namespace_key)); + } + + gearman_return_t rc= gearman_worker_add_server(worker, NULL, context->port); + assert(rc == GEARMAN_SUCCESS); + + bool success= gearman_worker_set_server_option(worker, gearman_literal_param("exceptions")); + assert(success); + + rc= gearman_worker_define_function(worker, + context->function_name, strlen(context->function_name), + context->worker_fn, + 0, + context->context); + assert(rc == GEARMAN_SUCCESS); + + if (context->options != gearman_worker_options_t()) + { + gearman_worker_add_options(worker, context->options); + } + + gearman_worker_set_timeout(worker, 100); + + assert(context->handle); + + while (context->handle->shutdown == false) + { + gearman_return_t ret= gearman_worker_work(worker); + (void)ret; + } + + gearman_worker_free(worker); + + free(context); + + pthread_exit(0); +} + +struct worker_handle_st *test_worker_start(in_port_t port, + const char *namespace_key, + const char *function_name, + gearman_function_t &worker_fn, + void *context, + gearman_worker_options_t options) +{ + pthread_attr_t attr; + + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); + + worker_handle_st *handle= new worker_handle_st(); + assert(handle); + + context_st *foo= new context_st(worker_fn); + + foo->port= port; + foo->function_name= function_name; + foo->context= context; + foo->handle= handle; + foo->options= options; + foo->namespace_key= namespace_key; + + test_assert_errno(pthread_create(&handle->thread, &attr, thread_runner, foo)); + + pthread_attr_destroy(&attr); + + /* Wait for the server to start and bind the port. */ + struct timespec dream, rem; + + dream.tv_nsec= 0; + dream.tv_sec= 1; + + nanosleep(&dream, &rem); + + return handle; +} + +void test_worker_stop(worker_handle_st *handle) +{ + void *unused; + fflush(stderr); + handle->shutdown= true; + pthread_join(handle->thread, &unused); + delete handle; +} diff -Nru gearmand-0.14/libtest/worker.h gearmand-0.23/libtest/worker.h --- gearmand-0.14/libtest/worker.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/libtest/worker.h 2011-06-29 03:37:48.000000000 +0200 @@ -0,0 +1,39 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include +#include + +#include +#include + +struct worker_handle_st +{ + pthread_t thread; + volatile bool shutdown; +}; + +#pragma once +#ifdef __cplusplus +extern "C" { +#endif + +LIBTEST_API + struct worker_handle_st *test_worker_start(in_port_t port, + const char *namespace_key, + const char *function_name, + gearman_function_t &worker_fn, + void *context, + gearman_worker_options_t options); + +LIBTEST_API +void test_worker_stop(struct worker_handle_st *); + +#ifdef __cplusplus +} +#endif diff -Nru gearmand-0.14/m4/ac_cxx_compile_stdcxx_0x.m4 gearmand-0.23/m4/ac_cxx_compile_stdcxx_0x.m4 --- gearmand-0.14/m4/ac_cxx_compile_stdcxx_0x.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/ac_cxx_compile_stdcxx_0x.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,103 +0,0 @@ -# =========================================================================== -# http://autoconf-archive.cryp.to/ac_cxx_compile_stdcxx_0x.html -# =========================================================================== -# -# SYNOPSIS -# -# AC_CXX_COMPILE_STDCXX_0X -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++0x -# standard. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. - -AC_DEFUN([AC_CXX_COMPILE_STDCXX_0X], [ - AC_CACHE_CHECK(if g++ supports C++0x features without additional flags, - ac_cv_cxx_compile_cxx0x_native, - [AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([ - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = c;],, - ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no) - AC_LANG_RESTORE - ]) - - AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x, - ac_cv_cxx_compile_cxx0x_cxx, - [AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -std=c++0x" - AC_TRY_COMPILE([ - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = c;],, - ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no) - CXXFLAGS="$ac_save_CXXFLAGS" - AC_LANG_RESTORE - ]) - - AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x, - ac_cv_cxx_compile_cxx0x_gxx, - [AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -std=gnu++0x" - AC_TRY_COMPILE([ - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = c;],, - ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no) - CXXFLAGS="$ac_save_CXXFLAGS" - AC_LANG_RESTORE - ]) - - if test "$ac_cv_cxx_compile_cxx0x_native" = yes || - test "$ac_cv_cxx_compile_cxx0x_cxx" = yes || - test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then - AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ]) - fi -]) diff -Nru gearmand-0.14/m4/ac_cxx_header_stdcxx_98.m4 gearmand-0.23/m4/ac_cxx_header_stdcxx_98.m4 --- gearmand-0.14/m4/ac_cxx_header_stdcxx_98.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/ac_cxx_header_stdcxx_98.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,67 +0,0 @@ -dnl Copyright © 2008 Benjamin Kosnik - -dnl Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. - - -AC_DEFUN([AC_CXX_HEADER_STDCXX_98], [ - AC_CACHE_CHECK(for ISO C++ 98 include files, - ac_cv_cxx_stdcxx_98, - [AC_LANG_PUSH(C++) - AC_TRY_COMPILE([ - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - ],, - ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no) - AC_LANG_POP() - ]) - if test "$ac_cv_cxx_stdcxx_98" = yes; then - AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ]) - fi -]) diff -Nru gearmand-0.14/m4/boost.m4 gearmand-0.23/m4/boost.m4 --- gearmand-0.14/m4/boost.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/boost.m4 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,1118 @@ +# boost.m4: Locate Boost headers and libraries for autoconf-based projects. +# Copyright (C) 2007, 2008, 2009, 2010, 2011 Benoit Sigoure +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Additional permission under section 7 of the GNU General Public +# License, version 3 ("GPLv3"): +# +# If you convey this file as part of a work that contains a +# configuration script generated by Autoconf, you may do so under +# terms of your choice. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +m4_define([_BOOST_SERIAL], [m4_translit([ +# serial 16 +], [# +], [])]) + +# Original sources can be found at http://github.com/tsuna/boost.m4 +# You can fetch the latest version of the script by doing: +# wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4 + +# ------ # +# README # +# ------ # + +# This file provides several macros to use the various Boost libraries. +# The first macro is BOOST_REQUIRE. It will simply check if it's possible to +# find the Boost headers of a given (optional) minimum version and it will +# define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to +# your configure so that users can specify non standard locations. +# If the user's environment contains BOOST_ROOT and --with-boost was not +# specified, --with-boost=$BOOST_ROOT is implicitly used. +# For more README and documentation, go to http://github.com/tsuna/boost.m4 +# Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry, +# simply read the README, it will show you what to do step by step. + +m4_pattern_forbid([^_?(BOOST|Boost)_]) + + +# _BOOST_SED_CPP(SED-PROGRAM, PROGRAM, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# -------------------------------------------------------- +# Same as AC_EGREP_CPP, but leave the result in conftest.i. +# +# SED-PROGRAM is *not* overquoted, as in AC_EGREP_CPP. It is expanded +# in double-quotes, so escape your double quotes. +# +# It could be useful to turn this into a macro which extracts the +# value of any macro. +m4_define([_BOOST_SED_CPP], +[AC_LANG_PREPROC_REQUIRE()dnl +AC_REQUIRE([AC_PROG_SED])dnl +AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) +AS_IF([dnl eval is necessary to expand ac_cpp. +dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. +dnl Beware of Windows end-of-lines, for instance if we are running +dnl some Windows programs under Wine. In that case, boost/version.hpp +dnl is certainly using "\r\n", but the regular Unix shell will only +dnl strip `\n' with backquotes, not the `\r'. This results in +dnl boost_cv_lib_version='1_37\r' for instance, which breaks +dnl everything else. +dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK +(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + tr -d '\r' | + $SED -n -e "$1" >conftest.i 2>&1], + [$3], + [$4]) +rm -rf conftest* +])# AC_EGREP_CPP + + + +# BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------- +# Look for Boost. If version is given, it must either be a literal of the form +# "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a +# variable "$var". +# Defines the value BOOST_CPPFLAGS. This macro only checks for headers with +# the required version, it does not check for any of the Boost libraries. +# On # success, defines HAVE_BOOST. On failure, calls the optional +# ACTION-IF-NOT-FOUND action if one was supplied. +# Otherwise aborts with an error message. +AC_DEFUN([BOOST_REQUIRE], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_GREP])dnl +echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD +boost_save_IFS=$IFS +boost_version_req=$1 +IFS=. +set x $boost_version_req 0 0 0 +IFS=$boost_save_IFS +shift +boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"` +boost_version_req_string=$[1].$[2].$[3] +AC_ARG_WITH([boost], + [AS_HELP_STRING([--with-boost=DIR], + [prefix of Boost $1 @<:@guess@:>@])])dnl +AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl +# If BOOST_ROOT is set and the user has not provided a value to +# --with-boost, then treat BOOST_ROOT as if it the user supplied it. +if test x"$BOOST_ROOT" != x; then + if test x"$with_boost" = x; then + AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT]) + with_boost=$BOOST_ROOT + else + AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost]) + fi +fi +AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], + ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])dnl +boost_save_CPPFLAGS=$CPPFLAGS + AC_CACHE_CHECK([for Boost headers version >= $boost_version_req_string], + [boost_cv_inc_path], + [boost_cv_inc_path=no +AC_LANG_PUSH([C++])dnl +m4_pattern_allow([^BOOST_VERSION$])dnl + AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include +#if !defined BOOST_VERSION +# error BOOST_VERSION is not defined +#elif BOOST_VERSION < $boost_version_req +# error Boost headers version < $boost_version_req +#endif +]])]) + # If the user provided a value to --with-boost, use it and only it. + case $with_boost in #( + ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \ + /usr/include C:/Boost/include;; #( + *) set x "$with_boost/include" "$with_boost";; + esac + shift + for boost_dir + do + # Without --layout=system, Boost (or at least some versions) installs + # itself in /include/boost-. This inner loop helps to + # find headers in such directories. + # + # Any ${boost_dir}/boost-x_xx directories are searched in reverse version + # order followed by ${boost_dir}. The final '.' is a sentinel for + # searching $boost_dir" itself. Entries are whitespace separated. + # + # I didn't indent this loop on purpose (to avoid over-indented code) + boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ + && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ + && echo .` + for boost_inc in $boost_layout_system_search_list + do + if test x"$boost_inc" != x.; then + boost_inc="$boost_dir/$boost_inc" + else + boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list + fi + if test x"$boost_inc" != x; then + # We are going to check whether the version of Boost installed + # in $boost_inc is usable by running a compilation that + # #includes it. But if we pass a -I/some/path in which Boost + # is not installed, the compiler will just skip this -I and + # use other locations (either from CPPFLAGS, or from its list + # of system include directories). As a result we would use + # header installed on the machine instead of the /some/path + # specified by the user. So in that precise case (trying + # $boost_inc), make sure the version.hpp exists. + # + # Use test -e as there can be symlinks. + test -e "$boost_inc/boost/version.hpp" || continue + CPPFLAGS="$CPPFLAGS -I$boost_inc" + fi + AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no]) + if test x"$boost_cv_inc_path" = xyes; then + if test x"$boost_inc" != x; then + boost_cv_inc_path=$boost_inc + fi + break 2 + fi + done + done +AC_LANG_POP([C++])dnl + ]) + case $boost_cv_inc_path in #( + no) + boost_errmsg="cannot find Boost headers version >= $boost_version_req_string" + m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])], + [AC_MSG_NOTICE([$boost_errmsg])]) + $2 + ;;#( + yes) + BOOST_CPPFLAGS= + ;;#( + *) + AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"])dnl + ;; + esac + if test x"$boost_cv_inc_path" != xno; then + AC_DEFINE([HAVE_BOOST], [1], + [Defined if the requested minimum BOOST version is satisfied]) + AC_CACHE_CHECK([for Boost's header version], + [boost_cv_lib_version], + [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl + _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;q;}], + [#include +boost-lib-version = BOOST_LIB_VERSION], + [boost_cv_lib_version=`cat conftest.i`])]) + # e.g. "134" for 1_34_1 or "135" for 1_35 + boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` + case $boost_major_version in #( + '' | *[[!0-9]]*) + AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version]) + ;; + esac +fi +CPPFLAGS=$boost_save_CPPFLAGS +])# BOOST_REQUIRE + +# BOOST_STATIC() +# -------------- +# Add the "--enable-static-boost" configure argument. If this argument is given +# on the command line, static versions of the libraries will be looked up. +AC_DEFUN([BOOST_STATIC], + [AC_ARG_ENABLE([static-boost], + [AC_HELP_STRING([--enable-static-boost], + [Prefer the static boost libraries over the shared ones [no]])], + [enable_static_boost=yes], + [enable_static_boost=no])])# BOOST_STATIC + +# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND]) +# -------------------------------------------------------------------------- +# Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for +# some parts of the Boost library which are only made of headers and don't +# require linking (such as Boost.Foreach). +# +# Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be +# found in the first place, in which case by default a notice is issued to the +# user. Presumably if we haven't died already it's because it's OK to not have +# Boost, which is why only a notice is issued instead of a hard error. +# +# Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_ in +# case of success # (where HEADER-NAME is written LIKE_THIS, e.g., +# HAVE_BOOST_FOREACH_HPP). +AC_DEFUN([BOOST_FIND_HEADER], +[AC_REQUIRE([BOOST_REQUIRE])dnl +if test x"$boost_cv_inc_path" = xno; then + m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])]) +else +AC_LANG_PUSH([C++])dnl +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +AC_CHECK_HEADER([$1], + [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1], + [Define to 1 if you have <$1>])])], + [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])]) +CPPFLAGS=$boost_save_CPPFLAGS +AC_LANG_POP([C++])dnl +fi +])# BOOST_FIND_HEADER + + +# BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], +# [CXX-PROLOGUE]) +# ------------------------------------------------------------------------- +# Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for +# libboost_thread). Check that HEADER-NAME works and check that +# libboost_LIB-NAME can link with the code CXX-TEST. The optional argument +# CXX-PROLOGUE can be used to include some C++ code before the `main' +# function. +# +# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above). +# +# Boost libraries typically come compiled with several flavors (with different +# runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one +# or more of the following letters: sgdpn (in that order). s = static +# runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build, +# n = (unsure) STLPort build without iostreams from STLPort (it looks like `n' +# must always be used along with `p'). Additionally, PREFERRED-RT-OPT can +# start with `mt-' to indicate that there is a preference for multi-thread +# builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp +# ... If you want to make sure you have a specific version of Boost +# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro. +AC_DEFUN([BOOST_FIND_LIB], +[AC_REQUIRE([BOOST_REQUIRE])dnl +AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl +AC_REQUIRE([BOOST_STATIC])dnl +AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl +if test x"$boost_cv_inc_path" = xno; then + AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library]) +else +dnl The else branch is huge and wasn't intended on purpose. +AC_LANG_PUSH([C++])dnl +AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl +AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl +AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl +AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl +BOOST_FIND_HEADER([$3]) +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +# Now let's try to find the library. The algorithm is as follows: first look +# for a given library name according to the user's PREFERRED-RT-OPT. For each +# library name, we prefer to use the ones that carry the tag (toolset name). +# Each library is searched through the various standard paths were Boost is +# usually installed. If we can't find the standard variants, we try to +# enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist +# but there's -obviously- libboost_threads-mt.dylib). +AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib], + [Boost_lib=no + case "$2" in #( + mt | mt-) boost_mt=-mt; boost_rtopt=;; #( + mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #( + *) boost_mt=; boost_rtopt=$2;; + esac + if test $enable_static_boost = yes; then + boost_rtopt="s$boost_rtopt" + fi + # Find the proper debug variant depending on what we've been asked to find. + case $boost_rtopt in #( + *d*) boost_rt_d=$boost_rtopt;; #( + *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn') + boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( + *) boost_rt_d='-d';; + esac + # If the PREFERRED-RT-OPT are not empty, prepend a `-'. + test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" + $boost_guess_use_mt && boost_mt=-mt + # Look for the abs path the static archive. + # $libext is computed by Libtool but let's make sure it's non empty. + test -z "$libext" && + AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?]) + boost_save_ac_objext=$ac_objext + # Generate the test file. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3> +$5], [$4])]) +dnl Optimization hacks: compiling C++ is slow, especially with Boost. What +dnl we're trying to do here is guess the right combination of link flags +dnl (LIBS / LDFLAGS) to use a given library. This can take several +dnl iterations before it succeeds and is thus *very* slow. So what we do +dnl instead is that we compile the code first (and thus get an object file, +dnl typically conftest.o). Then we try various combinations of link flags +dnl until we succeed to link conftest.o in an executable. The problem is +dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always +dnl remove all the temporary files including conftest.o. So the trick here +dnl is to temporarily change the value of ac_objext so that conftest.o is +dnl preserved accross tests. This is obviously fragile and I will burn in +dnl hell for not respecting Autoconf's documented interfaces, but in the +dnl mean time, it optimizes the macro by a factor of 5 to 30. +dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left +dnl empty because the test file is generated only once above (before we +dnl start the for loops). + AC_COMPILE_IFELSE([], + [ac_objext=do_not_rm_me_plz], + [AC_MSG_ERROR([cannot compile a test that uses Boost $1])]) + ac_objext=$boost_save_ac_objext + boost_failed_libs= +# Don't bother to ident the 6 nested for loops, only the 2 innermost ones +# matter. +for boost_tag_ in -$boost_cv_lib_tag ''; do +for boost_ver_ in -$boost_cv_lib_version ''; do +for boost_mt_ in $boost_mt -mt ''; do +for boost_rtopt_ in $boost_rtopt '' -d; do + for boost_lib in \ + boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ + boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \ + boost_$1$boost_tag_$boost_mt_$boost_ver_ \ + boost_$1$boost_tag_$boost_ver_ + do + # Avoid testing twice the same lib + case $boost_failed_libs in #( + *@$boost_lib@*) continue;; + esac + # If with_boost is empty, we'll search in /lib first, which is not quite + # right so instead we'll try to a location based on where the headers are. + boost_tmp_lib=$with_boost + test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} + for boost_ldpath in "$boost_tmp_lib/lib" '' \ + /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \ + "$with_boost" C:/Boost/lib /lib* + do + test -e "$boost_ldpath" || continue + boost_save_LDFLAGS=$LDFLAGS + # Are we looking for a static library? + case $boost_ldpath:$boost_rtopt_ in #( + *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) + Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext" + test -e "$Boost_lib_LIBS" || continue;; #( + *) # No: use -lboost_foo to find the shared library. + Boost_lib_LIBS="-l$boost_lib";; + esac + boost_save_LIBS=$LIBS + LIBS="$Boost_lib_LIBS $LIBS" + test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" +dnl First argument of AC_LINK_IFELSE left empty because the test file is +dnl generated only once above (before we start the for loops). + _BOOST_AC_LINK_IFELSE([], + [Boost_lib=yes], [Boost_lib=no]) + ac_objext=$boost_save_ac_objext + LDFLAGS=$boost_save_LDFLAGS + LIBS=$boost_save_LIBS + if test x"$Boost_lib" = xyes; then +# Because Boost is often installed in non-standard locations we want to +# hardcode the path to the library (with rpath). Here we assume that +# Libtool's macro was already invoked so we can steal its variable +# hardcode_libdir_flag_spec in order to get the right flags for ld. + boost_save_libdir=$libdir + libdir=$boost_ldpath + eval boost_rpath=\"$hardcode_libdir_flag_spec\" + libdir=$boost_save_libdir + Boost_lib_LDFLAGS="-L$boost_ldpath $boost_rpath" + Boost_lib_LDPATH="$boost_ldpath" + break 6 + else + boost_failed_libs="$boost_failed_libs@$boost_lib@" + fi + done + done +done +done +done +done +rm -f conftest.$ac_objext +]) +case $Boost_lib in #( + no) _AC_MSG_LOG_CONFTEST + AC_MSG_ERROR([cannot find the flags to link with Boost $1]) + ;; +esac +AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl +AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl +AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl +AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl +CPPFLAGS=$boost_save_CPPFLAGS +AS_VAR_POPDEF([Boost_lib])dnl +AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl +AS_VAR_POPDEF([Boost_lib_LDPATH])dnl +AS_VAR_POPDEF([Boost_lib_LIBS])dnl +AC_LANG_POP([C++])dnl +fi +])# BOOST_FIND_LIB + + +# --------------------------------------- # +# Checks for the various Boost libraries. # +# --------------------------------------- # + +# List of boost libraries: http://www.boost.org/libs/libraries.htm +# The page http://beta.boost.org/doc/libs is useful: it gives the first release +# version of each library (among other things). + +# BOOST_DEFUN(LIBRARY, CODE) +# -------------------------- +# Define BOOST_ as a macro that runs CODE. +# +# Use indir to avoid the warning on underquoted macro name given to AC_DEFUN. +m4_define([BOOST_DEFUN], +[m4_indir([AC_DEFUN], + m4_toupper([BOOST_$1]), +[m4_pushdef([BOOST_Library], [$1])dnl +$2 +m4_popdef([BOOST_Library])dnl +]) +]) + +# BOOST_ARRAY() +# ------------- +# Look for Boost.Array +BOOST_DEFUN([Array], +[BOOST_FIND_HEADER([boost/array.hpp])]) + + +# BOOST_ASIO() +# ------------ +# Look for Boost.Asio (new in Boost 1.35). +BOOST_DEFUN([Asio], +[AC_REQUIRE([BOOST_SYSTEM])dnl +BOOST_FIND_HEADER([boost/asio.hpp])]) + + +# BOOST_BIND() +# ------------ +# Look for Boost.Bind +BOOST_DEFUN([Bind], +[BOOST_FIND_HEADER([boost/bind.hpp])]) + + +# BOOST_CONVERSION() +# ------------------ +# Look for Boost.Conversion (cast / lexical_cast) +BOOST_DEFUN([Conversion], +[BOOST_FIND_HEADER([boost/cast.hpp]) +BOOST_FIND_HEADER([boost/lexical_cast.hpp]) +])# BOOST_CONVERSION + + +# BOOST_DATE_TIME([PREFERRED-RT-OPT]) +# ----------------------------------- +# Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Date_Time], +[BOOST_FIND_LIB([date_time], [$1], + [boost/date_time/posix_time/posix_time.hpp], + [boost::posix_time::ptime t;]) +])# BOOST_DATE_TIME + + +# BOOST_FILESYSTEM([PREFERRED-RT-OPT]) +# ------------------------------------ +# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see +# the documentation of BOOST_FIND_LIB above. +# Do not check for boost/filesystem.hpp because this file was introduced in +# 1.34. +BOOST_DEFUN([Filesystem], +[# Do we have to check for Boost.System? This link-time dependency was +# added as of 1.35.0. If we have a version <1.35, we must not attempt to +# find Boost.System as it didn't exist by then. +if test $boost_major_version -ge 135; then +BOOST_SYSTEM([$1]) +fi # end of the Boost.System check. +boost_filesystem_save_LIBS=$LIBS +boost_filesystem_save_LDFLAGS=$LDFLAGS +m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl +LIBS="$LIBS $BOOST_SYSTEM_LIBS" +LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" +BOOST_FIND_LIB([filesystem], [$1], + [boost/filesystem/path.hpp], [boost::filesystem::path p;]) +if test $enable_static_boost = yes && test $boost_major_version -ge 135; then + AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"]) +fi +LIBS=$boost_filesystem_save_LIBS +LDFLAGS=$boost_filesystem_save_LDFLAGS +])# BOOST_FILESYSTEM + + +# BOOST_FOREACH() +# --------------- +# Look for Boost.Foreach +BOOST_DEFUN([Foreach], +[BOOST_FIND_HEADER([boost/foreach.hpp])]) + + +# BOOST_FORMAT() +# -------------- +# Look for Boost.Format +# Note: we can't check for boost/format/format_fwd.hpp because the header isn't +# standalone. It can't be compiled because it triggers the following error: +# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std' +# does not name a type +BOOST_DEFUN([Format], +[BOOST_FIND_HEADER([boost/format.hpp])]) + + +# BOOST_FUNCTION() +# ---------------- +# Look for Boost.Function +BOOST_DEFUN([Function], +[BOOST_FIND_HEADER([boost/function.hpp])]) + + +# BOOST_GRAPH([PREFERRED-RT-OPT]) +# ------------------------------- +# Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Graph], +[BOOST_FIND_LIB([graph], [$1], + [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;]) +])# BOOST_GRAPH + + +# BOOST_IOSTREAMS([PREFERRED-RT-OPT]) +# ----------------------------------- +# Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([IOStreams], +[BOOST_FIND_LIB([iostreams], [$1], + [boost/iostreams/device/file_descriptor.hpp], + [boost::iostreams::file_descriptor fd; fd.close();]) +])# BOOST_IOSTREAMS + + +# BOOST_HASH() +# ------------ +# Look for Boost.Functional/Hash +BOOST_DEFUN([Hash], +[BOOST_FIND_HEADER([boost/functional/hash.hpp])]) + + +# BOOST_LAMBDA() +# -------------- +# Look for Boost.Lambda +BOOST_DEFUN([Lambda], +[BOOST_FIND_HEADER([boost/lambda/lambda.hpp])]) + + +# BOOST_MATH() +# ------------ +# Look for Boost.Math +# TODO: This library isn't header-only but it comes in multiple different +# flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99, +# libboost_math_c99f, libboost_math_c99l, libboost_math_tr1, +# libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the +# right thing anyway. +BOOST_DEFUN([Math], +[BOOST_FIND_HEADER([boost/math/special_functions.hpp])]) + + +# BOOST_MULTIARRAY() +# ------------------ +# Look for Boost.MultiArray +BOOST_DEFUN([MultiArray], +[BOOST_FIND_HEADER([boost/multi_array.hpp])]) + + +# BOOST_NUMERIC_CONVERSION() +# -------------------------- +# Look for Boost.NumericConversion (policy-based numeric conversion) +BOOST_DEFUN([Numeric_Conversion], +[BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp]) +])# BOOST_NUMERIC_CONVERSION + + +# BOOST_OPTIONAL() +# ---------------- +# Look for Boost.Optional +BOOST_DEFUN([Optional], +[BOOST_FIND_HEADER([boost/optional.hpp])]) + + +# BOOST_PREPROCESSOR() +# -------------------- +# Look for Boost.Preprocessor +BOOST_DEFUN([Preprocessor], +[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])]) + + +# BOOST_UNORDERED() +# ----------------- +# Look for Boost.Unordered +BOOST_DEFUN([Unordered], +[BOOST_FIND_HEADER([boost/unordered_map.hpp])]) + + +# BOOST_UUID() +# ------------ +# Look for Boost.Uuid +BOOST_DEFUN([Uuid], +[BOOST_FIND_HEADER([boost/uuid/uuid.hpp])]) + + +# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT]) +# ----------------------------------------- +# Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, +# see the documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Program_Options], +[BOOST_FIND_LIB([program_options], [$1], + [boost/program_options.hpp], + [boost::program_options::options_description d("test");]) +])# BOOST_PROGRAM_OPTIONS + + + +# _BOOST_PYTHON_CONFIG(VARIABLE, FLAG) +# ------------------------------------ +# Save VARIABLE, and define it via `python-config --FLAG`. +# Substitute BOOST_PYTHON_VARIABLE. +m4_define([_BOOST_PYTHON_CONFIG], +[AC_SUBST([BOOST_PYTHON_$1], + [`python-config --$2 2>/dev/null`])dnl +boost_python_save_$1=$$1 +$1="$$1 $BOOST_PYTHON_$1"]) + + +# BOOST_PYTHON([PREFERRED-RT-OPT]) +# -------------------------------- +# Look for Boost.Python. For the documentation of PREFERRED-RT-OPT, +# see the documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Python], +[_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes]) +_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags]) +_BOOST_PYTHON_CONFIG([LIBS], [libs]) +m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl +BOOST_FIND_LIB([python], [$1], + [boost/python.hpp], + [], [BOOST_PYTHON_MODULE(empty) {}]) +CPPFLAGS=$boost_python_save_CPPFLAGS +LDFLAGS=$boost_python_save_LDFLAGS +LIBS=$boost_python_save_LIBS +])# BOOST_PYTHON + + +# BOOST_REF() +# ----------- +# Look for Boost.Ref +BOOST_DEFUN([Ref], +[BOOST_FIND_HEADER([boost/ref.hpp])]) + + +# BOOST_REGEX([PREFERRED-RT-OPT]) +# ------------------------------- +# Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Regex], +[BOOST_FIND_LIB([regex], [$1], + [boost/regex.hpp], + [boost::regex exp("*"); boost::regex_match("foo", exp);]) +])# BOOST_REGEX + + +# BOOST_SERIALIZATION([PREFERRED-RT-OPT]) +# --------------------------------------- +# Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see +# the documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Serialization], +[BOOST_FIND_LIB([serialization], [$1], + [boost/archive/text_oarchive.hpp], + [std::ostream* o = 0; // Cheap way to get an ostream... + boost::archive::text_oarchive t(*o);]) +])# BOOST_SIGNALS + + +# BOOST_SIGNALS([PREFERRED-RT-OPT]) +# --------------------------------- +# Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Signals], +[BOOST_FIND_LIB([signals], [$1], + [boost/signal.hpp], + [boost::signal s;]) +])# BOOST_SIGNALS + + +# BOOST_SMART_PTR() +# ----------------- +# Look for Boost.SmartPtr +BOOST_DEFUN([Smart_Ptr], +[BOOST_FIND_HEADER([boost/scoped_ptr.hpp]) +BOOST_FIND_HEADER([boost/shared_ptr.hpp]) +]) + + +# BOOST_STATICASSERT() +# -------------------- +# Look for Boost.StaticAssert +BOOST_DEFUN([StaticAssert], +[BOOST_FIND_HEADER([boost/static_assert.hpp])]) + + +# BOOST_STRING_ALGO() +# ------------------- +# Look for Boost.StringAlgo +BOOST_DEFUN([String_Algo], +[BOOST_FIND_HEADER([boost/algorithm/string.hpp]) +]) + + +# BOOST_SYSTEM([PREFERRED-RT-OPT]) +# -------------------------------- +# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. This library was introduced in Boost +# 1.35.0. +BOOST_DEFUN([System], +[BOOST_FIND_LIB([system], [$1], + [boost/system/error_code.hpp], + [boost::system::error_code e; e.clear();]) +])# BOOST_SYSTEM + + +# BOOST_TEST([PREFERRED-RT-OPT]) +# ------------------------------ +# Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Test], +[m4_pattern_allow([^BOOST_CHECK$])dnl +BOOST_FIND_LIB([unit_test_framework], [$1], + [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);], + [using boost::unit_test::test_suite; + test_suite* init_unit_test_suite(int argc, char ** argv) + { return NULL; }]) +])# BOOST_TEST + + +# BOOST_THREADS([PREFERRED-RT-OPT]) +# --------------------------------- +# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +# FIXME: Provide an alias "BOOST_THREAD". +BOOST_DEFUN([Threads], +[dnl Having the pthread flag is required at least on GCC3 where +dnl boost/thread.hpp would complain if we try to compile without +dnl -pthread on GNU/Linux. +AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl +boost_threads_save_LIBS=$LIBS +boost_threads_save_CPPFLAGS=$CPPFLAGS +LIBS="$LIBS $boost_cv_pthread_flag" +# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, +# boost/thread.hpp will trigger a #error if -pthread isn't used: +# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support +# is not turned on. Please set the correct command line options for +# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" +CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" +BOOST_FIND_LIB([thread], [$1], + [boost/thread.hpp], [boost::thread t; boost::mutex m;]) +BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag" +BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" +LIBS=$boost_threads_save_LIBS +CPPFLAGS=$boost_threads_save_CPPFLAGS +])# BOOST_THREADS + + +# BOOST_TOKENIZER() +# ----------------- +# Look for Boost.Tokenizer +BOOST_DEFUN([Tokenizer], +[BOOST_FIND_HEADER([boost/tokenizer.hpp])]) + + +# BOOST_TRIBOOL() +# --------------- +# Look for Boost.Tribool +BOOST_DEFUN([Tribool], +[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp]) +BOOST_FIND_HEADER([boost/logic/tribool.hpp]) +]) + + +# BOOST_TUPLE() +# ------------- +# Look for Boost.Tuple +BOOST_DEFUN([Tuple], +[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])]) + + +# BOOST_TYPETRAITS() +# -------------------- +# Look for Boost.TypeTraits +BOOST_DEFUN([TypeTraits], +[BOOST_FIND_HEADER([boost/type_traits.hpp])]) + + +# BOOST_UTILITY() +# --------------- +# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom, +# etc.) +BOOST_DEFUN([Utility], +[BOOST_FIND_HEADER([boost/utility.hpp])]) + + +# BOOST_VARIANT() +# --------------- +# Look for Boost.Variant. +BOOST_DEFUN([Variant], +[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp]) +BOOST_FIND_HEADER([boost/variant.hpp])]) + + +# BOOST_WAVE([PREFERRED-RT-OPT]) +# ------------------------------ +# NOTE: If you intend to use Wave/Spirit with thread support, make sure you +# call BOOST_THREADS first. +# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +BOOST_DEFUN([Wave], +[AC_REQUIRE([BOOST_FILESYSTEM])dnl +AC_REQUIRE([BOOST_DATE_TIME])dnl +boost_wave_save_LIBS=$LIBS +boost_wave_save_LDFLAGS=$LDFLAGS +m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl +LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS\ +$BOOST_THREAD_LIBS" +LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS\ +$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS" +BOOST_FIND_LIB([wave], [$1], + [boost/wave.hpp], + [boost::wave::token_id id; get_token_name(id);]) +LIBS=$boost_wave_save_LIBS +LDFLAGS=$boost_wave_save_LDFLAGS +])# BOOST_WAVE + + +# BOOST_XPRESSIVE() +# ----------------- +# Look for Boost.Xpressive (new since 1.36.0). +BOOST_DEFUN([Xpressive], +[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])]) + + +# ----------------- # +# Internal helpers. # +# ----------------- # + + +# _BOOST_PTHREAD_FLAG() +# --------------------- +# Internal helper for BOOST_THREADS. Based on ACX_PTHREAD: +# http://autoconf-archive.cryp.to/acx_pthread.html +AC_DEFUN([_BOOST_PTHREAD_FLAG], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_LANG_PUSH([C++])dnl +AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag], +[ boost_cv_pthread_flag= + # The ordering *is* (sometimes) important. Some notes on the + # individual items follow: + # (none): in case threads are in libc; should be tried before -Kthread and + # other compiler flags to prevent continual compiler warnings + # -lpthreads: AIX (must check this before -lpthread) + # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) + # -pthreads: Solaris/GCC + # -mthreads: MinGW32/GCC, Lynx/GCC + # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it + # doesn't hurt to check since this sometimes defines pthreads too; + # also defines -D_REENTRANT) + # ... -mt is also the pthreads flag for HP/aCC + # -lpthread: GNU Linux, etc. + # --thread-safe: KAI C++ + case $host_os in #( + *solaris*) + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #( + *) + boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \ + -pthreads -mthreads -lpthread --thread-safe -mt";; + esac + # Generate the test file. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0);])]) + for boost_pthread_flag in '' $boost_pthread_flags; do + boost_pthread_ok=false +dnl Re-use the test file already generated. + boost_pthreads__save_LIBS=$LIBS + LIBS="$LIBS $boost_pthread_flag" + AC_LINK_IFELSE([], + [if grep ".*$boost_pthread_flag" conftest.err; then + echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD + else + boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag + fi]) + LIBS=$boost_pthreads__save_LIBS + $boost_pthread_ok && break + done +]) +AC_LANG_POP([C++])dnl +])# _BOOST_PTHREAD_FLAG + + +# _BOOST_gcc_test(MAJOR, MINOR) +# ----------------------------- +# Internal helper for _BOOST_FIND_COMPILER_TAG. +m4_define([_BOOST_gcc_test], +["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl + + +# _BOOST_FIND_COMPILER_TAG() +# -------------------------- +# Internal. When Boost is installed without --layout=system, each library +# filename will hold a suffix that encodes the compiler used during the +# build. The Boost build system seems to call this a `tag'. +AC_DEFUN([_BOOST_FIND_COMPILER_TAG], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag], +[boost_cv_lib_tag=unknown +if test x$boost_cv_inc_path != xno; then + AC_LANG_PUSH([C++])dnl + # The following tests are mostly inspired by boost/config/auto_link.hpp + # The list is sorted to most recent/common to oldest compiler (in order + # to increase the likelihood of finding the right compiler with the + # least number of compilation attempt). + # Beware that some tests are sensible to the order (for instance, we must + # look for MinGW before looking for GCC3). + # I used one compilation test per compiler with a #error to recognize + # each compiler so that it works even when cross-compiling (let me know + # if you know a better approach). + # Known missing tags (known from Boost's tools/build/v2/tools/common.jam): + # como, edg, kcc, bck, mp, sw, tru, xlc + # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines + # the same defines as GCC's). + for i in \ + _BOOST_gcc_test(4, 6) \ + _BOOST_gcc_test(4, 5) \ + _BOOST_gcc_test(4, 4) \ + _BOOST_gcc_test(4, 3) \ + _BOOST_gcc_test(4, 2) \ + _BOOST_gcc_test(4, 1) \ + _BOOST_gcc_test(4, 0) \ + "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \ + && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ + || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \ + _BOOST_gcc_test(3, 4) \ + _BOOST_gcc_test(3, 3) \ + "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ + "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ + _BOOST_gcc_test(3, 2) \ + "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ + _BOOST_gcc_test(3, 1) \ + _BOOST_gcc_test(3, 0) \ + "defined __BORLANDC__ @ bcb" \ + "defined __ICC && (defined __unix || defined __unix__) @ il" \ + "defined __ICL @ iw" \ + "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ + _BOOST_gcc_test(2, 95) \ + "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ + "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \ + "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \ + "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8" + do + boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '` + boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if $boost_tag_test +/* OK */ +#else +# error $boost_tag_test +#endif +]])], [boost_cv_lib_tag=$boost_tag; break], []) + done +AC_LANG_POP([C++])dnl + case $boost_cv_lib_tag in #( + # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed + # to "gcc41" for instance. + *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there. + gcc*) + boost_tag_x= + case $host_os in #( + darwin*) + if test $boost_major_version -ge 136; then + # The `x' added in r46793 of Boost. + boost_tag_x=x + fi;; + esac + # We can specify multiple tags in this variable because it's used by + # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... + boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" + ;; #( + unknown) + AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]]) + boost_cv_lib_tag= + ;; + esac +fi])dnl end of AC_CACHE_CHECK +])# _BOOST_FIND_COMPILER_TAG + + +# _BOOST_GUESS_WHETHER_TO_USE_MT() +# -------------------------------- +# Compile a small test to try to guess whether we should favor MT (Multi +# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly. +AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT], +[# Check whether we do better use `mt' even though we weren't ask to. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if defined _REENTRANT || defined _MT || defined __MT__ +/* use -mt */ +#else +# error MT not needed +#endif +]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false]) +]) + +# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------------- +# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile, +# will break when Autoconf changes its internals. Requires that you manually +# rm -f conftest.$ac_objext in between to really different tests, otherwise +# you will try to link a conftest.o left behind by a previous test. +# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this +# macro). +# +# Don't use "break" in the actions, as it would short-circuit some code +# this macro runs after the actions. +m4_define([_BOOST_AC_LINK_IFELSE], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +rm -f conftest$ac_exeext +boost_save_ac_ext=$ac_ext +boost_use_source=: +# If we already have a .o, re-use it. We change $ac_ext so that $ac_link +# tries to link the existing object file instead of compiling from source. +test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && + _AS_ECHO_LOG([re-using the existing conftest.$ac_objext]) +AS_IF([_AC_DO_STDERR($ac_link) && { + test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_executable_p conftest$ac_exeext +dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough. + }], + [$2], + [if $boost_use_source; then + _AC_MSG_LOG_CONFTEST + fi + $3]) +ac_objext=$boost_save_ac_objext +ac_ext=$boost_save_ac_ext +dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) +dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), +dnl as it would interfere with the next link command. +rm -f core conftest.err conftest_ipa8_conftest.oo \ + conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl +])# _BOOST_AC_LINK_IFELSE + +# Local Variables: +# mode: autoconf +# End: diff -Nru gearmand-0.14/m4/libdrizzle.m4 gearmand-0.23/m4/libdrizzle.m4 --- gearmand-0.14/m4/libdrizzle.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/libdrizzle.m4 2011-04-28 21:20:05.000000000 +0200 @@ -0,0 +1,17 @@ +AC_DEFUN([_WITH_LIBDRIZZLE], + [ AC_ARG_ENABLE([libdrizzle], + [AS_HELP_STRING([--disable-libdrizzle], + [Build with libdrizzle support @<:@default=on@:>@])], + [ac_enable_libdrizzle="$enableval"], + [ac_enable_libdrizzle="yes"]) + + AS_IF([test "x$ac_enable_libdrizzle" = "xyes"], + [ PKG_CHECK_MODULES([libdrizzle], + [ libdrizzle-1.0 >= 2011.03.13 ], + [AC_DEFINE([HAVE_LIBDRIZZLE], [ 1 ], [Enable libdrizzle support])], + [ac_enable_libdrizzle="no"] )]) + AM_CONDITIONAL(HAVE_LIBDRIZZLE, test "x${ac_enable_libdrizzle}" = "xyes") + ]) +]) + +AC_DEFUN([WITH_LIBDRIZZLE], [ AC_REQUIRE([_WITH_LIBDRIZZLE]) ]) diff -Nru gearmand-0.14/m4/libmemcached.m4 gearmand-0.23/m4/libmemcached.m4 --- gearmand-0.14/m4/libmemcached.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/libmemcached.m4 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,16 @@ +AC_DEFUN([_WITH_LIBMEMCACHED], + [ AC_ARG_ENABLE([libmemcached], + [AS_HELP_STRING([--disable-libmemcached], + [Build with libmemcached support @<:@default=on@:>@])], + [ac_enable_libmemcached="$enableval"], + [ac_enable_libmemcached="yes"]) + + AS_IF([test "x$ac_enable_libmemcached" = "xyes"], + [ PKG_CHECK_MODULES([libmemcached], [ libmemcached >= 0.42 ], + [AC_DEFINE([HAVE_LIBMEMCACHED], [ 1 ], [Enable libmemcached support])], + [ac_enable_libmemcached="no"] )]) + + AM_CONDITIONAL(HAVE_LIBMEMCACHED, test "x${ac_enable_libmemcached}" = "xyes") + ]) + +AC_DEFUN([WITH_LIBMEMCACHED], [ AC_REQUIRE([_WITH_LIBMEMCACHED]) ]) diff -Nru gearmand-0.14/m4/libtool.m4 gearmand-0.23/m4/libtool.m4 --- gearmand-0.14/m4/libtool.m4 2010-06-30 20:31:11.000000000 +0200 +++ gearmand-0.23/m4/libtool.m4 2011-06-24 09:14:11.000000000 +0200 @@ -1,7 +1,8 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -10,7 +11,8 @@ m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -37,7 +39,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) -# serial 56 LT_INIT +# serial 57 LT_INIT # LT_PREREQ(VERSION) @@ -66,6 +68,7 @@ # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl @@ -82,6 +85,8 @@ AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) @@ -118,7 +123,7 @@ *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) @@ -138,6 +143,9 @@ m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl @@ -179,7 +187,6 @@ _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) @@ -193,23 +200,6 @@ ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -250,6 +240,28 @@ ])# _LT_SETUP +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' @@ -408,7 +420,7 @@ # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS @@ -418,7 +430,7 @@ # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) @@ -517,12 +529,20 @@ LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -533,9 +553,9 @@ # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -543,16 +563,38 @@ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - _LT_OUTPUT_LIBTOOL_INIT ]) +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- @@ -562,20 +604,11 @@ AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - -lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 +lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo @@ -601,7 +634,7 @@ m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." @@ -646,15 +679,13 @@ # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT @@ -831,11 +862,13 @@ AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER @@ -940,6 +973,31 @@ [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -967,7 +1025,7 @@ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -987,7 +1045,11 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in @@ -995,7 +1057,7 @@ *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -1041,170 +1103,65 @@ # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + # _LT_PROG_ECHO_BACKSLASH # ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`print -r -- -n 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' fi -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) -AC_SUBST(lt_ECHO) -]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH @@ -1236,7 +1193,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in @@ -1388,10 +1345,19 @@ esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE @@ -1416,15 +1382,15 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1464,7 +1430,7 @@ if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1527,6 +1493,11 @@ lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -1591,8 +1562,8 @@ # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -1643,7 +1614,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" +[#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -1684,7 +1655,13 @@ # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +void fnord () __attribute__((visibility("default"))); +#endif + +void fnord () { int i=42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -1693,7 +1670,11 @@ if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -1869,16 +1850,16 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes @@ -2037,6 +2018,7 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ @@ -2045,16 +2027,23 @@ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -2067,7 +2056,7 @@ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -2087,7 +2076,13 @@ if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) @@ -2175,7 +2170,7 @@ m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -2228,23 +2223,12 @@ cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' @@ -2344,6 +2328,19 @@ hardcode_into_libs=yes ;; +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. @@ -2386,8 +2383,10 @@ soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[[3-9]]*) @@ -2445,7 +2444,7 @@ ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -2454,16 +2453,21 @@ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -2475,8 +2479,9 @@ # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2708,6 +2713,8 @@ The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], @@ -2820,6 +2827,7 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], @@ -2949,8 +2957,8 @@ fi ;; esac -_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl -_LT_DECL([], [reload_cmds], [2])dnl +_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl +_LT_TAGDECL([], [reload_cmds], [2])dnl ])# _LT_CMD_RELOAD @@ -3002,16 +3010,18 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -3041,6 +3051,10 @@ lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -3049,11 +3063,11 @@ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -3075,7 +3089,7 @@ ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -3217,7 +3231,19 @@ NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -3230,13 +3256,13 @@ AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -3259,7 +3285,7 @@ [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -3287,7 +3313,12 @@ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, @@ -3304,6 +3335,7 @@ m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl @@ -3429,7 +3461,7 @@ if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -3591,6 +3623,11 @@ # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. @@ -3696,7 +3733,7 @@ ;; esac ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -3729,8 +3766,8 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' @@ -3792,7 +3829,7 @@ ;; solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -3896,6 +3933,12 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -3938,6 +3981,13 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -3980,7 +4030,7 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -4001,7 +4051,7 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4013,25 +4063,25 @@ # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker + *Sun\ C*) + # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; @@ -4063,7 +4113,7 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; @@ -4173,8 +4223,10 @@ aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -4252,7 +4304,33 @@ esac _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -4270,6 +4348,7 @@ fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -4285,11 +4364,12 @@ _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -4325,6 +4405,7 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -4346,6 +4427,11 @@ fi ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4361,7 +4447,7 @@ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -4375,11 +4461,12 @@ tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4390,13 +4477,17 @@ lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -4412,17 +4503,17 @@ fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -4543,8 +4634,10 @@ else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -4633,7 +4726,7 @@ # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -4648,8 +4741,13 @@ # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -4688,7 +4786,7 @@ # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. @@ -4755,7 +4853,7 @@ ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' @@ -4774,7 +4872,7 @@ ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -4795,7 +4893,14 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi @@ -4823,19 +4928,19 @@ irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4897,17 +5002,17 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4917,13 +5022,13 @@ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5114,36 +5219,38 @@ # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi @@ -5313,37 +5420,21 @@ ])# _LT_LANG_C_CONFIG -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no @@ -5365,6 +5456,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -5467,7 +5560,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -5579,7 +5672,7 @@ _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -5594,8 +5687,13 @@ # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. @@ -5628,6 +5726,7 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -5688,6 +5787,11 @@ gnu*) ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: @@ -5712,7 +5816,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -5777,7 +5881,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -5820,7 +5924,7 @@ case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -5831,9 +5935,9 @@ *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -5844,7 +5948,7 @@ _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -5862,7 +5966,7 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5899,26 +6003,26 @@ pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; - *) # Version 6 will use weak symbols + *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; @@ -5926,7 +6030,7 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ @@ -5945,9 +6049,9 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; - xl*) + xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5967,13 +6071,13 @@ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6042,7 +6146,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6077,15 +6181,15 @@ case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; @@ -6101,17 +6205,17 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -6121,7 +6225,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -6157,7 +6261,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -6178,7 +6282,7 @@ esac _LT_TAGVAR(link_all_deplibs, $1)=yes - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6205,7 +6309,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. @@ -6216,7 +6320,7 @@ # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' @@ -6270,6 +6374,10 @@ CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -6516,7 +6624,7 @@ solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as @@ -6560,32 +6668,16 @@ ])# _LT_SYS_HIDDEN_LIBDEPS -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6604,6 +6696,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6703,32 +6797,17 @@ ])# _LT_LANG_F77_CONFIG -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6747,6 +6826,8 @@ _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6892,6 +6973,8 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7259,7 +7342,7 @@ func_dirname () { # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else @@ -7270,7 +7353,7 @@ # func_basename file func_basename () { - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` + func_basename_result=`$ECHO "${1}" | $SED "$basename"` } dnl func_dirname_and_basename @@ -7286,10 +7369,8 @@ func_stripname () { case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } @@ -7300,20 +7381,20 @@ # func_opt_split func_opt_split () { - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` + func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_xform libobj-or-source func_xform () { - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` + func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... diff -Nru gearmand-0.14/m4/lt~obsolete.m4 gearmand-0.23/m4/lt~obsolete.m4 --- gearmand-0.14/m4/lt~obsolete.m4 2010-06-30 20:31:13.000000000 +0200 +++ gearmand-0.23/m4/lt~obsolete.m4 2011-06-24 09:14:12.000000000 +0200 @@ -1,13 +1,13 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 4 lt~obsolete.m4 +# serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # @@ -77,7 +77,6 @@ m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) @@ -90,3 +89,10 @@ m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff -Nru gearmand-0.14/m4/ltoptions.m4 gearmand-0.23/m4/ltoptions.m4 --- gearmand-0.14/m4/ltoptions.m4 2010-06-30 20:31:12.000000000 +0200 +++ gearmand-0.23/m4/ltoptions.m4 2011-06-24 09:14:11.000000000 +0200 @@ -1,13 +1,14 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 6 ltoptions.m4 +# serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -125,7 +126,7 @@ [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) @@ -133,13 +134,13 @@ esac test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl +_LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], diff -Nru gearmand-0.14/m4/ltversion.m4 gearmand-0.23/m4/ltversion.m4 --- gearmand-0.14/m4/ltversion.m4 2010-06-30 20:31:12.000000000 +0200 +++ gearmand-0.23/m4/ltversion.m4 2011-06-24 09:14:12.000000000 +0200 @@ -9,15 +9,15 @@ # Generated from ltversion.in. -# serial 3017 ltversion.m4 +# serial 3175 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.6b]) -m4_define([LT_PACKAGE_REVISION], [1.3017]) +m4_define([LT_PACKAGE_VERSION], [2.2.10]) +m4_define([LT_PACKAGE_REVISION], [1.3175]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6b' -macro_revision='1.3017' +[macro_version='2.2.10' +macro_revision='1.3175' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff -Nru gearmand-0.14/m4/memcached.m4 gearmand-0.23/m4/memcached.m4 --- gearmand-0.14/m4/memcached.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/memcached.m4 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,28 @@ +AC_DEFUN([WITH_MEMCACHED], + [AC_ARG_WITH([memcached], + [AS_HELP_STRING([--with-memcached], + [Memcached binary to use for make test])], + [ac_cv_with_memcached="$withval"], + [ac_cv_with_memcached=memcached]) + + # just ignore the user if --without-memcached is passed.. it is + # only used by make test + AS_IF([test "x$withval" = "xno"], + [ + ac_cv_with_memcached=memcached + MEMCACHED_BINARY=memcached + ], + [ + AS_IF([test -f "$withval"], + [ + ac_cv_with_memcached=$withval + MEMCACHED_BINARY=$withval + ], + [ + AC_PATH_PROG([MEMCACHED_BINARY], [$ac_cv_with_memcached], "no") + ]) + ]) + AM_CONDITIONAL(HAVE_MEMCACHED, test "x${ac_cv_with_memcached}" != "xno") + AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMCACHED_BINARY", [Name of the memcached binary used in make test]) + AC_SUBST(MEMCACHED_BINARY) +]) diff -Nru gearmand-0.14/m4/pandora_64bit.m4 gearmand-0.23/m4/pandora_64bit.m4 --- gearmand-0.14/m4/pandora_64bit.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_64bit.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -20,9 +20,9 @@ [isainfo_b=`${ISAINFO} -b`], [isainfo_b="x"]) - AS_IF([test "$isainfo_b" != "x"],[ + AS_IF([test "$isainfo_b" != "x" -a "$isainfo_b" != "32"],[ - isainfo_k=`${ISAINFO} -k` + isainfo_k=`${ISAINFO} -k` DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}" AS_IF([test "x$ac_enable_64bit" = "xyes"],[ @@ -32,7 +32,7 @@ ]) AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[ - dnl The user hasn't overridden the default libdir, so we'll + dnl The user hasn't overridden the default libdir, so we'll dnl the dir suffix to match solaris 32/64-bit policy libdir="${libdir}/${isainfo_k}" ]) diff -Nru gearmand-0.14/m4/pandora_canonical.m4 gearmand-0.23/m4/pandora_canonical.m4 --- gearmand-0.14/m4/pandora_canonical.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_canonical.m4 2011-06-03 04:13:30.000000000 +0200 @@ -1,10 +1,18 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Which version of the canonical setup we're using -AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.120]) +AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.177]) + +AC_DEFUN([PANDORA_MSG_ERROR],[ + AS_IF([test "x${pandora_cv_skip_requires}" != "xno"],[ + AC_MSG_ERROR($1) + ],[ + AC_MSG_WARN($1) + ]) +]) AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[ AC_ARG_ENABLE([fat-binaries], @@ -23,6 +31,12 @@ ]) ]) +AC_DEFUN([PANDORA_BLOCK_BAD_OPTIONS],[ + AS_IF([test "x${prefix}" = "x"],[ + PANDORA_MSG_ERROR([--prefix requires an argument]) + ]) +]) + dnl The standard setup for how we build Pandora projects AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AC_REQUIRE([PANDORA_FORCE_DEPEND_TRACKING]) @@ -32,6 +46,7 @@ m4_define([PCT_REQUIRE_CXX],[no]) m4_define([PCT_FORCE_GCC42],[no]) m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no]) + m4_define([PCT_NO_VC_CHANGELOG],[no]) m4_define([PCT_VERSION_FROM_VC],[no]) m4_define([PCT_USE_VISIBILITY],[yes]) m4_foreach([pct_arg],[$*],[ @@ -52,6 +67,10 @@ m4_undefine([PCT_DONT_SUPPRESS_INCLUDE]) m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes]) ], + [no-vc-changelog], [ + m4_undefine([PCT_NO_VC_CHANGELOG]) + m4_define([PCT_NO_VC_CHANGELOG],[yes]) + ], [version-from-vc], [ m4_undefine([PCT_VERSION_FROM_VC]) m4_define([PCT_VERSION_FROM_VC],[yes]) @@ -66,6 +85,8 @@ AC_CONFIG_HEADERS([config.h]) ]) + PANDORA_BLOCK_BAD_OPTIONS + # We need to prevent canonical target # from injecting -O2 into CFLAGS - but we won't modify anything if we have # set CFLAGS on the command line, since that should take ultimate precedence @@ -77,25 +98,46 @@ AC_CANONICAL_TARGET m4_if(PCT_DONT_SUPRESS_INCLUDE,yes,[ - AM_INIT_AUTOMAKE(-Wall -Werror subdir-objects foreign) + AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar) ],[ - AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects foreign) + AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability nostdinc subdir-objects foreign tar-ustar) ]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[ gl_EARLY + ],[ + PANDORA_EXTENSIONS ]) AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([PANDORA_MAC_GCC42]) + m4_if(PCT_FORCE_GCC42, [yes], [ + AC_REQUIRE([PANDORA_ENSURE_GCC_VERSION]) + ]) AC_REQUIRE([PANDORA_64BIT]) + m4_if(PCT_NO_VC_CHANGELOG,yes,[ + vc_changelog=no + ],[ + vc_changelog=yes + ]) m4_if(PCT_VERSION_FROM_VC,yes,[ - PANDORA_VC_VERSION + PANDORA_VC_INFO_HEADER ],[ PANDORA_TEST_VC_DIR + + changequote(<<, >>)dnl + PANDORA_RELEASE_ID=`echo $VERSION | sed 's/[^0-9]//g'` + changequote([, ])dnl + + PANDORA_RELEASE_COMMENT="" + AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["$VERSION"], + [Version of the software]) + + AC_SUBST(PANDORA_RELEASE_COMMENT) + AC_SUBST(PANDORA_RELEASE_VERSION) + AC_SUBST(PANDORA_RELEASE_ID) ]) PANDORA_VERSION @@ -106,9 +148,6 @@ AM_PROG_CC_C_O - m4_if(PCT_FORCE_GCC42, [yes], [ - AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION) - ]) PANDORA_PLATFORM @@ -120,10 +159,11 @@ PANDORA_CHECK_CXX_STANDARD m4_if(PCT_REQUIRE_CXX, [yes], [ AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[ - AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98]) + PANDORA_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98]) ]) - ]) + PANDORA_CXX_CSTDINT + PANDORA_CXX_CINTTYPES m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[ gl_INIT @@ -145,15 +185,17 @@ AC_SYS_LARGEFILE PANDORA_CLOCK_GETTIME + AC_CHECK_HEADERS(sys/socket.h) + # off_t is not a builtin type AC_CHECK_SIZEOF(off_t, 4) AS_IF([test "$ac_cv_sizeof_off_t" -eq 0],[ - AC_MSG_ERROR("${PACKAGE} needs an off_t type.") + PANDORA_MSG_ERROR("${PACKAGE} needs an off_t type.") ]) AC_CHECK_SIZEOF(size_t) AS_IF([test "$ac_cv_sizeof_size_t" -eq 0],[ - AC_MSG_ERROR("${PACKAGE} needs an size_t type.") + PANDORA_MSG_ERROR("${PACKAGE} needs an size_t type.") ]) AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()]) @@ -177,7 +219,28 @@ AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned]) ]) + AC_CACHE_CHECK([if system defines RUSAGE_THREAD], [ac_cv_rusage_thread],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[ +#include +#include + ]],[[ + int x= RUSAGE_THREAD; + ]]) + ],[ + ac_cv_rusage_thread=yes + ],[ + ac_cv_rusage_thread=no + ]) + ]) + AS_IF([test "$ac_cv_rusage_thread" = "no"],[ + AC_DEFINE([RUSAGE_THREAD], [RUSAGE_SELF], + [Define if system doesn't define]) + ]) + AC_CHECK_LIBM + dnl Bug on FreeBSD - LIBM check doesn't set the damn variable + AC_SUBST([LIBM]) AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)]) AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)]) @@ -200,11 +263,9 @@ PANDORA_HAVE_GCC_ATOMICS m4_if(PCT_USE_VISIBILITY,[yes],[ - dnl We need to inject error into the cflags to test if visibility works or not - save_CFLAGS="${CFLAGS}" - CFLAGS="${CFLAGS} -Werror" - PANDORA_VISIBILITY - CFLAGS="${save_CFLAGS}" + PANDORA_ENABLE_VISIBILITY + ],[ + PANDORA_CHECK_VISIBILITY ]) PANDORA_HEADER_ASSERT @@ -215,14 +276,28 @@ AC_LIB_PREFIX PANDORA_HAVE_BETTER_MALLOC + PANDORA_WITH_VALGRIND AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROGS([PERL], [perl]) AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:]) + AC_CHECK_PROGS([LCOV], [lcov], [echo lcov not found]) + AC_CHECK_PROGS([LCOV_GENHTML], [genhtml], [echo genhtml not found]) - AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"]) + AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build], [:]) + AS_IF([test "x${SPHINXBUILD}" != "x:"],[ + AC_CACHE_CHECK([if sphinx is new enough],[ac_cv_recent_sphinx],[ + + ${SPHINXBUILD} -Q -C -b man -d conftest.d . . >/dev/null 2>&1 + AS_IF([test $? -eq 0],[ac_cv_recent_sphinx=yes], + [ac_cv_recent_sphinx=no]) + rm -rf conftest.d + ]) + ]) - PANDORA_WITH_GETTEXT + AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"]) + AM_CONDITIONAL(HAVE_SPHINX,[test "x${SPHINXBUILD}" != "x:"]) + AM_CONDITIONAL(HAVE_RECENT_SPHINX,[test "x${ac_cv_recent_sphinx}" = "xyes"]) AS_IF([test "x${gl_LIBOBJS}" != "x"],[ AS_IF([test "$GCC" = "yes"],[ @@ -239,6 +314,103 @@ PANDORA_USE_PIPE + AH_TOP([ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +/* _SYS_FEATURE_TESTS_H is Solaris, _FEATURES_H is GCC */ +#if defined( _SYS_FEATURE_TESTS_H) || defined(_FEATURES_H) +#error "You should include config.h as your first include file" +#endif + +]) + mkdir -p config + cat > config/top.h.stamp </dev/null 2>&1 || mv config/top.h.stamp config/top.h + rm -f config/top.h.stamp + + AH_BOTTOM([ +#if defined(__cplusplus) +# include CSTDINT_H +# include CINTTYPES_H +#else +# include +# include +#endif + +#if !defined(HAVE_ULONG) && !defined(__USE_MISC) +# define HAVE_ULONG 1 +typedef unsigned long int ulong; +#endif + +/* To hide the platform differences between MS Windows and Unix, I am + * going to use the Microsoft way and #define the Microsoft-specific + * functions to the unix way. Microsoft use a separate subsystem for sockets, + * but Unix normally just use a filedescriptor on the same functions. It is + * a lot easier to map back to the unix way with macros than going the other + * way without side effect ;-) + */ +#ifdef TARGET_OS_WINDOWS +#define random() rand() +#define srandom(a) srand(a) +#define get_socket_errno() WSAGetLastError() +#else +#define INVALID_SOCKET -1 +#define SOCKET_ERROR -1 +#ifdef __cplusplus +#define closesocket(a) ::close(a) +#else +#define closesocket(a) close(a) +#endif +#define get_socket_errno() errno +#endif // TARGET_OS_WINDOWS + +#ifndef HAVE_MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif // HAVE_MSG_NOSIGNAL + +#ifndef HAVE_MSG_DONTWAIT +#define MSG_DONTWAIT 0 +#endif // HAVE_MSG_DONTWAIT + +#if defined(__cplusplus) +# if defined(DEBUG) +# include +# include +# endif +template +inline To implicit_cast(From const &f) { + return f; +} +template // use like this: down_cast(foo); +inline To down_cast(From* f) { // so we only accept pointers + // Ensures that To is a sub-type of From *. This test is here only + // for compile-time type checking, and has no overhead in an + // optimized build at run-time, as it will be optimized away + // completely. + if (false) { + implicit_cast(0); + } + +#if defined(DEBUG) + assert(f == NULL || dynamic_cast(f) != NULL); // RTTI: debug mode only! +#endif + return static_cast(f); +} +#endif /* defined(__cplusplus) */ + +#endif /* __CONFIG_H__ */ + ]) AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" diff -Nru gearmand-0.14/m4/pandora_check_compiler_version.m4 gearmand-0.23/m4/pandora_check_compiler_version.m4 --- gearmand-0.14/m4/pandora_check_compiler_version.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_check_compiler_version.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru gearmand-0.14/m4/pandora_check_cxx_standard.m4 gearmand-0.23/m4/pandora_check_cxx_standard.m4 --- gearmand-0.14/m4/pandora_check_cxx_standard.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_check_cxx_standard.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,10 +1,10 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([PANDORA_CHECK_CXX_STANDARD],[ - AC_REQUIRE([AC_CXX_COMPILE_STDCXX_0X]) + dnl AC_REQUIRE([AC_CXX_COMPILE_STDCXX_0X]) AS_IF([test "$GCC" = "yes"], [AS_IF([test "$ac_cv_cxx_compile_cxx0x_native" = "yes"],[], [AS_IF([test "$ac_cv_cxx_compile_cxx0x_gxx" = "yes"], diff -Nru gearmand-0.14/m4/pandora_cinttypes.m4 gearmand-0.23/m4/pandora_cinttypes.m4 --- gearmand-0.14/m4/pandora_cinttypes.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/pandora_cinttypes.m4 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,39 @@ +# Copyright (C) 2008 Sun Microsystems, Inc. +# This file is free software; Sun Microsystems, Inc. +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# We check two things: where the include file is for cinttypes. We +# include AC_TRY_COMPILE for all the combinations we've seen in the +# wild. We define one of HAVE_CINTTYPES or HAVE_TR1_CINTTYPES or +# HAVE_BOOST_CINTTYPES depending +# on location. + +AC_DEFUN([PANDORA_CXX_CINTTYPES], + [AC_REQUIRE([PANDORA_CXX_CSTDINT]) + AC_MSG_CHECKING(the location of cinttypes) + AC_LANG_PUSH(C++) + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" + ac_cv_cxx_cinttypes="" + for location in tr1/cinttypes boost/cinttypes cinttypes; do + if test -z "$ac_cv_cxx_cinttypes"; then + AC_TRY_COMPILE([#include $ac_cv_cxx_cstdint; + #include <$location>], + [uint32_t foo= UINT32_C(1)], + [ac_cv_cxx_cinttypes="<$location>";]) + fi + done + AC_LANG_POP() + CXXFLAGS="${save_CXXFLAGS}" + if test -n "$ac_cv_cxx_cinttypes"; then + AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) + else + ac_cv_cxx_cinttypes="" + AC_MSG_RESULT() + AC_MSG_WARN([Could not find a cinttypes header.]) + fi + AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++]) + AC_DEFINE_UNQUOTED(CINTTYPES_H,$ac_cv_cxx_cinttypes, + [the location of ]) +]) diff -Nru gearmand-0.14/m4/pandora_cstdint.m4 gearmand-0.23/m4/pandora_cstdint.m4 --- gearmand-0.14/m4/pandora_cstdint.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/pandora_cstdint.m4 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,38 @@ +# Copyright (C) 2008 Sun Microsystems, Inc. +# This file is free software; Sun Microsystems, Inc. +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# We check two things: where the include file is for cstdint. We +# include AC_TRY_COMPILE for all the combinations we've seen in the +# wild. We define one of HAVE_CSTDINT or HAVE_TR1_CSTDINT or +# HAVE_BOOST_CSTDINT depending +# on location. + +AC_DEFUN([PANDORA_CXX_CSTDINT], + [AC_MSG_CHECKING(the location of cstdint) + AC_LANG_PUSH(C++) + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" + ac_cv_cxx_cstdint="" + for location in tr1/cstdint boost/cstdint cstdint; do + if test -z "$ac_cv_cxx_cstdint"; then + AC_TRY_COMPILE([#include <$location>], + [uint32_t t], + [ac_cv_cxx_cstdint="<$location>";]) + fi + done + AC_LANG_POP() + CXXFLAGS="${save_CXXFLAGS}" + if test -n "$ac_cv_cxx_cstdint"; then + AC_MSG_RESULT([$ac_cv_cxx_cstdint]) + else + AC_DEFINE([__STDC_CONSTANT_MACROS],[1],[Use STDC Constant Macros in C++]) + AC_DEFINE([__STDC_FORMAT_MACROS],[1],[Use STDC Format Macros in C++]) + ac_cv_cxx_cstdint="" + AC_MSG_RESULT() + AC_MSG_WARN([Could not find a cstdint header.]) + fi + AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint, + [the location of ]) +]) diff -Nru gearmand-0.14/m4/pandora_enable_dtrace.m4 gearmand-0.23/m4/pandora_enable_dtrace.m4 --- gearmand-0.14/m4/pandora_enable_dtrace.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_enable_dtrace.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,32 +8,49 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([PANDORA_ENABLE_DTRACE],[ AC_ARG_ENABLE([dtrace], - [AS_HELP_STRING([--enable-dtrace], - [Build with support for the DTRACE. @<:@default=off@:>@])], - [ac_cv_enable_dtrace="yes"], - [ac_cv_enable_dtrace="no"]) + [AS_HELP_STRING([--disable-dtrace], + [Build with support for the DTRACE. @<:@default=on@:>@])], + [ac_cv_enable_dtrace="$enableval"], + [ac_cv_enable_dtrace="yes"]) AS_IF([test "$ac_cv_enable_dtrace" = "yes"],[ AC_CHECK_PROGS([DTRACE], [dtrace]) - AS_IF([test "x$ac_cv_prog_DTRACE" = "xdtrace"],[ - AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support]) - AC_MSG_CHECKING([if dtrace should instrument object files]) - dnl DTrace on MacOSX does not use -G option - cat >conftest.d <<_ACEOF + AC_CHECK_HEADERS(sys/sdt.h) + + AS_IF([test "x$ac_cv_prog_DTRACE" = "xdtrace" -a "x${ac_cv_header_sys_sdt_h}" = "xyes"],[ + + AC_CACHE_CHECK([if dtrace works],[ac_cv_dtrace_works],[ + cat >conftest.d <<_ACEOF +provider Example { + probe increment(int); +}; +_ACEOF + $DTRACE -h -o conftest.h -s conftest.d 2>/dev/zero + AS_IF([test $? -eq 0],[ac_cv_dtrace_works=yes], + [ac_cv_dtrace_works=no]) + rm -f conftest.h conftest.d + ]) + AS_IF([test "x$ac_cv_dtrace_works" = "xyes"],[ + AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support]) + ]) + AC_CACHE_CHECK([if dtrace should instrument object files], + [ac_cv_dtrace_needs_objects],[ + dnl DTrace on MacOSX does not use -G option + cat >conftest.d <<_ACEOF provider Example { probe increment(int); }; _ACEOF - $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero - AS_IF([test $? -eq 0],[ac_cv_dtrace_needs_objects=yes], + $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero + AS_IF([test $? -eq 0],[ac_cv_dtrace_needs_objects=yes], [ac_cv_dtrace_needs_objects=no]) - rm -f conftest.d.o conftest.d - AC_MSG_RESULT($ac_cv_dtrace_needs_objects) + rm -f conftest.d.o conftest.d + ]) AC_SUBST(DTRACEFLAGS) dnl TODO: test for -G on OSX ac_cv_have_dtrace=yes ])]) -AM_CONDITIONAL([HAVE_DTRACE], [test "x$ac_cv_have_dtrace" = "xyes"]) +AM_CONDITIONAL([HAVE_DTRACE], [test "x$ac_cv_dtrace_works" = "xyes"]) AM_CONDITIONAL([DTRACE_NEEDS_OBJECTS], [test "x$ac_cv_dtrace_needs_objects" = "xyes"]) diff -Nru gearmand-0.14/m4/pandora_ensure_gcc_version.m4 gearmand-0.23/m4/pandora_ensure_gcc_version.m4 --- gearmand-0.14/m4/pandora_ensure_gcc_version.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_ensure_gcc_version.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +0,0 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl If the user is on a Mac and didn't ask for a specific compiler -dnl You're gonna get 4.2. -AC_DEFUN([PANDORA_MAC_GCC42], - [AS_IF([test "$GCC" = "yes"],[ - AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[ - host_os_version=`echo ${host_os} | perl -ple 's/^\D+//g;s,\..*,,'` - AS_IF([test "$host_os_version" -lt 10],[ - AS_IF([test -f /usr/bin/gcc-4.2], - [ - CPP="/usr/bin/gcc-4.2 -E" - CC=/usr/bin/gcc-4.2 - CXX=/usr/bin/g++-4.2 - ]) - ]) - ]) - ]) -]) - -dnl -AC_DEFUN([PANDORA_ENSURE_GCC_VERSION],[ - AC_REQUIRE([PANDORA_MAC_GCC42]) - AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1)) -# error GCC is Too Old! -#endif - ]])], - [ac_cv_gcc_recent=yes], - [ac_cv_gcc_recent=no])]) - AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"], - AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required on OSX. You may need to install a version of XCode >= 3.1.2])) - AS_IF([test "$ac_cv_gcc_recent" = "no"], - AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required])) -]) diff -Nru gearmand-0.14/m4/pandora_extensions.m4 gearmand-0.23/m4/pandora_extensions.m4 --- gearmand-0.14/m4/pandora_extensions.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_extensions.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru gearmand-0.14/m4/pandora_have_better_malloc.m4 gearmand-0.23/m4/pandora_have_better_malloc.m4 --- gearmand-0.14/m4/pandora_have_better_malloc.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_better_malloc.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,11 +1,9 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([PANDORA_HAVE_BETTER_MALLOC],[ - AC_REQUIRE([AC_FUNC_MALLOC]) - AC_REQUIRE([AC_FUNC_REALLOC]) AC_REQUIRE([AC_LIB_PREFIX]) AC_ARG_ENABLE([umem], diff -Nru gearmand-0.14/m4/pandora_have_gcc_atomics.m4 gearmand-0.23/m4/pandora_have_gcc_atomics.m4 --- gearmand-0.14/m4/pandora_have_gcc_atomics.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_gcc_atomics.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru gearmand-0.14/m4/pandora_have_libdrizzle.m4 gearmand-0.23/m4/pandora_have_libdrizzle.m4 --- gearmand-0.14/m4/pandora_have_libdrizzle.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libdrizzle.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,61 +0,0 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_LIBDRIZZLE],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for libdrizzle - dnl -------------------------------------------------------------------- - - AC_ARG_ENABLE([libdrizzle], - [AS_HELP_STRING([--disable-libdrizzle], - [Build with libdrizzle support @<:@default=on@:>@])], - [ac_enable_libdrizzle="$enableval"], - [ac_enable_libdrizzle="yes"]) - - AS_IF([test "x$ac_enable_libdrizzle" = "xyes"],[ - AC_LIB_HAVE_LINKFLAGS(drizzle,,[ - #include - ],[ - drizzle_st drizzle; - drizzle_version(); - ]) - ],[ - ac_cv_libdrizzle="no" - ]) - - AM_CONDITIONAL(HAVE_LIBDRIZZLE, [test "x${ac_cv_libdrizzle}" = "xyes"]) -]) - -AC_DEFUN([PANDORA_HAVE_LIBDRIZZLE],[ - AC_REQUIRE([_PANDORA_SEARCH_LIBDRIZZLE]) -]) - -AC_DEFUN([PANDORA_REQUIRE_LIBDRIZZLE],[ - AC_REQUIRE([PANDORA_HAVE_LIBDRIZZLE]) - AS_IF([test "x${ac_cv_libdrizzle}" = "xno"],[ - AC_MSG_ERROR([libdrizzle is required for ${PACKAGE}]) - ],[ - dnl We need at least 0.8 on Solaris non-sparc - AS_IF([test "$target_cpu" != "sparc" -a "x${TARGET_SOLARIS}" = "xtrue"],[ - PANDORA_LIBDRIZZLE_RECENT - ]) - ]) -]) - -AC_DEFUN([PANDORA_LIBDRIZZLE_RECENT],[ - AC_CACHE_CHECK([if libdrizzle is recent enough], - [pandora_cv_libdrizzle_recent], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -drizzle_con_options_t foo= DRIZZLE_CON_EXPERIMENTAL; - ]])], - [pandora_cv_libdrizzle_recent=yes], - [pandora_cv_libdrizzle_recent=no])]) - AS_IF([test "$pandora_cv_libdrizzle_recent" = "no"],[ - AC_MSG_ERROR([Your version of libdrizzle is too old. ${PACKAGE} requires at least version 0.8]) - ]) -]) diff -Nru gearmand-0.14/m4/pandora_have_libevent.m4 gearmand-0.23/m4/pandora_have_libevent.m4 --- gearmand-0.14/m4/pandora_have_libevent.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libevent.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -57,7 +57,7 @@ _PANDORA_SEARCH_LIBEVENT AS_IF([test x$ac_cv_libevent = xno],[ - AC_MSG_ERROR([libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel.]) + PANDORA_MSG_ERROR([libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel.]) ]) ]) diff -Nru gearmand-0.14/m4/pandora_have_libgtest.m4 gearmand-0.23/m4/pandora_have_libgtest.m4 --- gearmand-0.14/m4/pandora_have_libgtest.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libgtest.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -dnl Copyright (C) 2010 Monty Taylor -dnl This file is free software; Monty Taylor -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_LIBGTEST],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for libgtest - dnl -------------------------------------------------------------------- - - AC_ARG_ENABLE([libgtest], - [AS_HELP_STRING([--disable-libgtest], - [Build with libgtest support @<:@default=on@:>@])], - [ac_enable_libgtest="$enableval"], - [ac_enable_libgtest="yes"]) - - AS_IF([test "x$ac_enable_libgtest" = "xyes"],[ - AC_LANG_PUSH(C++) - AC_LIB_HAVE_LINKFLAGS(gtest,,[ - #include -TEST(pandora_test_libgtest, PandoraTest) -{ - ASSERT_EQ(1, 1); -} - ],[]) - AC_LANG_POP() - ],[ - ac_cv_libgtest="no" - ]) - - AM_CONDITIONAL(HAVE_LIBGTEST, [test "x${ac_cv_libgtest}" = "xyes"]) -]) - -AC_DEFUN([PANDORA_HAVE_LIBGTEST],[ - AC_REQUIRE([_PANDORA_SEARCH_LIBGTEST]) -]) - -AC_DEFUN([PANDORA_REQUIRE_LIBGTEST],[ - AC_REQUIRE([_PANDORA_SEARCH_LIBGTEST]) - AS_IF([test "x${ac_cv_libgtest}" = "xno"], - AC_MSG_ERROR([libgtest is required for ${PACKAGE}])) -]) diff -Nru gearmand-0.14/m4/pandora_have_libmemcached.m4 gearmand-0.23/m4/pandora_have_libmemcached.m4 --- gearmand-0.14/m4/pandora_have_libmemcached.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libmemcached.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,106 +0,0 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_LIBMEMCACHED],[ - AC_REQUIRE([AC_LIB_PREFIX]) - - dnl -------------------------------------------------------------------- - dnl Check for libmemcached - dnl -------------------------------------------------------------------- - - AC_ARG_ENABLE([libmemcached], - [AS_HELP_STRING([--disable-libmemcached], - [Build with libmemcached support @<:@default=on@:>@])], - [ac_enable_libmemcached="$enableval"], - [ac_enable_libmemcached="yes"]) - - AS_IF([test "x$ac_enable_libmemcached" = "xyes"],[ - AC_LIB_HAVE_LINKFLAGS(memcached,,[ - #include - ],[ - memcached_st memc; - memcached_dump_func *df; - memcached_lib_version(); - ]) - ],[ - ac_cv_libmemcached="no" - ]) - - AS_IF([test "x$ac_enable_libmemcached" = "xyes"],[ - AC_LIB_HAVE_LINKFLAGS(memcachedprotocol,,[ - #include - ],[ - struct memcached_protocol_st *protocol_handle; - protocol_handle= memcached_protocol_create_instance(); - ]) - ],[ - ac_cv_libmemcachedprotocol="no" - ]) - - AC_CACHE_CHECK([if libmemcached has memcached_server_fn], - [pandora_cv_libmemcached_server_fn], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -memcached_server_fn callbacks[1]; - ]])], - [pandora_cv_libmemcached_server_fn=yes], - [pandora_cv_libmemcached_server_fn=no])]) - - AS_IF([test "x$pandora_cv_libmemcached_server_fn" = "xyes"],[ - AC_DEFINE([HAVE_MEMCACHED_SERVER_FN],[1],[If we have the new memcached_server_fn typedef]) - ]) -]) - -AC_DEFUN([_PANDORA_RECENT_LIBMEMCACHED],[ - - AC_CACHE_CHECK([if libmemcached is recent enough], - [pandora_cv_recent_libmemcached],[ - AS_IF([test "x${ac_cv_libmemcached}" = "xno"],[ - pandora_cv_recent_libmemcached=no - ],[ - AS_IF([test "x$1" != "x"],[ - pandora_need_libmemcached_version=`echo "$1" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d000", $[]1, $[]2 ;'` - AS_IF([test "x${pandora_need_libmemcached_version}" = "x0000000"],[ - pandora_cv_recent_libmemcached=yes - ],[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include - -#if !defined(LIBMEMCACHED_VERSION_HEX) || LIBMEMCACHED_VERSION_HEX < 0x]]${pandora_need_libmemcached_version}[[ -# error libmemcached too old! -#endif - ]],[[]]) - ],[ - pandora_cv_recent_libmemcached=yes - ],[ - pandora_cv_recent_libmemcached=no - ]) - ]) - ],[ - pandora_cv_recent_libmemcached=yes - ]) - ]) - ]) - - AM_CONDITIONAL(HAVE_LIBMEMCACHED,[test "x${ac_cv_libmemcached}" = "xyes" -a "x${pandora_cv_recent_libmemcached}" = "xyes"]) - -]) - -AC_DEFUN([PANDORA_HAVE_LIBMEMCACHED],[ - AC_REQUIRE([_PANDORA_SEARCH_LIBMEMCACHED]) - _PANDORA_RECENT_LIBMEMCACHED($1) -]) - -AC_DEFUN([PANDORA_REQUIRE_LIBMEMCACHED],[ - PANDORA_HAVE_LIBMEMCACHED($1) - AS_IF([test "x{$pandora_cv_recent_libmemcached}" = "xno"], - AC_MSG_ERROR([libmemcached is required for ${PACKAGE}])) -]) - -AC_DEFUN([PANDORA_REQUIRE_LIBMEMCACHEDPROTOCOL],[ - PANDORA_HAVE_LIBMEMCACHED($1) - AS_IF([test x$ac_cv_libmemcachedprotocol = xno], - AC_MSG_ERROR([libmemcachedprotocol is required for ${PACKAGE}])) -]) diff -Nru gearmand-0.14/m4/pandora_have_libpq.m4 gearmand-0.23/m4/pandora_have_libpq.m4 --- gearmand-0.14/m4/pandora_have_libpq.m4 2010-06-29 21:53:59.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libpq.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -42,5 +42,5 @@ AC_DEFUN([PANDORA_REQUIRE_LIBPQ],[ AC_REQUIRE([PANDORA_HAVE_LIBPQ]) AS_IF([test "x${ac_cv_libpq}" = "xno"], - AC_MSG_ERROR([libpq is required for ${PACKAGE}])) + PANDORA_MSG_ERROR([libpq is required for ${PACKAGE}])) ]) diff -Nru gearmand-0.14/m4/pandora_have_libsqlite3.m4 gearmand-0.23/m4/pandora_have_libsqlite3.m4 --- gearmand-0.14/m4/pandora_have_libsqlite3.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libsqlite3.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -38,5 +38,5 @@ AC_DEFUN([PANDORA_REQUIRE_LIBSQLITE3],[ AC_REQUIRE([_PANDORA_SEARCH_LIBSQLITE3]) AS_IF([test "x${ac_cv_libsqlite3}" = "xno"], - AC_MSG_ERROR([libsqlite3 is required for ${PACKAGE}])) + PANDORA_MSG_ERROR([libsqlite3 is required for ${PACKAGE}])) ]) diff -Nru gearmand-0.14/m4/pandora_have_libtokyocabinet.m4 gearmand-0.23/m4/pandora_have_libtokyocabinet.m4 --- gearmand-0.14/m4/pandora_have_libtokyocabinet.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libtokyocabinet.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -50,5 +50,5 @@ AC_DEFUN([PANDORA_REQUIRE_LIBTOKYOCABINET],[ AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET]) AS_IF([test "x${ac_cv_libtokyocabinet}" = "xno"], - AC_MSG_ERROR([libtokyocabinet is required for ${PACKAGE}. On Debian systems this is found in libtokyocabinet-dev. On RedHat, in tokyocabinet-devel.])) + PANDORA_MSG_ERROR([libtokyocabinet is required for ${PACKAGE}. On Debian systems this is found in libtokyocabinet-dev. On RedHat, in tokyocabinet-devel.])) ]) diff -Nru gearmand-0.14/m4/pandora_have_libuuid.m4 gearmand-0.23/m4/pandora_have_libuuid.m4 --- gearmand-0.14/m4/pandora_have_libuuid.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_have_libuuid.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -46,7 +46,7 @@ ac_enable_libuuid="yes" _PANDORA_SEARCH_LIBUUID AS_IF([test "x$ac_cv_header_uuid_uuid_h" = "xno"],[ - AC_MSG_ERROR([Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On Redhat this can be found in e2fsprogs-devel.]) + PANDORA_MSG_ERROR([Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On RHEL 4 this can be found in e2fsprogs-devel and Fedora/RHEL 6 in libuuid-devel.]) ]) ]) diff -Nru gearmand-0.14/m4/pandora_header_assert.m4 gearmand-0.23/m4/pandora_header_assert.m4 --- gearmand-0.14/m4/pandora_header_assert.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_header_assert.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru gearmand-0.14/m4/pandora_header_stdcxx_98.m4 gearmand-0.23/m4/pandora_header_stdcxx_98.m4 --- gearmand-0.14/m4/pandora_header_stdcxx_98.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/pandora_header_stdcxx_98.m4 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,83 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ac_cxx_header_stdcxx_98.html +# =========================================================================== +# +# SYNOPSIS +# +# AC_CXX_HEADER_STDCXX_98 +# +# DESCRIPTION +# +# Check for complete library coverage of the C++1998/2003 standard. +# +# LICENSE +# +# Copyright (C) 2008 Benjamin Kosnik +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. + +AC_DEFUN([AC_CXX_HEADER_STDCXX_98], [ + AC_CACHE_CHECK(for ISO C++ 98 include files, + ac_cv_cxx_stdcxx_98, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + ],, + ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no) + AC_LANG_RESTORE + ]) + if test "$ac_cv_cxx_stdcxx_98" = yes; then + AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ]) + fi +]) diff -Nru gearmand-0.14/m4/pandora_libtool.m4 gearmand-0.23/m4/pandora_libtool.m4 --- gearmand-0.14/m4/pandora_libtool.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_libtool.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,7 +12,7 @@ pandora_have_old_libtool=no ]) AS_IF([test "$SUNCC" = "yes" -a "${pandora_have_old_libtool}" = "yes"],[ - AC_MSG_ERROR([Building ${PACKAGE} with Sun Studio requires at least libtool 2.2]) + PANDORA_MSG_ERROR([Building ${PACKAGE} with Sun Studio requires at least libtool 2.2]) ]) dnl By requiring AC_PROG_LIBTOOL, we should force the macro system to read diff -Nru gearmand-0.14/m4/pandora_optimize.m4 gearmand-0.23/m4/pandora_optimize.m4 --- gearmand-0.14/m4/pandora_optimize.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_optimize.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,25 +22,21 @@ dnl with using AC_CC_STD_C99 above CC="${CC} -std=gnu99" - AM_CPPFLAGS="-ggdb3 ${AM_CPPFLAGS}" + AM_CPPFLAGS="-g ${AM_CPPFLAGS}" DEBUG_CFLAGS="-O0" DEBUG_CXXFLAGS="-O0" - OPTIMIZE_CFLAGS="-O3" - OPTIMIZE_CXXFLAGS="-O3" + OPTIMIZE_CFLAGS="-O2" + OPTIMIZE_CXXFLAGS="-O2" ]) AS_IF([test "$INTELCC" = "yes"],[ - dnl Once we can use a modern autoconf, we can replace the std=gnu99 here - dnl with using AC_CC_STD_C99 above - CC="${CC} -std=c99" - AM_CPPFLAGS="-g ${AM_CPPFLAGS}" DEBUG_CFLAGS="-O0" DEBUG_CXXFLAGS="-O0" - OPTIMIZE_CFLAGS="-xHOST -O3 -no-prec-div -static" + OPTIMIZE_CFLAGS="-xHOST -O2 -no-prec-div -static" OPTIMIZE_CXXFLAGS="${OPTIMIZE_CFLAGS}" ]) diff -Nru gearmand-0.14/m4/pandora_platform.m4 gearmand-0.23/m4/pandora_platform.m4 --- gearmand-0.14/m4/pandora_platform.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_platform.m4 2011-04-28 19:44:27.000000000 +0200 @@ -23,7 +23,7 @@ case "$host_os" in - *solaris*|*freebsd*) + *solaris*) AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[ CPPFLAGS="${CPPFLAGS} -I/usr/local/include" ]) @@ -32,6 +32,15 @@ LDFLAGS="${LDFLAGS} -L/usr/local/lib" ]) ;; + *freebsd*) + AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[ + CPPFLAGS="${CPPFLAGS} -isystem /usr/local/include" + ]) + + AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[ + LDFLAGS="${LDFLAGS} -L/usr/local/lib" + ]) + ;; esac PANDORA_OPTIMIZE_BITFIELD=1 @@ -50,6 +59,7 @@ *solaris*) TARGET_SOLARIS="true" PANDORA_OPTIMIZE_BITFIELD=0 + AS_IF([test "x${USE_NLS}" = "xyes"],[LIBS="${LIBS} -lintl"]) AC_SUBST(TARGET_SOLARIS) AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris]) ;; @@ -59,9 +69,27 @@ AC_DEFINE([TARGET_OS_FREEBSD], [1], [Whether we are building for FreeBSD]) AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers]) ;; - *) + *mingw32*) + TARGET_WINDOWS="true" + AC_SUBST(TARGET_WINDOWS) + AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows]) + AC_DEFINE([WINVER], [WindowsXP], [Version of Windows]) + AC_DEFINE([_WIN32_WINNT], [0x0501], [Magical number to make things work]) + AC_DEFINE([EAI_SYSTEM], [11], [Another magical number]) + AH_BOTTOM([ +#ifndef HAVE_SYS_SOCKET_H +# define SHUT_RD SD_RECEIVE +# define SHUT_WR SD_SEND +# define SHUT_RDWR SD_BOTH +#endif + ]) + + LIBS="$LIBS -lwsock32 -lws2_32" + AM_CFLAGS="${AM_CFLAGS} -I\${top_srcdir}/win32/mingw -I\${top_builddir}/win32/mingw -I\${top_srcdir}/win32 -I\${top_builddir}/win32" ;; esac + AM_CONDITIONAL(BUILD_WIN32, [test "x${TARGET_WINDOWS}" = "xtrue"]) + AM_CONDITIONAL(TARGET_OSX, [test "x${TARGET_OSX}" = "xtrue"]) AC_SUBST(PANDORA_OPTIMIZE_BITFIELD) diff -Nru gearmand-0.14/m4/pandora_pthread.m4 gearmand-0.23/m4/pandora_pthread.m4 --- gearmand-0.14/m4/pandora_pthread.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_pthread.m4 2011-04-28 19:44:27.000000000 +0200 @@ -254,5 +254,5 @@ AC_DEFUN([PANDORA_REQUIRE_PTHREAD],[ AC_REQUIRE([PANDORA_HAVE_PTHREAD]) AS_IF([test "x$acx_pthread_ok" != "xyes"],[ - AC_MSG_ERROR(could not find libpthread)]) + PANDORA_MSG_ERROR(could not find libpthread)]) ]) diff -Nru gearmand-0.14/m4/pandora_vc_build.m4 gearmand-0.23/m4/pandora_vc_build.m4 --- gearmand-0.14/m4/pandora_vc_build.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_vc_build.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -36,7 +36,14 @@ ]) AC_DEFUN([PANDORA_BUILDING_FROM_VC],[ - m4_syscmd(PANDORA_TEST_VC_DIR [ + m4_syscmd(PANDORA_TEST_VC_DIR + m4_if(PCT_NO_VC_CHANGELOG,yes,[ + vc_changelog=no + ],[ + vc_changelog=yes + ]) + + [ PANDORA_RELEASE_DATE=`date +%Y.%m` PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m` @@ -53,6 +60,18 @@ PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}" PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1` PANDORA_VC_BRANCH=`bzr nick` + PANDORA_VC_TAG=`bzr tags -r-1 | cut -f1 -d' ' | head -1` + PANDORA_VC_LATEST_TAG=`bzr tags --sort=time | grep -v '\?'| cut -f1 -d' ' | tail -1` + if test "x${vc_changelog}" = "xyes"; then + bzr log --gnu > ChangeLog + fi + fi + elif test "${pandora_building_from_git}" = "yes"; then + echo "# Grabbing changelog and version information from git" + PANDORA_GIT_REVID=`git --no-pager log --max-count=1 | cut -f2 -d' ' | head -1` + if test "x$PANDORA_GIT_REVID" != "x${PANDORA_VC_REVNO}" ; then + PANDORA_VC_REVID="${PANDORA_GIT_REVID}" + PANDORA_VC_BRANCH=`git branch | grep -Ei "\* (.*)" | cut -f2 -d' '` fi fi @@ -60,17 +79,21 @@ mkdir -p config fi - cat > config/pandora_vc_revinfo.tmp < config/pandora_vc_revinfo.tmp </dev/null 2>&1 ; then - mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo + if ! diff config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo >/dev/null 2>&1 ; then + mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo + fi + rm -f config/pandora_vc_revinfo.tmp fi - rm -f config/pandora_vc_revinfo.tmp ]) ]) @@ -88,6 +111,10 @@ _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo) _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH], ${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_VC_TAG], + ${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_VC_LATEST_TAG], + ${srcdir}/config/pandora_vc_revinfo) _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE], ${srcdir}/config/pandora_vc_revinfo) _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE], @@ -99,8 +126,25 @@ PANDORA_RELEASE_COMMENT="trunk" ]) - PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}" - PANDORA_RELEASE_ID="${PANDORA_RELEASE_NODOTS_DATE}${PANDORA_VC_REVNO}" + AS_IF([test "x${PANDORA_VC_TAG}" != "x"],[ + PANDORA_RELEASE_VERSION="${PANDORA_VC_TAG}" + changequote(<<, >>)dnl + PANDORA_RELEASE_ID=`echo ${PANDORA_RELEASE_VERSION} | sed 's/[^0-9]//g'` + changequote([, ])dnl + ],[ + AS_IF([test "x${PANDORA_VC_LATEST_TAG}" != "x"],[ + PANDORA_RELEASE_VERSION="${PANDORA_VC_LATEST_TAG}.${PANDORA_VC_REVNO}" + changequote(<<, >>)dnl + PANDORA_RELEASE_ID=`echo ${PANDORA_VC_LATEST_TAG} | sed 's/[^0-9]//g'` + changequote([, ])dnl + ],[ + PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}" + changequote(<<, >>)dnl + PANDORA_RELEASE_ID=`echo ${PANDORA_RELEASE_DATE} | sed 's/[^0-9]//g'` + changequote([, ])dnl + ]) + ]) + VERSION="${PANDORA_RELEASE_VERSION}" AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["${PANDORA_RELEASE_VERSION}"], diff -Nru gearmand-0.14/m4/pandora_version.m4 gearmand-0.23/m4/pandora_version.m4 --- gearmand-0.14/m4/pandora_version.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_version.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru gearmand-0.14/m4/pandora_visibility.m4 gearmand-0.23/m4/pandora_visibility.m4 --- gearmand-0.14/m4/pandora_visibility.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_visibility.m4 2011-04-28 19:44:27.000000000 +0200 @@ -20,38 +20,56 @@ dnl Set the variable CFLAG_VISIBILITY. dnl Defines and sets the variable HAVE_VISIBILITY. -AC_DEFUN([PANDORA_VISIBILITY], +AC_DEFUN([PANDORA_CHECK_VISIBILITY], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([PANDORA_PLATFORM]) CFLAG_VISIBILITY= HAVE_VISIBILITY=0 AS_IF([test -n "$GCC"],[ AC_MSG_CHECKING([for simple visibility declarations]) AC_CACHE_VAL([gl_cv_cc_visibility], [ gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" + CFLAGS="$CFLAGS -fvisibility=hidden -Werror" AC_TRY_COMPILE( [extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); extern __attribute__((__visibility__("default"))) int exportedfunc (void);], - [], - [gl_cv_cc_visibility=yes], - [gl_cv_cc_visibility=no]) + [],[ + case "$host_os" in + *darwin*) + gl_cv_cc_visibility=no + ;; + *) + gl_cv_cc_visibility=yes + ;; + esac + ],[gl_cv_cc_visibility=no]) CFLAGS="$gl_save_CFLAGS"]) AC_MSG_RESULT([$gl_cv_cc_visibility]) if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" + CXXFLAG_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden" + NO_VISIBILITY="-fvisibility=default" HAVE_VISIBILITY=1 fi ]) AS_IF([test "x$SUNCC" = "xyes"],[ CFLAG_VISIBILITY="-xldscope=hidden" + CXXFLAG_VISIBILITY="-xldscope=hidden" + NO_VISIBILITY="-xldscope=global" HAVE_VISIBILITY=1 ]) AC_SUBST([CFLAG_VISIBILITY]) + AC_SUBST([CXXFLAG_VISIBILITY]) + AC_SUBST([NO_VISIBILITY]) AC_SUBST([HAVE_VISIBILITY]) AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) ]) + +AC_DEFUN([PANDORA_ENABLE_VISIBILITY],[ + AC_REQUIRE([PANDORA_CHECK_VISIBILITY]) + AM_CFLAGS="${AM_CFLAGS} ${CFLAG_VISIBILITY}" + AM_CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAG_VISIBILITY}" +]) diff -Nru gearmand-0.14/m4/pandora_warnings.m4 gearmand-0.23/m4/pandora_warnings.m4 --- gearmand-0.14/m4/pandora_warnings.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_warnings.m4 2011-04-28 19:44:27.000000000 +0200 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,6 +34,12 @@ [ac_cv_warnings_as_errors=yes], [ac_cv_warnings_as_errors=no])) + AC_ARG_ENABLE([gcc-profile-mode], + [AS_HELP_STRING([--enable-gcc-profile-mode], + [Toggle gcc profile mode @<:@default=off@:>@])], + [ac_gcc_profile_mode="$enableval"], + [ac_gcc_profile_mode="no"]) + AC_ARG_ENABLE([profiling], [AS_HELP_STRING([--enable-profiling], [Toggle profiling @<:@default=off@:>@])], @@ -69,8 +75,11 @@ - AS_IF([test "$ac_cv_warnings_as_errors" = "yes"], - [W_FAIL="-Werror"]) + AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],[ + W_FAIL="-Werror" + SPHINX_WARNINGS="-W" + INTLTOOL_WARNINGS="yes" + ]) AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option], [ac_cv_safe_to_use_fdiagnostics_show_option_], @@ -87,68 +96,47 @@ F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option" ]) - AC_CACHE_CHECK([whether it is safe to use -Wconversion], - [ac_cv_safe_to_use_wconversion_], + AC_CACHE_CHECK([whether it is safe to use -floop-parallelize-all], + [ac_cv_safe_to_use_floop_parallelize_all_], [save_CFLAGS="$CFLAGS" - dnl Use -Werror here instead of ${W_FAIL} so that we don't spew - dnl conversion warnings to all the tarball folks - CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + CFLAGS="-floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}" AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#include -void foo(bool a) -{ - (void)a; -} - ]],[[ -foo(0); - ]])], - [ac_cv_safe_to_use_wconversion_=yes], - [ac_cv_safe_to_use_wconversion_=no]) + [AC_LANG_PROGRAM([],[])], + [ac_cv_safe_to_use_floop_parallelize_all_=yes], + [ac_cv_safe_to_use_floop_parallelize_all_=no]) CFLAGS="$save_CFLAGS"]) - AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"], - [W_CONVERSION="-Wconversion" - AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons], - [ac_cv_safe_to_use_Wconversion_], - [save_CFLAGS="$CFLAGS" - dnl Use -Werror here instead of ${W_FAIL} so that we don't spew - dnl conversion warnings to all the tarball folks - CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include - ]],[[ -uint16_t x= htons(80); - ]])], - [ac_cv_safe_to_use_Wconversion_=yes], - [ac_cv_safe_to_use_Wconversion_=no]) - CFLAGS="$save_CFLAGS"]) - - AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"], - [NO_CONVERSION="-Wno-conversion"]) - ]) + AS_IF([test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"], + [ + F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all" + ]) NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing" NO_SHADOW="-Wno-shadow" AS_IF([test "$INTELCC" = "yes"],[ m4_if(PW_LESS_WARNINGS,[no],[ - BASE_WARNINGS="-w1 -Werror -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual" + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188" ],[ - BASE_WARNINGS="-w1 -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 981" + dnl 2203 is like old-style-cast + dnl 1684 is like strict-aliasing + dnl 188 is about using enums as bitfields + dnl 1683 is a warning about _EXPLICIT_ casting, which we want + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684" ]) CC_WARNINGS="${BASE_WARNINGS}" CXX_WARNINGS="${BASE_WARNINGS}" + PROTOSKIP_WARNINGS="-diag-disable 188,981,967,2259,1683,1684,2203" + ],[ m4_if(PW_LESS_WARNINGS,[no],[ - BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing" + BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing -Wswitch-enum " CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings" - CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast" + CXX_WARNINGS_FULL="-Wold-style-cast" NO_OLD_STYLE_CAST="-Wno-old-style-cast" + NO_EFF_CXX="-Wno-effc++" ],[ - BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}" + BASE_WARNINGS_FULL="${NO_STRICT_ALIASING}" ]) AS_IF([test "${ac_cv_assert}" = "no"], @@ -168,11 +156,87 @@ [ac_cv_safe_to_use_Wextra_=no]) CFLAGS="$save_CFLAGS"]) - BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" + BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} ${BASE_WARNINGS_FULL}" AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"], [BASE_WARNINGS="${BASE_WARNINGS} -Wextra"], [BASE_WARNINGS="${BASE_WARNINGS} -W"]) + AC_CACHE_CHECK([whether it is safe to use -Wformat], + [ac_cv_safe_to_use_wformat_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#include +#include +void foo(); +void foo() +{ + uint64_t test_u= 0; + printf("This is a %" PRIu64 "test\n", test_u); +} + ]],[[ +foo(); + ]])], + [ac_cv_safe_to_use_wformat_=yes], + [ac_cv_safe_to_use_wformat_=no]) + CFLAGS="$save_CFLAGS"]) + AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[ + BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wno-format-security" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wno-format-security" + ],[ + BASE_WARNINGS="${BASE_WARNINGS} -Wno-format" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format" + ]) + + + + AC_CACHE_CHECK([whether it is safe to use -Wconversion], + [ac_cv_safe_to_use_wconversion_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include +void foo(bool a) +{ + (void)a; +} + ]],[[ +foo(0); + ]])], + [ac_cv_safe_to_use_wconversion_=yes], + [ac_cv_safe_to_use_wconversion_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"], + [W_CONVERSION="-Wconversion" + AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons], + [ac_cv_safe_to_use_Wconversion_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]],[[ +uint16_t x= htons(80); + ]])], + [ac_cv_safe_to_use_Wconversion_=yes], + [ac_cv_safe_to_use_Wconversion_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"], + [NO_CONVERSION="-Wno-conversion"]) + ]) + CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}" CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}" @@ -195,6 +259,25 @@ AS_IF([test "$ac_cv_safe_to_use_Wmissing_declarations_" = "yes"], [CXX_WARNINGS="${CXX_WARNINGS} -Wmissing-declarations"]) + AC_CACHE_CHECK([whether it is safe to use -Wframe-larger-than], + [ac_cv_safe_to_use_Wframe_larger_than_], + [AC_LANG_PUSH(C++) + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-Werror -pedantic -Wframe-larger-than=32768 ${AM_CXXFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wframe_larger_than_=yes], + [ac_cv_safe_to_use_Wframe_larger_than_=no]) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_POP() + ]) + AS_IF([test "$ac_cv_safe_to_use_Wframe_larger_than_" = "yes"], + [CXX_WARNINGS="${CXX_WARNINGS} -Wframe-larger-than=32768"]) + AC_CACHE_CHECK([whether it is safe to use -Wlogical-op], [ac_cv_safe_to_use_Wlogical_op_], [save_CFLAGS="$CFLAGS" @@ -291,8 +374,11 @@ dnl TODO: Figure out a better way to deal with this: PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}" NO_WERROR="-Wno-error" - INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align" - + PERMISSIVE_WARNINGS="-Wno-error -Wno-unused-function -fpermissive" + PERMISSIVE_C_WARNINGS="-Wno-error -Wno-redundant-decls" + AS_IF([test "$host_vendor" = "apple"],[ + BOOSTSKIP_WARNINGS="-Wno-uninitialized" + ]) ]) ]) @@ -323,16 +409,19 @@ m4_if(PW_LESS_WARNINGS, [no],[ - CC_WARNINGS_FULL="-erroff=E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" + CC_WARNINGS_FULL="-erroff=E_STATEMENT_NOT_REACHED,E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" CXX_WARNINGS_FULL="-erroff=inllargeuse" ],[ - CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR" + CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR,E_STATEMENT_NOT_REACHED" CXX_WARNINGS_FULL="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint" ]) - CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL} ${CFLAG_VISIBILITY}" - CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL} ${CFLAG_VISIBILITY}" + CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}" + CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}" PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit" + BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem" + PERMISSIVE_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem,notused,badargtype2w,wunreachable" + INNOBASE_SKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit,wunreachable" NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED" NO_WERROR="-errwarn=%none" @@ -343,10 +432,16 @@ AC_SUBST(NO_UNREACHED) AC_SUBST(NO_SHADOW) AC_SUBST(NO_STRICT_ALIASING) + AC_SUBST(NO_EFF_CXX) AC_SUBST(NO_OLD_STYLE_CAST) AC_SUBST(PROTOSKIP_WARNINGS) AC_SUBST(INNOBASE_SKIP_WARNINGS) + AC_SUBST(BOOSTSKIP_WARNINGS) + AC_SUBST(PERMISSIVE_WARNINGS) + AC_SUBST(PERMISSIVE_C_WARNINGS) AC_SUBST(NO_WERROR) AC_SUBST([GCOV_LIBS]) + AC_SUBST([SPHINX_WARNINGS]) + AC_SUBST([INTLTOOL_WARNINGS]) ]) diff -Nru gearmand-0.14/m4/pandora_with_gettext.m4 gearmand-0.23/m4/pandora_with_gettext.m4 --- gearmand-0.14/m4/pandora_with_gettext.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_with_gettext.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- -dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: -dnl -dnl pandora-build: A pedantic build system -dnl Copyright (C) 2009 Sun Microsystems, Inc. -dnl This file is free software; Sun Microsystems -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. -dnl -dnl From Monty Taylor - -AC_DEFUN([PANDORA_WITH_GETTEXT],[ - - - m4_syscmd([if test -d po ; then - echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.stamp - PACKAGE=$(grep ^AC_INIT configure.ac | cut -f2-3 -d[ | cut -f1 -d]) - for f in $(find . | grep -v "${PACKAGE}-" | egrep '\.(cc|c|h|yy)$' | cut -c3- | sort) - do - if grep gettext.h "$f" | grep include >/dev/null 2>&1 - then - echo "$f" >> po/POTFILES.in.stamp - fi - done - if diff po/POTFILES.in.stamp po/POTFILES.in >/dev/null 2>&1 - then - rm po/POTFILES.in.stamp - else - mv po/POTFILES.in.stamp po/POTFILES.in - fi - fi]) - - m4_if(m4_substr(m4_esyscmd(test -d po && echo 0),0,1),0, [ - AM_GNU_GETTEXT(external, need-formatstring-macros) - AM_GNU_GETTEXT_VERSION([0.17]) - AS_IF([test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"],[ - AM_PATH_PROG_WITH_TEST([GMSGMERGE], gmsgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) - MSGMERGE="${GMSGMERGE}" - ]) - AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"]) - ]) - -]) diff -Nru gearmand-0.14/m4/pandora_with_memcached.m4 gearmand-0.23/m4/pandora_with_memcached.m4 --- gearmand-0.14/m4/pandora_with_memcached.m4 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/m4/pandora_with_memcached.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([_PANDORA_SEARCH_MEMCACHED],[ - - AC_ARG_WITH([memcached], - [AS_HELP_STRING([--with-memcached], - [Memcached binary to use for make test])], - [ac_cv_with_memcached="$withval"], - [ac_cv_with_memcached=memcached]) - - # just ignore the user if --without-memcached is passed.. it is - # only used by make test - AS_IF([test "x$ac_cv_with_memcached" = "xno"],[ - ac_cv_with_memcached=memcached - MEMCACHED_BINARY=memcached - ],[ - AS_IF([test -f "$ac_cv_with_memcached"],[ - MEMCACHED_BINARY=$ac_cv_with_memcached - ],[ - AC_PATH_PROG([MEMCACHED_BINARY], [$ac_cv_with_memcached], "no") - ]) - ]) - AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMCACHED_BINARY", - [Name of the memcached binary used in make test]) - AM_CONDITIONAL([HAVE_MEMCACHED],[test "x$MEMCACHED_BINARY" != "xno"]) -]) - -AC_DEFUN([PANDORA_HAVE_MEMCACHED],[ - AC_REQUIRE([_PANDORA_SEARCH_MEMCACHED]) -]) - -AC_DEFUN([PANDORA_REQUIRE_MEMCACHED],[ - AC_REQUIRE([PANDORA_HAVE_MEMCACHED]) - AS_IF([test "x$MEMCACHED_BINARY" = "xno"],[ - AC_MSG_ERROR(["could not find memcached binary"]) - ]) -]) - diff -Nru gearmand-0.14/m4/pandora_with_valgrind.m4 gearmand-0.23/m4/pandora_with_valgrind.m4 --- gearmand-0.14/m4/pandora_with_valgrind.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/pandora_with_valgrind.m4 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,17 @@ +dnl Copyright (C) 2010 Brian Aker +dnl This file is free software; Brian Aker +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([PANDORA_WITH_VALGRIND],[ + + AC_ARG_WITH([valgrind], + [AS_HELP_STRING([--with-valgrind], + [Add additional valgrind code for testing with valgrind.])], + [with_valgrind=yes], + [with_valgrind=no]) + AM_CONDITIONAL(HAVE_VALGRIND,[test "x${with_valgrind}" = "xyes"]) + AS_IF([test "x$with_valgrind" = "xyes"], + AC_DEFINE([HAVE_VALGRIND],[1], + [Add additional valgrind code for testing with valgrind.])) +]) diff -Nru gearmand-0.14/m4/socket_send_flags.m4 gearmand-0.23/m4/socket_send_flags.m4 --- gearmand-0.14/m4/socket_send_flags.m4 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/m4/socket_send_flags.m4 2011-03-03 08:43:32.000000000 +0100 @@ -0,0 +1,49 @@ +dnl Copyright (C) 2011 Trond Norbye +dnl This file is free software; Trond Norbye +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl --------------------------------------------------------------------------- +dnl Macro: SOCKET_SEND_FLAGS +dnl --------------------------------------------------------------------------- + +AC_DEFUN([SOCKET_SEND_FLAGS], +[ + AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [ + AC_LANG_PUSH([C]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I${srcdir}" + AC_TRY_LINK([ +#include + ], [ +int flags= MSG_NOSIGNAL; + ], + [ ac_cv_msg_nosignal=yes ], + [ ac_cv_msg_nosignal=no ]) + CFLAGS="$save_CFLAGS" + AC_LANG_POP + ]) + + AC_CACHE_CHECK([for MSG_DONTWAIT], [ac_cv_msg_dontwait], [ + AC_LANG_PUSH([C]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I${srcdir}" + AC_TRY_LINK([ +#include + ], [ +int flags= MSG_DONTWAIT; + ], + [ ac_cv_msg_dontwait=yes ], + [ ac_cv_msg_dontwait=no ]) + CFLAGS="$save_CFLAGS" + AC_LANG_POP + ]) + + AS_IF([test "x$ac_cv_msg_nosignal" = "xyes"],[ + AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [Define to 1 if you have a MSG_NOSIGNAL])]) + AS_IF([test "x$ac_cv_msg_dontwait" = "xyes"],[ + AC_DEFINE(HAVE_MSG_DONTWAIT, 1, [Define to 1 if you have a MSG_DONTWAIT])]) +]) + +dnl --------------------------------------------------------------------------- +dnl End Macro: SOCKET_SEND_FLAGS +dnl --------------------------------------------------------------------------- diff -Nru gearmand-0.14/Makefile.am gearmand-0.23/Makefile.am --- gearmand-0.14/Makefile.am 2010-06-30 20:30:58.000000000 +0200 +++ gearmand-0.23/Makefile.am 2011-06-20 05:31:42.000000000 +0200 @@ -15,47 +15,69 @@ noinst_LTLIBRARIES = nobase_include_HEADERS = noinst_HEADERS = -EXTRA_DIST = +man1_MANS = +man3_MANS = +man8_MANS = +DISTCLEANFILES = +EXTRA_DIST = CLEANFILES = TESTS = +GEARMAN_TMP = ${abs_top_builddir}/tests/var/tmp/ include benchmark/include.am include bin/include.am include examples/include.am include gearmand/include.am -include libgearman/include.am include libgearman-server/include.am +include libgearman/include.am +include util/include.am +include libtest/include.am include tests/include.am -include unittests/include.am include support/include.am +include docs/include.am -include docs/man_list +docs: html man TESTS += ${check_PROGRAMS} -EXTRA_DIST+= \ - docs/Doxyfile.api \ - docs/Doxyfile.dev \ - docs/api_header.html \ - docs/dev_header.html \ - docs/doxygen.h \ - scripts/README.solaris - -docs: all - ${DOXYGEN} docs/Doxyfile.api - ${DOXYGEN} docs/Doxyfile.dev +EXTRA_DIST+= HACKING +EXTRA_DIST+= ${man1_MANS} +EXTRA_DIST+= ${man3_MANS} +EXTRA_DIST+= ${man8_MANS} +EXTRA_DIST+= scripts/README.solaris test: check -rpm: all dist - cp gearmand-$(VERSION).tar.gz ~/rpmbuild/SOURCES/ - rpmbuild -ba support/gearmand.spec - cp ~/rpmbuild/RPMS/x86_64/gearmand-$(VERSION)*.rpm . - cp ~/rpmbuild/SRPMS/gearmand-$(VERSION)*.rpm . +clean-local: + -rm -rf docs/_build docs/doctrees + +rpm-build: support/gearmand.spec + @rm -f ~/rpmbuild/RPMS/x86_64/gearmand-$(VERSION)*.rpm + @rm -f ~/rpmbuild/SRPMS/gearmand-$(VERSION)*.rpm + @cp gearmand-$(VERSION).tar.gz ~/rpmbuild/SOURCES/ + @cp support/gearmand.init ~/rpmbuild/SOURCES/ + @rpmbuild -ba support/gearmand.spec + @cp ~/rpmbuild/RPMS/x86_64/gearmand-$(VERSION)*.rpm . + @cp ~/rpmbuild/RPMS/x86_64/gearmand-devel-$(VERSION)*.rpm . + @cp ~/rpmbuild/RPMS/x86_64/gearmand-debuginfo-$(VERSION)*.rpm . + @cp ~/rpmbuild/RPMS/x86_64/gearmand-server-$(VERSION)*.rpm . + @cp ~/rpmbuild/SRPMS/gearmand-$(VERSION)*.rpm . + +rpm-sign: rpm-build + @rpm --addsign gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm + @rpm --checksig gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm + +rpm: man distcheck rpm-build + +release: rpm rpm-sign + @rpm --addsign gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm + @rpm --checksig gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm merge-clean: - find ./ | $(GREP) \.orig | xargs rm -f - find ./ | $(GREP) \.rej | xargs rm -f - find ./ | $(GREP) \~$$ | xargs rm -f - bzr unknowns + @find ./ | $(GREP) \.moved | xargs rm -r -f + @find ./ | $(GREP) \.orig | xargs rm -f + @find ./ | $(GREP) \.rej | xargs rm -f + @find ./ | $(GREP) \~$$ | xargs rm -f + @echo "The follow files need to be removed or checked in:" + @bzr unknowns diff -Nru gearmand-0.14/Makefile.in gearmand-0.23/Makefile.in --- gearmand-0.14/Makefile.in 2010-06-30 20:31:23.000000000 +0200 +++ gearmand-0.23/Makefile.in 2011-06-29 22:59:32.000000000 +0200 @@ -35,9 +35,24 @@ # All paths should be given relative to the root # vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 DataDifferential +# Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor +# Copyright (C) 2008 Brian Aker, Eric Day +# +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root + +# vim:ft=automake # Gearman server and library # Copyright (C) 2008 Brian Aker, Eric Day # Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See @@ -60,6 +75,7 @@ # vim:ft=automake # Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day # Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor # All rights reserved. @@ -69,12 +85,109 @@ # # Included from Top Level Makefile.am # All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# All paths should be given relative to the root +# # vim:ft=automake # Gearman server and library -# Copyright (C) 2008 Brian Aker, Eric Day +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2009-2010 Brian Aker, Eric Day, Monty Taylor All rights -# reserved. +# Copyright (C) 2008 Brian Aker, Eric Day # # Use and distribution licensed under the BSD license. See # the COPYING file in the parent directory for full text. @@ -84,8 +197,7 @@ # vim:ft=automake # Gearman server and library -# Copyright (C) 2008 Brian Aker, Eric Day -# Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor +# Copyright (C) 2011 Data Differential # All rights reserved. # # Use and distribution licensed under the BSD license. See @@ -95,7 +207,18 @@ # All paths should be given relative to the root # vim:ft=automake +# Copyright (C) 2011 Data Differential (http://datadifferential.com/) +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# included from Top Level Makefile.am +# All paths should be given relative to the root + +# vim:ft=automake # Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day # All rights reserved. # @@ -103,6 +226,78 @@ # the COPYING file in the parent directory for full text. # vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +# vim:ft=automake # included from Top Level Makefile.am # All paths should be given relative to the root @@ -110,6 +305,9 @@ # included from Top Level Makefile.am # All paths should be given relative to the root +# Makefile for Sphinx documentation +# + @@ -133,75 +331,118 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -bin_PROGRAMS = bin/gearman$(EXEEXT) +bin_PROGRAMS = bin/gearman$(EXEEXT) bin/gearadmin$(EXEEXT) sbin_PROGRAMS = gearmand/gearmand$(EXEEXT) -check_PROGRAMS = $(am__EXEEXT_1) +check_PROGRAMS = libtest/unittest$(EXEEXT) noinst_PROGRAMS = benchmark/blobslap_client$(EXEEXT) \ benchmark/blobslap_worker$(EXEEXT) \ examples/echo_client$(EXEEXT) examples/echo_worker$(EXEEXT) \ examples/reverse_client$(EXEEXT) \ examples/reverse_client_bg$(EXEEXT) \ + examples/reverse_client_epoch$(EXEEXT) \ examples/reverse_client_cb$(EXEEXT) \ examples/reverse_worker$(EXEEXT) examples/wc_worker$(EXEEXT) \ - $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \ - tests/client_test$(EXEEXT) tests/cpp_test$(EXEEXT) \ - tests/internals_test$(EXEEXT) tests/regression_test$(EXEEXT) \ - tests/round_robin_test$(EXEEXT) tests/worker_test$(EXEEXT) + libtest/wait$(EXEEXT) libtest/unittest$(EXEEXT) \ + tests/burnin_test$(EXEEXT) tests/client_test$(EXEEXT) \ + tests/c_test$(EXEEXT) tests/cpp_test$(EXEEXT) \ + tests/drizzle_test$(EXEEXT) tests/internals_test$(EXEEXT) \ + tests/round_robin_test$(EXEEXT) tests/worker_test$(EXEEXT) \ + $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + $(am__EXEEXT_4) \ + docs/libgearman/examples/gearman_client_do_background_example$(EXEEXT) \ + docs/libgearman/examples/gearman_client_do_example$(EXEEXT) \ + docs/libgearman/examples/gearman_execute_example$(EXEEXT) \ + docs/libgearman/examples/gearman_execute_partition$(EXEEXT) TESTS = $(check_PROGRAMS) DIST_COMMON = README $(am__configure_deps) $(am__noinst_HEADERS_DIST) \ - $(dist_man_MANS) $(nobase_include_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/benchmark/include.am $(srcdir)/bin/include.am \ - $(srcdir)/config.h.in $(srcdir)/docs/man_list \ - $(srcdir)/examples/include.am $(srcdir)/gearmand/include.am \ + $(nobase_include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/benchmark/include.am \ + $(srcdir)/bin/include.am $(srcdir)/config.h.in \ + $(srcdir)/docs/include.am $(srcdir)/examples/include.am \ + $(srcdir)/gearmand/include.am \ + $(srcdir)/libgearman-server/error/include.am \ $(srcdir)/libgearman-server/include.am \ - $(srcdir)/libgearman/include.am $(srcdir)/support/include.am \ - $(srcdir)/tests/include.am $(srcdir)/unittests/include.am \ - $(top_srcdir)/configure \ - $(top_srcdir)/libgearman/configure.h.in \ + $(srcdir)/libgearman-server/plugins/include.am \ + $(srcdir)/libgearman-server/plugins/protocol/http/include.am \ + $(srcdir)/libgearman-server/plugins/protocol/include.am \ + $(srcdir)/libgearman-server/plugins/queue/drizzle/include.am \ + $(srcdir)/libgearman-server/plugins/queue/include.am \ + $(srcdir)/libgearman-server/plugins/queue/libmemcached/include.am \ + $(srcdir)/libgearman-server/plugins/queue/postgres/include.am \ + $(srcdir)/libgearman-server/plugins/queue/sqlite/include.am \ + $(srcdir)/libgearman-server/plugins/queue/tokyocabinet/include.am \ + $(srcdir)/libgearman/include.am $(srcdir)/libtest/include.am \ + $(srcdir)/support/include.am $(srcdir)/tests/httpd.am \ + $(srcdir)/tests/include.am $(srcdir)/tests/libdrizzle.am \ + $(srcdir)/tests/libmemcached.am $(srcdir)/tests/postgres.am \ + $(srcdir)/tests/sqlite.am $(srcdir)/tests/tokyocabinet.am \ + $(srcdir)/util/include.am $(top_srcdir)/configure \ + $(top_srcdir)/docs/conf.py.in \ + $(top_srcdir)/libgearman/version.h.in \ $(top_srcdir)/scripts/gearmand-init.in \ $(top_srcdir)/scripts/gearmand.in \ $(top_srcdir)/scripts/gearmand.xml.in \ $(top_srcdir)/scripts/smf_install.sh.in \ $(top_srcdir)/support/gearmand.pc.in \ $(top_srcdir)/support/gearmand.spec.in AUTHORS COPYING \ - ChangeLog NEWS config/compile config/config.guess \ + ChangeLog NEWS THANKS config/compile config/config.guess \ config/config.rpath config/config.sub config/depcomp \ config/install-sh config/ltmain.sh config/missing -@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@am__append_1 = tests/memcached_test -@HAVE_LIBSQLITE3_TRUE@am__append_2 = tests/gearman.sql tests/gearman.sql-journal -@HAVE_LIBSQLITE3_TRUE@am__append_3 = tests/sqlite_test -@HAVE_LIBTOKYOCABINET_TRUE@am__append_4 = tests/gearman.tcb -@HAVE_LIBTOKYOCABINET_TRUE@am__append_5 = tests/tokyocabinet_test -@HAVE_LIBGTEST_TRUE@am__append_6 = unittests/unittests +@HAVE_LIBDRIZZLE_TRUE@am__append_1 = libgearman-server/plugins/queue/drizzle/queue.h +@HAVE_LIBDRIZZLE_TRUE@am__append_2 = libgearman-server/plugins/queue/drizzle/queue.cc +@HAVE_LIBDRIZZLE_TRUE@am__append_3 = $(libdrizzle_LIBS) +@HAVE_LIBDRIZZLE_TRUE@am__append_4 = $(libdrizzle_CFLAGS) +@HAVE_LIBDRIZZLE_TRUE@am__append_5 = $(libdrizzle_LIBS) +@HAVE_LIBDRIZZLE_TRUE@am__append_6 = $(libdrizzle_CFLAGS) +@HAVE_LIBMEMCACHED_TRUE@am__append_7 = libgearman-server/plugins/queue/libmemcached/queue.h +@HAVE_LIBMEMCACHED_TRUE@am__append_8 = libgearman-server/plugins/queue/libmemcached/queue.cc +@HAVE_LIBMEMCACHED_TRUE@am__append_9 = $(libmemcached_CFLAGS) +@HAVE_LIBMEMCACHED_TRUE@am__append_10 = $(libmemcached_LIBS) +@HAVE_LIBMEMCACHED_TRUE@am__append_11 = $(libmemcached_LIBS) +@HAVE_LIBMEMCACHED_TRUE@am__append_12 = $(libmemcached_CFLAGS) +@HAVE_LIBPQ_TRUE@am__append_13 = libgearman-server/plugins/queue/postgres/queue.h +@HAVE_LIBPQ_TRUE@am__append_14 = libgearman-server/plugins/queue/postgres/queue.cc +@HAVE_LIBPQ_TRUE@am__append_15 = $(LTLIBPQ) +@HAVE_LIBSQLITE3_TRUE@am__append_16 = libgearman-server/plugins/queue/sqlite/queue.h +@HAVE_LIBSQLITE3_TRUE@am__append_17 = libgearman-server/plugins/queue/sqlite/queue.cc +@HAVE_LIBSQLITE3_TRUE@am__append_18 = $(LTLIBSQLITE3) +@HAVE_LIBTOKYOCABINET_TRUE@am__append_19 = libgearman-server/plugins/queue/tokyocabinet/queue.h +@HAVE_LIBTOKYOCABINET_TRUE@am__append_20 = libgearman-server/plugins/queue/tokyocabinet/queue.cc +@HAVE_LIBTOKYOCABINET_TRUE@am__append_21 = $(LTLIBTOKYOCABINET) +@HAVE_LIBDRIZZLE_TRUE@am__append_22 = tests/drizzle_test +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@am__append_23 = tests/memcached_test +@HAVE_LIBSQLITE3_TRUE@am__append_24 = tests/gearman.sql tests/gearman.sql-journal tests/gearmand.log* +@HAVE_LIBSQLITE3_TRUE@am__append_25 = tests/sqlite_test +@HAVE_LIBTOKYOCABINET_TRUE@am__append_26 = tests/gearman.tcb +@HAVE_LIBTOKYOCABINET_TRUE@am__append_27 = tests/tokyocabinet_test subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_compile_stdcxx_0x.m4 \ - $(top_srcdir)/m4/ac_cxx_header_stdcxx_98.m4 \ - $(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/m4/extensions.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/boost.m4 $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libdrizzle.m4 \ + $(top_srcdir)/m4/libmemcached.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/memcached.m4 \ $(top_srcdir)/m4/pandora_64bit.m4 \ $(top_srcdir)/m4/pandora_canonical.m4 \ $(top_srcdir)/m4/pandora_check_compiler_version.m4 \ $(top_srcdir)/m4/pandora_check_cxx_standard.m4 \ + $(top_srcdir)/m4/pandora_cinttypes.m4 \ $(top_srcdir)/m4/pandora_clock_gettime.m4 \ + $(top_srcdir)/m4/pandora_cstdint.m4 \ $(top_srcdir)/m4/pandora_enable_dtrace.m4 \ - $(top_srcdir)/m4/pandora_ensure_gcc_version.m4 \ $(top_srcdir)/m4/pandora_extensions.m4 \ $(top_srcdir)/m4/pandora_have_better_malloc.m4 \ $(top_srcdir)/m4/pandora_have_gcc_atomics.m4 \ - $(top_srcdir)/m4/pandora_have_libdrizzle.m4 \ $(top_srcdir)/m4/pandora_have_libevent.m4 \ - $(top_srcdir)/m4/pandora_have_libgtest.m4 \ - $(top_srcdir)/m4/pandora_have_libmemcached.m4 \ $(top_srcdir)/m4/pandora_have_libpq.m4 \ $(top_srcdir)/m4/pandora_have_libsqlite3.m4 \ $(top_srcdir)/m4/pandora_have_libtokyocabinet.m4 \ $(top_srcdir)/m4/pandora_have_libuuid.m4 \ $(top_srcdir)/m4/pandora_header_assert.m4 \ + $(top_srcdir)/m4/pandora_header_stdcxx_98.m4 \ $(top_srcdir)/m4/pandora_libtool.m4 \ $(top_srcdir)/m4/pandora_optimize.m4 \ $(top_srcdir)/m4/pandora_platform.m4 \ @@ -211,17 +452,17 @@ $(top_srcdir)/m4/pandora_version.m4 \ $(top_srcdir)/m4/pandora_visibility.m4 \ $(top_srcdir)/m4/pandora_warnings.m4 \ - $(top_srcdir)/m4/pandora_with_gettext.m4 \ - $(top_srcdir)/m4/pandora_with_memcached.m4 \ - $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/pandora_with_valgrind.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/socket_send_flags.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = libgearman/configure.h scripts/gearmand \ - scripts/gearmand-init scripts/gearmand.xml \ +CONFIG_CLEAN_FILES = docs/conf.py libgearman/version.h \ + scripts/gearmand scripts/gearmand-init scripts/gearmand.xml \ scripts/smf_install.sh support/gearmand.pc \ support/gearmand.spec CONFIG_CLEAN_VPATH_FILES = @@ -260,84 +501,139 @@ am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent am__DEPENDENCIES_1 = +@HAVE_LIBDRIZZLE_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +@HAVE_LIBMEMCACHED_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) +@HAVE_LIBPQ_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) +@HAVE_LIBSQLITE3_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1) +@HAVE_LIBTOKYOCABINET_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_1) libgearman_server_libgearman_server_la_DEPENDENCIES = \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - libgearman/libgearman.la libgearman/libgearmancore.la + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ + $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_1) am__libgearman_server_libgearman_server_la_SOURCES_DIST = \ - libgearman-server/queue_libdrizzle.c \ - libgearman-server/queue_libmemcached.c \ - libgearman-server/queue_libpq.c \ - libgearman-server/queue_libsqlite3.c \ - libgearman-server/queue_libtokyocabinet.c \ - libgearman-server/client.c libgearman-server/conf.c \ - libgearman-server/conf_module.c libgearman-server/connection.c \ - libgearman-server/function.c libgearman-server/gearmand.c \ + libgearman-server/error/strerror.cc \ + libgearman-server/plugins/protocol/http/protocol.cc \ + libgearman-server/plugins/queue/drizzle/queue.cc \ + libgearman-server/plugins/queue/libmemcached/queue.cc \ + libgearman-server/plugins/queue/postgres/queue.cc \ + libgearman-server/plugins/queue/sqlite/queue.cc \ + libgearman-server/plugins/queue/tokyocabinet/queue.cc \ + libgearman-server/byteorder.cc libgearman-server/client.cc \ + libgearman-server/connection.c \ + libgearman-server/connection_list.cc libgearman-server/fifo.c \ + libgearman-server/function.cc libgearman-server/gearmand.cc \ libgearman-server/gearmand_con.c \ - libgearman-server/gearmand_thread.c libgearman-server/job.c \ - libgearman-server/log.c libgearman-server/packet.c \ - libgearman-server/protocol_http.c libgearman-server/server.c \ - libgearman-server/thread.c libgearman-server/worker.c -@HAVE_LIBDRIZZLE_TRUE@am__objects_1 = libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo -@HAVE_LIBMEMCACHED_TRUE@am__objects_2 = libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo -@HAVE_LIBPQ_TRUE@am__objects_3 = libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo -@HAVE_LIBSQLITE3_TRUE@am__objects_4 = libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo -@HAVE_LIBTOKYOCABINET_TRUE@am__objects_5 = libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo -am_libgearman_server_libgearman_server_la_OBJECTS = $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) $(am__objects_4) \ - $(am__objects_5) \ + libgearman-server/gearmand_thread.cc libgearman-server/hash.c \ + libgearman-server/io.cc libgearman-server/job.c \ + libgearman-server/list.c libgearman-server/log.cc \ + libgearman-server/packet.cc libgearman-server/plugins.cc \ + libgearman-server/queue.cc libgearman-server/server.c \ + libgearman-server/thread.c libgearman-server/wakeup.cc \ + libgearman-server/worker.cc libgearman/command.cc +@HAVE_LIBDRIZZLE_TRUE@am__objects_1 = libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo +@HAVE_LIBMEMCACHED_TRUE@am__objects_2 = libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo +@HAVE_LIBPQ_TRUE@am__objects_3 = libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo +@HAVE_LIBSQLITE3_TRUE@am__objects_4 = libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo +@HAVE_LIBTOKYOCABINET_TRUE@am__objects_5 = libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo +am_libgearman_server_libgearman_server_la_OBJECTS = libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo \ + libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo \ + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) \ + libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo \ libgearman-server/libgearman_server_libgearman_server_la-client.lo \ - libgearman-server/libgearman_server_libgearman_server_la-conf.lo \ - libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo \ libgearman-server/libgearman_server_libgearman_server_la-connection.lo \ + libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo \ + libgearman-server/libgearman_server_libgearman_server_la-fifo.lo \ libgearman-server/libgearman_server_libgearman_server_la-function.lo \ libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo \ libgearman-server/libgearman_server_libgearman_server_la-gearmand_con.lo \ libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo \ + libgearman-server/libgearman_server_libgearman_server_la-hash.lo \ + libgearman-server/libgearman_server_libgearman_server_la-io.lo \ libgearman-server/libgearman_server_libgearman_server_la-job.lo \ + libgearman-server/libgearman_server_libgearman_server_la-list.lo \ libgearman-server/libgearman_server_libgearman_server_la-log.lo \ libgearman-server/libgearman_server_libgearman_server_la-packet.lo \ - libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo \ + libgearman-server/libgearman_server_libgearman_server_la-plugins.lo \ + libgearman-server/libgearman_server_libgearman_server_la-queue.lo \ libgearman-server/libgearman_server_libgearman_server_la-server.lo \ libgearman-server/libgearman_server_libgearman_server_la-thread.lo \ - libgearman-server/libgearman_server_libgearman_server_la-worker.lo + libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo \ + libgearman-server/libgearman_server_libgearman_server_la-worker.lo \ + libgearman/libgearman_server_libgearman_server_la-command.lo libgearman_server_libgearman_server_la_OBJECTS = \ $(am_libgearman_server_libgearman_server_la_OBJECTS) libgearman_server_libgearman_server_la_LINK = $(LIBTOOL) $(AM_V_lt) \ - --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ - $(CCLD) $(libgearman_server_libgearman_server_la_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ + --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CXXLD) $(libgearman_server_libgearman_server_la_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_libgearman_libgearman_la_OBJECTS = \ + libgearman/libgearman_libgearman_la-actions.lo \ + libgearman/libgearman_libgearman_la-aggregator.lo \ + libgearman/libgearman_libgearman_la-allocator.lo \ + libgearman/libgearman_libgearman_la-argument.lo \ + libgearman/libgearman_libgearman_la-add.lo \ + libgearman/libgearman_libgearman_la-byteorder.lo \ libgearman/libgearman_libgearman_la-client.lo \ + libgearman/libgearman_libgearman_la-command.lo \ + libgearman/libgearman_libgearman_la-connection.lo \ + libgearman/libgearman_libgearman_la-do.lo \ + libgearman/libgearman_libgearman_la-error.lo \ + libgearman/libgearman_libgearman_la-execute.lo \ + libgearman/libgearman_libgearman_la-function.lo \ + libgearman/function/libgearman_libgearman_la-function_v2.lo \ + libgearman/function/libgearman_libgearman_la-make.lo \ + libgearman/function/libgearman_libgearman_la-partition.lo \ libgearman/libgearman_libgearman_la-gearman.lo \ libgearman/libgearman_libgearman_la-job.lo \ + libgearman/libgearman_libgearman_la-log.lo \ + libgearman/libgearman_libgearman_la-packet.lo \ + libgearman/libgearman_libgearman_la-parse.lo \ + libgearman/libgearman_libgearman_la-result.lo \ + libgearman/libgearman_libgearman_la-run.lo \ + libgearman/libgearman_libgearman_la-strcommand.lo \ libgearman/libgearman_libgearman_la-strerror.lo \ + libgearman/libgearman_libgearman_la-string.lo \ libgearman/libgearman_libgearman_la-task.lo \ + libgearman/libgearman_libgearman_la-task_attr.lo \ + libgearman/libgearman_libgearman_la-unique.lo \ + libgearman/libgearman_libgearman_la-universal.lo \ + libgearman/libgearman_libgearman_la-vector.lo \ libgearman/libgearman_libgearman_la-worker.lo libgearman_libgearman_la_OBJECTS = \ $(am_libgearman_libgearman_la_OBJECTS) -libgearman_libgearman_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) \ +libgearman_libgearman_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) \ $(libgearman_libgearman_la_LDFLAGS) $(LDFLAGS) -o $@ libgearman_libgearmancore_la_LIBADD = am_libgearman_libgearmancore_la_OBJECTS = \ + libgearman/libgearman_libgearmancore_la-allocator.lo \ libgearman/libgearman_libgearmancore_la-byteorder.lo \ + libgearman/libgearman_libgearmancore_la-command.lo \ libgearman/libgearman_libgearmancore_la-connection.lo \ + libgearman/libgearman_libgearmancore_la-error.lo \ libgearman/libgearman_libgearmancore_la-log.lo \ libgearman/libgearman_libgearmancore_la-packet.lo \ - libgearman/libgearman_libgearmancore_la-universal.lo + libgearman/libgearman_libgearmancore_la-strcommand.lo \ + libgearman/libgearman_libgearmancore_la-strerror.lo \ + libgearman/libgearman_libgearmancore_la-universal.lo \ + libgearman/libgearman_libgearmancore_la-vector.lo libgearman_libgearmancore_la_OBJECTS = \ $(am_libgearman_libgearmancore_la_OBJECTS) -libgearman_libgearmancore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -tests_libtest_la_LIBADD = -am_tests_libtest_la_OBJECTS = tests/test.lo tests/test_gearmand.lo -tests_libtest_la_OBJECTS = $(am_tests_libtest_la_OBJECTS) -@HAVE_LIBGTEST_TRUE@am__EXEEXT_1 = unittests/unittests$(EXEEXT) +libgearman_libgearmancore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +libtest_libserver_la_LIBADD = +am_libtest_libserver_la_OBJECTS = libtest/gearmand.lo \ + libtest/worker.lo +libtest_libserver_la_OBJECTS = $(am_libtest_libserver_la_OBJECTS) +libtest_libtest_la_LIBADD = +am_libtest_libtest_la_OBJECTS = libtest/cmdline.lo \ + libtest/framework.lo libtest/test.lo +libtest_libtest_la_OBJECTS = $(am_libtest_libtest_la_OBJECTS) +@HAVE_LIBDRIZZLE_TRUE@am__EXEEXT_1 = tests/drizzle_test$(EXEEXT) @HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@am__EXEEXT_2 = tests/memcached_test$(EXEEXT) @HAVE_LIBSQLITE3_TRUE@am__EXEEXT_3 = tests/sqlite_test$(EXEEXT) @HAVE_LIBTOKYOCABINET_TRUE@am__EXEEXT_4 = \ @@ -350,92 +646,175 @@ benchmark_blobslap_client_DEPENDENCIES = benchmark/libbenchmark.la \ libgearman/libgearman.la am_benchmark_blobslap_worker_OBJECTS = \ - benchmark/blobslap_worker.$(OBJEXT) + benchmark/blobslap_worker.$(OBJEXT) util/daemon.$(OBJEXT) benchmark_blobslap_worker_OBJECTS = \ $(am_benchmark_blobslap_worker_OBJECTS) -benchmark_blobslap_worker_DEPENDENCIES = benchmark/libbenchmark.la \ - libgearman/libgearman.la -am_bin_gearman_OBJECTS = bin/gearman.$(OBJEXT) -bin_gearman_OBJECTS = $(am_bin_gearman_OBJECTS) -bin_gearman_DEPENDENCIES = libgearman/libgearman.la \ +benchmark_blobslap_worker_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + benchmark/libbenchmark.la libgearman/libgearman.la +am_bin_gearadmin_OBJECTS = bin/bin_gearadmin-gearadmin.$(OBJEXT) \ + util/bin_gearadmin-instance.$(OBJEXT) +bin_gearadmin_OBJECTS = $(am_bin_gearadmin_OBJECTS) +bin_gearadmin_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -am_examples_echo_client_OBJECTS = examples/echo_client.$(OBJEXT) -examples_echo_client_OBJECTS = $(am_examples_echo_client_OBJECTS) -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +bin_gearadmin_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(bin_gearadmin_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_bin_gearman_OBJECTS = bin/arguments.$(OBJEXT) \ + bin/function.$(OBJEXT) bin/gearman.$(OBJEXT) \ + util/error.$(OBJEXT) util/pidfile.$(OBJEXT) +bin_gearman_OBJECTS = $(am_bin_gearman_OBJECTS) +bin_gearman_DEPENDENCIES = libgearman/libgearman.la +am_docs_libgearman_examples_gearman_client_do_background_example_OBJECTS = docs/libgearman/examples/gearman_client_do_background_example.$(OBJEXT) +docs_libgearman_examples_gearman_client_do_background_example_OBJECTS = $(am_docs_libgearman_examples_gearman_client_do_background_example_OBJECTS) +docs_libgearman_examples_gearman_client_do_background_example_DEPENDENCIES = \ + libgearman/libgearman.la +am_docs_libgearman_examples_gearman_client_do_example_OBJECTS = \ + docs/libgearman/examples/gearman_client_do_example.$(OBJEXT) +docs_libgearman_examples_gearman_client_do_example_OBJECTS = $(am_docs_libgearman_examples_gearman_client_do_example_OBJECTS) +docs_libgearman_examples_gearman_client_do_example_DEPENDENCIES = \ + libgearman/libgearman.la +am_docs_libgearman_examples_gearman_execute_example_OBJECTS = \ + docs/libgearman/examples/gearman_execute_example.$(OBJEXT) +docs_libgearman_examples_gearman_execute_example_OBJECTS = $(am_docs_libgearman_examples_gearman_execute_example_OBJECTS) +docs_libgearman_examples_gearman_execute_example_DEPENDENCIES = \ libgearman/libgearman.la -examples_echo_client_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_examples_echo_worker_OBJECTS = examples/echo_worker.$(OBJEXT) +am_docs_libgearman_examples_gearman_execute_partition_OBJECTS = \ + docs/libgearman/examples/gearman_execute_partition.$(OBJEXT) +docs_libgearman_examples_gearman_execute_partition_OBJECTS = $(am_docs_libgearman_examples_gearman_execute_partition_OBJECTS) +docs_libgearman_examples_gearman_execute_partition_DEPENDENCIES = \ + libgearman/libgearman.la +am_examples_echo_client_OBJECTS = \ + examples/examples_echo_client-echo_client.$(OBJEXT) +examples_echo_client_OBJECTS = $(am_examples_echo_client_OBJECTS) +am__DEPENDENCIES_7 = $(am__DEPENDENCIES_1) libgearman/libgearman.la +examples_echo_client_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_echo_client_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(examples_echo_client_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_examples_echo_worker_OBJECTS = \ + examples/examples_echo_worker-echo_worker.$(OBJEXT) examples_echo_worker_OBJECTS = $(am_examples_echo_worker_OBJECTS) -examples_echo_worker_DEPENDENCIES = $(am__DEPENDENCIES_2) +examples_echo_worker_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_echo_worker_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(examples_echo_worker_LDFLAGS) \ + $(LDFLAGS) -o $@ am_examples_reverse_client_OBJECTS = \ - examples/reverse_client.$(OBJEXT) + examples/examples_reverse_client-reverse_client.$(OBJEXT) examples_reverse_client_OBJECTS = \ $(am_examples_reverse_client_OBJECTS) -examples_reverse_client_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_examples_reverse_client_bg_OBJECTS = \ - examples/reverse_client_bg.$(OBJEXT) +examples_reverse_client_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_reverse_client_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(examples_reverse_client_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_examples_reverse_client_bg_OBJECTS = examples/examples_reverse_client_bg-reverse_client_bg.$(OBJEXT) examples_reverse_client_bg_OBJECTS = \ $(am_examples_reverse_client_bg_OBJECTS) -examples_reverse_client_bg_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_examples_reverse_client_cb_OBJECTS = \ - examples/reverse_client_cb.$(OBJEXT) +examples_reverse_client_bg_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_reverse_client_bg_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(examples_reverse_client_bg_LDFLAGS) $(LDFLAGS) -o $@ +am_examples_reverse_client_cb_OBJECTS = examples/examples_reverse_client_cb-reverse_client_cb.$(OBJEXT) examples_reverse_client_cb_OBJECTS = \ $(am_examples_reverse_client_cb_OBJECTS) -examples_reverse_client_cb_DEPENDENCIES = $(am__DEPENDENCIES_2) +examples_reverse_client_cb_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_reverse_client_cb_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(examples_reverse_client_cb_LDFLAGS) $(LDFLAGS) -o $@ +am_examples_reverse_client_epoch_OBJECTS = examples/examples_reverse_client_epoch-reverse_client_epoch.$(OBJEXT) +examples_reverse_client_epoch_OBJECTS = \ + $(am_examples_reverse_client_epoch_OBJECTS) +examples_reverse_client_epoch_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_reverse_client_epoch_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(examples_reverse_client_epoch_LDFLAGS) $(LDFLAGS) -o $@ am_examples_reverse_worker_OBJECTS = \ - examples/reverse_worker.$(OBJEXT) + examples/examples_reverse_worker-reverse_worker.$(OBJEXT) examples_reverse_worker_OBJECTS = \ $(am_examples_reverse_worker_OBJECTS) -examples_reverse_worker_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_examples_wc_worker_OBJECTS = examples/wc_worker.$(OBJEXT) +examples_reverse_worker_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_reverse_worker_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(examples_reverse_worker_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_examples_wc_worker_OBJECTS = \ + examples/examples_wc_worker-wc_worker.$(OBJEXT) examples_wc_worker_OBJECTS = $(am_examples_wc_worker_OBJECTS) -examples_wc_worker_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_gearmand_gearmand_OBJECTS = gearmand/gearmand.$(OBJEXT) +examples_wc_worker_DEPENDENCIES = $(am__DEPENDENCIES_7) +examples_wc_worker_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(examples_wc_worker_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_gearmand_gearmand_OBJECTS = \ + gearmand/gearmand_gearmand-gearmand.$(OBJEXT) \ + util/gearmand_gearmand-daemon.$(OBJEXT) \ + util/gearmand_gearmand-pidfile.$(OBJEXT) gearmand_gearmand_OBJECTS = $(am_gearmand_gearmand_OBJECTS) -gearmand_gearmand_DEPENDENCIES = \ - libgearman-server/libgearman-server.la $(am__DEPENDENCIES_1) -am_tests_client_test_OBJECTS = tests/test_worker.$(OBJEXT) \ - tests/client_test.$(OBJEXT) +gearmand_gearmand_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) libgearman-server/libgearman-server.la \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +gearmand_gearmand_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(gearmand_gearmand_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_libtest_unittest_OBJECTS = libtest/unittest.$(OBJEXT) +libtest_unittest_OBJECTS = $(am_libtest_unittest_OBJECTS) +libtest_unittest_DEPENDENCIES = libtest/libtest.la +am_libtest_wait_OBJECTS = libtest/wait.$(OBJEXT) +libtest_wait_OBJECTS = $(am_libtest_wait_OBJECTS) +libtest_wait_LDADD = $(LDADD) +am_tests_burnin_test_OBJECTS = tests/burnin.$(OBJEXT) +tests_burnin_test_OBJECTS = $(am_tests_burnin_test_OBJECTS) +tests_burnin_test_DEPENDENCIES = $(CLIENT_LDADD) +am_tests_c_test_OBJECTS = tests/c_test.$(OBJEXT) +tests_c_test_OBJECTS = $(am_tests_c_test_OBJECTS) +tests_c_test_DEPENDENCIES = $(CLIENT_LDADD) +am_tests_client_test_OBJECTS = tests/client_test.$(OBJEXT) \ + tests/do.$(OBJEXT) tests/do_background.$(OBJEXT) \ + tests/execute.$(OBJEXT) \ + tests/gearman_client_do_job_handle.$(OBJEXT) \ + tests/gearman_execute_partition.$(OBJEXT) \ + tests/protocol.$(OBJEXT) tests/server_options.$(OBJEXT) \ + tests/task.$(OBJEXT) tests/unique.$(OBJEXT) \ + tests/workers.$(OBJEXT) tests/workers_v1.$(OBJEXT) tests_client_test_OBJECTS = $(am_tests_client_test_OBJECTS) -tests_client_test_DEPENDENCIES = $(TEST_LDADD) am_tests_cpp_test_OBJECTS = tests/cpp_test.$(OBJEXT) tests_cpp_test_OBJECTS = $(am_tests_cpp_test_OBJECTS) -tests_cpp_test_DEPENDENCIES = $(TEST_LDADD) -am_tests_internals_test_OBJECTS = tests/internals.$(OBJEXT) +tests_cpp_test_DEPENDENCIES = $(CLIENT_LDADD) +am_tests_drizzle_test_OBJECTS = tests/basic.$(OBJEXT) \ + tests/drizzle_test.$(OBJEXT) +tests_drizzle_test_OBJECTS = $(am_tests_drizzle_test_OBJECTS) +tests_drizzle_test_DEPENDENCIES = $(CLIENT_LDADD) +am_tests_internals_test_OBJECTS = tests/internals.$(OBJEXT) \ + tests/regression.$(OBJEXT) tests_internals_test_OBJECTS = $(am_tests_internals_test_OBJECTS) -tests_internals_test_DEPENDENCIES = $(TEST_LDADD) \ - libgearman/libgearmancore.la -am_tests_memcached_test_OBJECTS = tests/memcached_test.$(OBJEXT) +am_tests_memcached_test_OBJECTS = tests/basic.$(OBJEXT) \ + tests/memcached_test.$(OBJEXT) tests_memcached_test_OBJECTS = $(am_tests_memcached_test_OBJECTS) -tests_memcached_test_DEPENDENCIES = $(TEST_LDADD) -am_tests_regression_test_OBJECTS = tests/regression.$(OBJEXT) -tests_regression_test_OBJECTS = $(am_tests_regression_test_OBJECTS) -tests_regression_test_DEPENDENCIES = $(TEST_LDADD) \ - libgearman/libgearmancore.la +tests_memcached_test_DEPENDENCIES = $(CLIENT_LDADD) am_tests_round_robin_test_OBJECTS = tests/round_robin.$(OBJEXT) tests_round_robin_test_OBJECTS = $(am_tests_round_robin_test_OBJECTS) -tests_round_robin_test_DEPENDENCIES = $(TEST_LDADD) \ +tests_round_robin_test_DEPENDENCIES = $(CLIENT_LDADD) \ libgearman/libgearmancore.la -am_tests_sqlite_test_OBJECTS = tests/sqlite_test.$(OBJEXT) +am_tests_sqlite_test_OBJECTS = tests/basic.$(OBJEXT) \ + tests/sqlite_test.$(OBJEXT) tests_sqlite_test_OBJECTS = $(am_tests_sqlite_test_OBJECTS) -tests_sqlite_test_DEPENDENCIES = $(TEST_LDADD) +tests_sqlite_test_DEPENDENCIES = $(CLIENT_LDADD) am_tests_tokyocabinet_test_OBJECTS = \ - tests/tokyocabinet_test.$(OBJEXT) + tests/tokyocabinet_test.$(OBJEXT) tests/basic.$(OBJEXT) tests_tokyocabinet_test_OBJECTS = \ $(am_tests_tokyocabinet_test_OBJECTS) -tests_tokyocabinet_test_DEPENDENCIES = $(TEST_LDADD) +tests_tokyocabinet_test_DEPENDENCIES = $(CLIENT_LDADD) am_tests_worker_test_OBJECTS = tests/worker_test.$(OBJEXT) tests_worker_test_OBJECTS = $(am_tests_worker_test_OBJECTS) -tests_worker_test_DEPENDENCIES = $(TEST_LDADD) -am_unittests_unittests_OBJECTS = \ - unittests/unittests_unittests-main.$(OBJEXT) -unittests_unittests_OBJECTS = $(am_unittests_unittests_OBJECTS) -unittests_unittests_DEPENDENCIES = libgearman/libgearman.la \ - libgearman-server/libgearman-server.la $(am__DEPENDENCIES_1) -unittests_unittests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(unittests_unittests_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +tests_worker_test_DEPENDENCIES = $(CLIENT_LDADD) \ + libgearman/libgearmancore.la DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @@ -482,66 +861,116 @@ $(libgearman_server_libgearman_server_la_SOURCES) \ $(libgearman_libgearman_la_SOURCES) \ $(libgearman_libgearmancore_la_SOURCES) \ - $(tests_libtest_la_SOURCES) \ + $(libtest_libserver_la_SOURCES) $(libtest_libtest_la_SOURCES) \ $(benchmark_blobslap_client_SOURCES) \ - $(benchmark_blobslap_worker_SOURCES) $(bin_gearman_SOURCES) \ + $(benchmark_blobslap_worker_SOURCES) $(bin_gearadmin_SOURCES) \ + $(bin_gearman_SOURCES) \ + $(docs_libgearman_examples_gearman_client_do_background_example_SOURCES) \ + $(docs_libgearman_examples_gearman_client_do_example_SOURCES) \ + $(docs_libgearman_examples_gearman_execute_example_SOURCES) \ + $(docs_libgearman_examples_gearman_execute_partition_SOURCES) \ $(examples_echo_client_SOURCES) \ $(examples_echo_worker_SOURCES) \ $(examples_reverse_client_SOURCES) \ $(examples_reverse_client_bg_SOURCES) \ $(examples_reverse_client_cb_SOURCES) \ + $(examples_reverse_client_epoch_SOURCES) \ $(examples_reverse_worker_SOURCES) \ $(examples_wc_worker_SOURCES) $(gearmand_gearmand_SOURCES) \ + $(libtest_unittest_SOURCES) $(libtest_wait_SOURCES) \ + $(tests_burnin_test_SOURCES) $(tests_c_test_SOURCES) \ $(tests_client_test_SOURCES) $(tests_cpp_test_SOURCES) \ - $(tests_internals_test_SOURCES) \ + $(tests_drizzle_test_SOURCES) $(tests_internals_test_SOURCES) \ $(tests_memcached_test_SOURCES) \ - $(tests_regression_test_SOURCES) \ $(tests_round_robin_test_SOURCES) $(tests_sqlite_test_SOURCES) \ $(tests_tokyocabinet_test_SOURCES) \ - $(tests_worker_test_SOURCES) $(unittests_unittests_SOURCES) + $(tests_worker_test_SOURCES) DIST_SOURCES = $(benchmark_libbenchmark_la_SOURCES) \ $(am__libgearman_server_libgearman_server_la_SOURCES_DIST) \ $(libgearman_libgearman_la_SOURCES) \ $(libgearman_libgearmancore_la_SOURCES) \ - $(tests_libtest_la_SOURCES) \ + $(libtest_libserver_la_SOURCES) $(libtest_libtest_la_SOURCES) \ $(benchmark_blobslap_client_SOURCES) \ - $(benchmark_blobslap_worker_SOURCES) $(bin_gearman_SOURCES) \ + $(benchmark_blobslap_worker_SOURCES) $(bin_gearadmin_SOURCES) \ + $(bin_gearman_SOURCES) \ + $(docs_libgearman_examples_gearman_client_do_background_example_SOURCES) \ + $(docs_libgearman_examples_gearman_client_do_example_SOURCES) \ + $(docs_libgearman_examples_gearman_execute_example_SOURCES) \ + $(docs_libgearman_examples_gearman_execute_partition_SOURCES) \ $(examples_echo_client_SOURCES) \ $(examples_echo_worker_SOURCES) \ $(examples_reverse_client_SOURCES) \ $(examples_reverse_client_bg_SOURCES) \ $(examples_reverse_client_cb_SOURCES) \ + $(examples_reverse_client_epoch_SOURCES) \ $(examples_reverse_worker_SOURCES) \ $(examples_wc_worker_SOURCES) $(gearmand_gearmand_SOURCES) \ + $(libtest_unittest_SOURCES) $(libtest_wait_SOURCES) \ + $(tests_burnin_test_SOURCES) $(tests_c_test_SOURCES) \ $(tests_client_test_SOURCES) $(tests_cpp_test_SOURCES) \ - $(tests_internals_test_SOURCES) \ + $(tests_drizzle_test_SOURCES) $(tests_internals_test_SOURCES) \ $(tests_memcached_test_SOURCES) \ - $(tests_regression_test_SOURCES) \ $(tests_round_robin_test_SOURCES) $(tests_sqlite_test_SOURCES) \ $(tests_tokyocabinet_test_SOURCES) \ - $(tests_worker_test_SOURCES) $(unittests_unittests_SOURCES) + $(tests_worker_test_SOURCES) man1dir = $(mandir)/man1 man3dir = $(mandir)/man3 man8dir = $(mandir)/man8 NROFF = nroff -MANS = $(dist_man_MANS) +MANS = $(man1_MANS) $(man3_MANS) $(man8_MANS) DATA = $(pkgconfig_DATA) -am__noinst_HEADERS_DIST = benchmark/benchmark.h libgearman/common.h \ - libgearman/log.h libgearman-server/queue_libdrizzle.h \ - libgearman-server/queue_libmemcached.h \ - libgearman-server/queue_libpq.h \ - libgearman-server/queue_libsqlite3.h \ - libgearman-server/queue_libtokyocabinet.h \ - libgearman-server/client.h libgearman-server/conf.h \ - libgearman-server/conf_module.h libgearman-server/connection.h \ - libgearman-server/constants.h libgearman-server/function.h \ - libgearman-server/gearmand.h libgearman-server/gearmand_con.h \ - libgearman-server/gearmand_thread.h libgearman-server/job.h \ - libgearman-server/log.h libgearman-server/packet.h \ - libgearman-server/protocol_http.h libgearman-server/server.h \ - libgearman-server/thread.h libgearman-server/worker.h \ - libgearman-server/common.h tests/test.h tests/test_gearmand.h \ - tests/test_worker.h +am__noinst_HEADERS_DIST = benchmark/benchmark.h bin/arguments.h \ + bin/function.h bin/client.h bin/worker.h \ + libgearman-server/error.h libgearman-server/error/strerror.h \ + libgearman-server/error/type.h \ + libgearman-server/plugins/base.h \ + libgearman-server/plugins/protocol.h \ + libgearman-server/plugins/queue.h \ + libgearman-server/plugins/protocol/http/protocol.h \ + libgearman-server/plugins/queue/base.h \ + libgearman-server/plugins/queue/drizzle/queue.h \ + libgearman-server/plugins/queue/libmemcached/queue.h \ + libgearman-server/plugins/queue/postgres/queue.h \ + libgearman-server/plugins/queue/sqlite/queue.h \ + libgearman-server/plugins/queue/tokyocabinet/queue.h \ + libgearman-server/byte.h libgearman-server/byteorder.h \ + libgearman-server/client.h libgearman-server/common.h \ + libgearman-server/connection.h \ + libgearman-server/connection_list.h \ + libgearman-server/constants.h libgearman-server/fifo.h \ + libgearman-server/function.h libgearman-server/gearmand.h \ + libgearman-server/gearmand_con.h \ + libgearman-server/gearmand_thread.h libgearman-server/hash.h \ + libgearman-server/io.h libgearman-server/job.h \ + libgearman-server/list.h libgearman-server/log.h \ + libgearman-server/packet.h libgearman-server/queue.h \ + libgearman-server/plugins.h libgearman-server/port.h \ + libgearman-server/server.h libgearman-server/thread.h \ + libgearman-server/wakeup.h libgearman-server/worker.h \ + libgearman/add.hpp libgearman/aggregator.hpp \ + libgearman/allocator.hpp libgearman/assert.hpp \ + libgearman/common.h libgearman/connection.hpp \ + libgearman/do.hpp libgearman/error.hpp \ + libgearman/function/base.hpp \ + libgearman/function/function_v1.hpp \ + libgearman/function/function_v2.hpp \ + libgearman/function/make.hpp libgearman/function/null.hpp \ + libgearman/function/partition.hpp libgearman/is.hpp \ + libgearman/log.h libgearman/packet.hpp libgearman/result.hpp \ + libgearman/run.hpp libgearman/strcommand.h libgearman/unique.h \ + libgearman/universal.hpp libgearman/vector.hpp util/daemon.h \ + util/error.h util/instance.h util/operation.h util/pidfile.h \ + libtest/callbacks.h libtest/cmdline.h libtest/collection.h \ + libtest/common.h libtest/core.h libtest/error.h \ + libtest/framework.cc libtest/framework.h libtest/get.h \ + libtest/runner.h libtest/server.h libtest/stats.h \ + libtest/strerror.h libtest/test.h libtest/test.hpp \ + libtest/visibility.h libtest/wait.h libtest/worker.h \ + tests/basic.h tests/context.h tests/do.h tests/do_background.h \ + tests/execute.h tests/gearman_client_do_job_handle.h \ + tests/gearman_execute_partition.h tests/ports.h \ + tests/protocol.h tests/regression.h tests/server_options.h \ + tests/task.h tests/unique.h tests/workers.h tests/workers_v1.h HEADERS = $(nobase_include_HEADERS) $(noinst_HEADERS) ETAGS = etags CTAGS = ctags @@ -559,6 +988,7 @@ distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_CPPFLAGS = @AM_CPPFLAGS@ @@ -571,6 +1001,13 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BETTER_MALLOC_LIBS = @BETTER_MALLOC_LIBS@ +BOOSTSKIP_WARNINGS = @BOOSTSKIP_WARNINGS@ +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ +BOOST_LDPATH = @BOOST_LDPATH@ +BOOST_PROGRAM_OPTIONS_LDFLAGS = @BOOST_PROGRAM_OPTIONS_LDFLAGS@ +BOOST_PROGRAM_OPTIONS_LDPATH = @BOOST_PROGRAM_OPTIONS_LDPATH@ +BOOST_PROGRAM_OPTIONS_LIBS = @BOOST_PROGRAM_OPTIONS_LIBS@ +BOOST_ROOT = @BOOST_ROOT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ @@ -582,11 +1019,13 @@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXXFLAG_VISIBILITY = @CXXFLAG_VISIBILITY@ CXX_STANDARD = @CXX_STANDARD@ CXX_VERSION = @CXX_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@ DOXYGEN = @DOXYGEN@ DPKG_GENSYMBOLS = @DPKG_GENSYMBOLS@ DSYMUTIL = @DSYMUTIL@ @@ -602,11 +1041,7 @@ GCOV_LIBS = @GCOV_LIBS@ GEARMAN_LIBRARY_VERSION = @GEARMAN_LIBRARY_VERSION@ GREP = @GREP@ -HAVE_LIBDRIZZLE = @HAVE_LIBDRIZZLE@ HAVE_LIBEVENT = @HAVE_LIBEVENT@ -HAVE_LIBGTEST = @HAVE_LIBGTEST@ -HAVE_LIBMEMCACHED = @HAVE_LIBMEMCACHED@ -HAVE_LIBMEMCACHEDPROTOCOL = @HAVE_LIBMEMCACHEDPROTOCOL@ HAVE_LIBPQ = @HAVE_LIBPQ@ HAVE_LIBSQLITE3 = @HAVE_LIBSQLITE3@ HAVE_LIBTOKYOCABINET = @HAVE_LIBTOKYOCABINET@ @@ -618,21 +1053,16 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLTOOL_WARNINGS = @INTLTOOL_WARNINGS@ ISAINFO = @ISAINFO@ +LCOV = @LCOV@ +LCOV_GENHTML = @LCOV_GENHTML@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC_P = @LIBC_P@ -LIBDRIZZLE = @LIBDRIZZLE@ -LIBDRIZZLE_PREFIX = @LIBDRIZZLE_PREFIX@ LIBEVENT = @LIBEVENT@ LIBEVENT_PREFIX = @LIBEVENT_PREFIX@ -LIBGTEST = @LIBGTEST@ -LIBGTEST_PREFIX = @LIBGTEST_PREFIX@ LIBM = @LIBM@ -LIBMEMCACHED = @LIBMEMCACHED@ -LIBMEMCACHEDPROTOCOL = @LIBMEMCACHEDPROTOCOL@ -LIBMEMCACHEDPROTOCOL_PREFIX = @LIBMEMCACHEDPROTOCOL_PREFIX@ -LIBMEMCACHED_PREFIX = @LIBMEMCACHED_PREFIX@ LIBOBJS = @LIBOBJS@ LIBPQ = @LIBPQ@ LIBPQ_PREFIX = @LIBPQ_PREFIX@ @@ -648,11 +1078,7 @@ LIBUUID_PREFIX = @LIBUUID_PREFIX@ LIPO = @LIPO@ LN_S = @LN_S@ -LTLIBDRIZZLE = @LTLIBDRIZZLE@ LTLIBEVENT = @LTLIBEVENT@ -LTLIBGTEST = @LTLIBGTEST@ -LTLIBMEMCACHED = @LTLIBMEMCACHED@ -LTLIBMEMCACHEDPROTOCOL = @LTLIBMEMCACHEDPROTOCOL@ LTLIBOBJS = @LTLIBOBJS@ LTLIBPQ = @LTLIBPQ@ LTLIBSQLITE3 = @LTLIBSQLITE3@ @@ -664,11 +1090,13 @@ NM = @NM@ NMEDIT = @NMEDIT@ NO_CONVERSION = @NO_CONVERSION@ +NO_EFF_CXX = @NO_EFF_CXX@ NO_OLD_STYLE_CAST = @NO_OLD_STYLE_CAST@ NO_REDUNDANT_DECLS = @NO_REDUNDANT_DECLS@ NO_SHADOW = @NO_SHADOW@ NO_STRICT_ALIASING = @NO_STRICT_ALIASING@ NO_UNREACHED = @NO_UNREACHED@ +NO_VISIBILITY = @NO_VISIBILITY@ NO_WERROR = @NO_WERROR@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -683,8 +1111,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PANDORA_HEX_VERSION = @PANDORA_HEX_VERSION@ PANDORA_OPTIMIZE_BITFIELD = @PANDORA_OPTIMIZE_BITFIELD@ +PANDORA_RELEASE_COMMENT = @PANDORA_RELEASE_COMMENT@ +PANDORA_RELEASE_ID = @PANDORA_RELEASE_ID@ +PANDORA_RELEASE_VERSION = @PANDORA_RELEASE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ +PERMISSIVE_C_WARNINGS = @PERMISSIVE_C_WARNINGS@ +PERMISSIVE_WARNINGS = @PERMISSIVE_WARNINGS@ PKG_CONFIG = @PKG_CONFIG@ PROTOSKIP_WARNINGS = @PROTOSKIP_WARNINGS@ PTHREAD_CC = @PTHREAD_CC@ @@ -694,11 +1127,14 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SPHINXBUILD = @SPHINXBUILD@ +SPHINX_WARNINGS = @SPHINX_WARNINGS@ STRIP = @STRIP@ TARGET_FREEBSD = @TARGET_FREEBSD@ TARGET_LINUX = @TARGET_LINUX@ TARGET_OSX = @TARGET_OSX@ TARGET_SOLARIS = @TARGET_SOLARIS@ +TARGET_WINDOWS = @TARGET_WINDOWS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -735,10 +1171,13 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ +libdrizzle_CFLAGS = @libdrizzle_CFLAGS@ +libdrizzle_LIBS = @libdrizzle_LIBS@ libexecdir = @libexecdir@ +libmemcached_CFLAGS = @libmemcached_CFLAGS@ +libmemcached_LIBS = @libmemcached_LIBS@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -759,311 +1198,507 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 - -#libgearman_libgearmancore_la_LDFLAGS= \ -# $(AM_LDFLAGS) \ -# -version-info \ -# $(GEARMAN_LIBRARY_VERSION) -# -#libgearman_libgearmancore_la_LIBADD= \ -# $(LTLIBUUID) lib_LTLIBRARIES = libgearman/libgearman.la noinst_LTLIBRARIES = benchmark/libbenchmark.la \ - libgearman/libgearmancore.la \ - libgearman-server/libgearman-server.la tests/libtest.la -nobase_include_HEADERS = libgearman/byteorder.h libgearman/client.h \ - libgearman/command.h libgearman/configure.h \ - libgearman/connection.h libgearman/constants.h \ - libgearman/core.h libgearman/gearman.h libgearman/job.h \ - libgearman/log.h libgearman/packet.h libgearman/strerror.h \ - libgearman/task.h libgearman/universal.h \ + libgearman-server/libgearman-server.la \ + libgearman/libgearmancore.la libtest/libserver.la \ + libtest/libtest.la +nobase_include_HEADERS = libgearman/actions.h libgearman/aggregator.h \ + libgearman/allocator.h libgearman/argument.h \ + libgearman/byteorder.h libgearman/client.h \ + libgearman/client_callbacks.h libgearman/command.h \ + libgearman/configure.h libgearman/connection.h \ + libgearman/constants.h libgearman/core.h libgearman/execute.h \ + libgearman/function.h libgearman/gearman.h libgearman/job.h \ + libgearman/job_handle.h libgearman/log.h libgearman/packet.h \ + libgearman/parse.h libgearman/priority.h libgearman/protocol.h \ + libgearman/result.h libgearman/return.h libgearman/strerror.h \ + libgearman/string.h libgearman/task.h libgearman/task_attr.h \ + libgearman/universal.h libgearman/version.h \ libgearman/visibility.h libgearman/worker.h -noinst_HEADERS = benchmark/benchmark.h libgearman/common.h \ - libgearman/log.h $(QUEUE_LIBDRIZZLE_H) $(QUEUE_LIBMEMCACHED_H) \ - $(QUEUE_LIBPQ_H) $(QUEUE_LIBSQLITE3_H) \ - $(QUEUE_LIBTOKYOCABINET_H) libgearman-server/client.h \ - libgearman-server/conf.h libgearman-server/conf_module.h \ - libgearman-server/connection.h libgearman-server/constants.h \ +noinst_HEADERS = benchmark/benchmark.h bin/arguments.h bin/function.h \ + bin/client.h bin/worker.h libgearman-server/error.h \ + libgearman-server/error/strerror.h \ + libgearman-server/error/type.h \ + libgearman-server/plugins/base.h \ + libgearman-server/plugins/protocol.h \ + libgearman-server/plugins/queue.h \ + libgearman-server/plugins/protocol/http/protocol.h \ + libgearman-server/plugins/queue/base.h $(am__append_1) \ + $(am__append_7) $(am__append_13) $(am__append_16) \ + $(am__append_19) libgearman-server/byte.h \ + libgearman-server/byteorder.h libgearman-server/client.h \ + libgearman-server/common.h libgearman-server/connection.h \ + libgearman-server/connection_list.h \ + libgearman-server/constants.h libgearman-server/fifo.h \ libgearman-server/function.h libgearman-server/gearmand.h \ libgearman-server/gearmand_con.h \ - libgearman-server/gearmand_thread.h libgearman-server/job.h \ - libgearman-server/log.h libgearman-server/packet.h \ - libgearman-server/protocol_http.h libgearman-server/server.h \ - libgearman-server/thread.h libgearman-server/worker.h \ - libgearman-server/common.h tests/test.h tests/test_gearmand.h \ - tests/test_worker.h -EXTRA_DIST = support/gearmand.spec docs/Doxyfile.api docs/Doxyfile.dev \ - docs/api_header.html docs/dev_header.html docs/doxygen.h \ - scripts/README.solaris -CLEANFILES = $(am__append_2) $(am__append_4) -benchmark_libbenchmark_la_SOURCES = benchmark/benchmark.c -benchmark_blobslap_client_SOURCES = benchmark/blobslap_client.c + libgearman-server/gearmand_thread.h libgearman-server/hash.h \ + libgearman-server/io.h libgearman-server/job.h \ + libgearman-server/list.h libgearman-server/log.h \ + libgearman-server/packet.h libgearman-server/queue.h \ + libgearman-server/plugins.h libgearman-server/port.h \ + libgearman-server/server.h libgearman-server/thread.h \ + libgearman-server/wakeup.h libgearman-server/worker.h \ + libgearman/add.hpp libgearman/aggregator.hpp \ + libgearman/allocator.hpp libgearman/assert.hpp \ + libgearman/common.h libgearman/connection.hpp \ + libgearman/do.hpp libgearman/error.hpp \ + libgearman/function/base.hpp \ + libgearman/function/function_v1.hpp \ + libgearman/function/function_v2.hpp \ + libgearman/function/make.hpp libgearman/function/null.hpp \ + libgearman/function/partition.hpp libgearman/is.hpp \ + libgearman/log.h libgearman/packet.hpp libgearman/result.hpp \ + libgearman/run.hpp libgearman/strcommand.h libgearman/unique.h \ + libgearman/universal.hpp libgearman/vector.hpp util/daemon.h \ + util/error.h util/instance.h util/operation.h util/pidfile.h \ + libtest/callbacks.h libtest/cmdline.h libtest/collection.h \ + libtest/common.h libtest/core.h libtest/error.h \ + libtest/framework.cc libtest/framework.h libtest/get.h \ + libtest/runner.h libtest/server.h libtest/stats.h \ + libtest/strerror.h libtest/test.h libtest/test.hpp \ + libtest/visibility.h libtest/wait.h libtest/worker.h \ + tests/basic.h tests/context.h tests/do.h tests/do_background.h \ + tests/execute.h tests/gearman_client_do_job_handle.h \ + tests/gearman_execute_partition.h tests/ports.h \ + tests/protocol.h tests/regression.h tests/server_options.h \ + tests/task.h tests/unique.h tests/workers.h tests/workers_v1.h +man1_MANS = docs/man/gearadmin.1 docs/man/gearman.1 +man3_MANS = docs/man/gearman_allocator_t.3 \ + docs/man/gearman_client_set_memory_allocators.3 \ + docs/man/gearman_worker_set_memory_allocators.3 \ + docs/man/gearman_actions_t.3 docs/man/gearman_argument_make.3 \ + docs/man/gearman_argument_t.3 docs/man/gearman_bugreport.3 \ + docs/man/gearman_client_add_options.3 \ + docs/man/gearman_client_add_server.3 \ + docs/man/gearman_client_add_servers.3 \ + docs/man/gearman_client_add_task.3 \ + docs/man/gearman_client_add_task_background.3 \ + docs/man/gearman_client_add_task_high.3 \ + docs/man/gearman_client_add_task_high_background.3 \ + docs/man/gearman_client_add_task_low.3 \ + docs/man/gearman_client_add_task_low_background.3 \ + docs/man/gearman_client_add_task_status.3 \ + docs/man/gearman_client_clear_fn.3 \ + docs/man/gearman_client_clone.3 \ + docs/man/gearman_client_context.3 \ + docs/man/gearman_client_create.3 docs/man/gearman_client_do.3 \ + docs/man/gearman_client_do_background.3 \ + docs/man/gearman_client_do_high.3 \ + docs/man/gearman_client_do_high_background.3 \ + docs/man/gearman_client_do_job_handle.3 \ + docs/man/gearman_client_do_low.3 \ + docs/man/gearman_client_do_low_background.3 \ + docs/man/gearman_client_do_status.3 \ + docs/man/gearman_client_echo.3 docs/man/gearman_client_errno.3 \ + docs/man/gearman_client_error.3 docs/man/gearman_client_free.3 \ + docs/man/gearman_client_job_status.3 \ + docs/man/gearman_client_options.3 \ + docs/man/gearman_client_remove_options.3 \ + docs/man/gearman_client_remove_servers.3 \ + docs/man/gearman_client_run_tasks.3 \ + docs/man/gearman_client_set_complete_fn.3 \ + docs/man/gearman_client_set_context.3 \ + docs/man/gearman_client_set_created_fn.3 \ + docs/man/gearman_client_set_data_fn.3 \ + docs/man/gearman_client_set_exception_fn.3 \ + docs/man/gearman_client_set_fail_fn.3 \ + docs/man/gearman_client_set_log_fn.3 \ + docs/man/gearman_client_set_namespace.3 \ + docs/man/gearman_client_set_options.3 \ + docs/man/gearman_client_set_status_fn.3 \ + docs/man/gearman_client_set_task_context_free_fn.3 \ + docs/man/gearman_client_set_timeout.3 \ + docs/man/gearman_client_set_warning_fn.3 \ + docs/man/gearman_client_set_workload_fn.3 \ + docs/man/gearman_client_set_workload_free_fn.3 \ + docs/man/gearman_client_set_workload_malloc_fn.3 \ + docs/man/gearman_client_st.3 \ + docs/man/gearman_client_task_free_all.3 \ + docs/man/gearman_client_timeout.3 \ + docs/man/gearman_client_wait.3 docs/man/gearman_continue.3 \ + docs/man/gearman_execute.3 docs/man/gearman_failed.3 \ + docs/man/gearman_job_free.3 docs/man/gearman_job_free_all.3 \ + docs/man/gearman_job_function_name.3 \ + docs/man/gearman_job_handle.3 docs/man/gearman_job_handle_t.3 \ + docs/man/gearman_job_send_complete.3 \ + docs/man/gearman_job_send_data.3 \ + docs/man/gearman_job_send_exception.3 \ + docs/man/gearman_job_send_fail.3 \ + docs/man/gearman_job_send_status.3 \ + docs/man/gearman_job_send_warning.3 docs/man/gearman_job_st.3 \ + docs/man/gearman_job_take_workload.3 \ + docs/man/gearman_job_unique.3 docs/man/gearman_job_workload.3 \ + docs/man/gearman_job_workload_size.3 docs/man/gearman_log_fn.3 \ + docs/man/gearman_parse_servers.3 \ + docs/man/gearman_result_boolean.3 \ + docs/man/gearman_result_integer.3 \ + docs/man/gearman_result_is_null.3 \ + docs/man/gearman_result_size.3 \ + docs/man/gearman_result_store_integer.3 \ + docs/man/gearman_result_store_string.3 \ + docs/man/gearman_result_store_value.3 \ + docs/man/gearman_result_string.3 docs/man/gearman_return_t.3 \ + docs/man/gearman_strerror.3 docs/man/gearman_string_t.3 \ + docs/man/gearman_success.3 docs/man/gearman_task_context.3 \ + docs/man/gearman_task_data.3 docs/man/gearman_task_data_size.3 \ + docs/man/gearman_task_denominator.3 \ + docs/man/gearman_task_error.3 docs/man/gearman_task_free.3 \ + docs/man/gearman_task_function_name.3 \ + docs/man/gearman_task_give_workload.3 \ + docs/man/gearman_task_is_known.3 \ + docs/man/gearman_task_is_running.3 \ + docs/man/gearman_task_job_handle.3 \ + docs/man/gearman_task_numerator.3 \ + docs/man/gearman_task_recv_data.3 \ + docs/man/gearman_task_return.3 \ + docs/man/gearman_task_send_workload.3 \ + docs/man/gearman_task_set_context.3 docs/man/gearman_task_st.3 \ + docs/man/gearman_task_take_data.3 \ + docs/man/gearman_task_unique.3 docs/man/gearman_verbose_name.3 \ + docs/man/gearman_verbose_t.3 docs/man/gearman_version.3 \ + docs/man/gearman_worker_add_function.3 \ + docs/man/gearman_worker_add_options.3 \ + docs/man/gearman_worker_add_server.3 \ + docs/man/gearman_worker_add_servers.3 \ + docs/man/gearman_worker_clone.3 \ + docs/man/gearman_worker_context.3 \ + docs/man/gearman_worker_create.3 \ + docs/man/gearman_worker_define_function.3 \ + docs/man/gearman_worker_echo.3 docs/man/gearman_worker_errno.3 \ + docs/man/gearman_worker_error.3 docs/man/gearman_worker_free.3 \ + docs/man/gearman_worker_function_exist.3 \ + docs/man/gearman_worker_grab_job.3 \ + docs/man/gearman_worker_options.3 \ + docs/man/gearman_worker_register.3 \ + docs/man/gearman_worker_remove_options.3 \ + docs/man/gearman_worker_remove_servers.3 \ + docs/man/gearman_worker_set_context.3 \ + docs/man/gearman_worker_set_log_fn.3 \ + docs/man/gearman_worker_set_namespace.3 \ + docs/man/gearman_worker_set_options.3 \ + docs/man/gearman_worker_set_timeout.3 \ + docs/man/gearman_worker_set_workload_free_fn.3 \ + docs/man/gearman_worker_set_workload_malloc_fn.3 \ + docs/man/gearman_worker_st.3 docs/man/gearman_worker_timeout.3 \ + docs/man/gearman_worker_unregister.3 \ + docs/man/gearman_worker_unregister_all.3 \ + docs/man/gearman_worker_wait.3 docs/man/gearman_worker_work.3 \ + docs/man/gearman_task_attr_init.3 \ + docs/man/gearman_task_attr_init_background.3 \ + docs/man/gearman_task_attr_init_epoch.3 \ + docs/man/gearman_task_attr_t.3 \ + docs/man/gearman_client_options_t.3 \ + docs/man/gearman_client_has_option.3 docs/man/libgearman.3 +man8_MANS = docs/man/gearmand.8 +DISTCLEANFILES = config/top.h +EXTRA_DIST = support/gearmand.init support/gearmand.pc \ + support/gearmand.spec HACKING ${man1_MANS} ${man3_MANS} \ + ${man8_MANS} scripts/README.solaris +CLEANFILES = tests/var/log/* tests/var/tmp/* $(am__append_24) \ + $(am__append_26) +GEARMAN_TMP = ${abs_top_builddir}/tests/var/tmp/ +benchmark_libbenchmark_la_SOURCES = benchmark/benchmark.cc +benchmark_blobslap_client_SOURCES = benchmark/blobslap_client.cc benchmark_blobslap_client_LDADD = benchmark/libbenchmark.la libgearman/libgearman.la -benchmark_blobslap_worker_SOURCES = benchmark/blobslap_worker.c -benchmark_blobslap_worker_LDADD = benchmark/libbenchmark.la libgearman/libgearman.la -bin_gearman_SOURCES = bin/gearman.c -bin_gearman_LDADD = libgearman/libgearman.la ${BETTER_MALLOC_LIBS} -EXAMPLES_LDADD = $(LTLIBUUID) $(LTLIBEVENT) libgearman/libgearman.la -examples_echo_client_SOURCES = examples/echo_client.c -examples_echo_client_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -examples_echo_worker_SOURCES = examples/echo_worker.c -examples_echo_worker_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -examples_reverse_client_SOURCES = examples/reverse_client.c -examples_reverse_client_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -examples_reverse_client_bg_SOURCES = examples/reverse_client_bg.c -examples_reverse_client_bg_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -examples_reverse_client_cb_SOURCES = examples/reverse_client_cb.c -examples_reverse_client_cb_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -examples_reverse_worker_SOURCES = examples/reverse_worker.c -examples_reverse_worker_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -examples_wc_worker_SOURCES = examples/wc_worker.c -examples_wc_worker_LDADD = $(AM_LDADD) $(EXAMPLES_LDADD) -gearmand_gearmand_LDADD = \ - libgearman-server/libgearman-server.la \ - ${BETTER_MALLOC_LIBS} +benchmark_blobslap_worker_SOURCES = \ + benchmark/blobslap_worker.cc \ + util/daemon.cc + +benchmark_blobslap_worker_LDADD = \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + benchmark/libbenchmark.la \ + libgearman/libgearman.la + +GEARMAND_BE_PIDFILE = ${abs_top_builddir}/tests/var/tmp/Begearmand.pid +GEARMAND_BENCHMARK_PORT = 6000 +BENCHMARK_COUNT = 100 +BENCHMARK_TASK_COUNT = 10 +BENCHMARK_TASK_COUNT_TOTAL = 1000 +bin_gearadmin_SOURCES = \ + bin/gearadmin.cc \ + util/instance.cc + +bin_gearadmin_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(BOOST_CPPFLAGS) + +bin_gearadmin_LDFLAGS = \ + $(AM_LDFLAGS) \ + $(BOOST_PROGRAM_OPTIONS_LDFLAGS) + +bin_gearadmin_LDADD = \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + ${BETTER_MALLOC_LIBS} + +bin_gearman_SOURCES = \ + bin/arguments.cc \ + bin/function.cc \ + bin/gearman.cc \ + util/error.cc \ + util/pidfile.cc -gearmand_gearmand_SOURCES = gearmand/gearmand.c -libgearman_libgearmancore_la_SOURCES = \ - libgearman/byteorder.c \ - libgearman/connection.c \ - libgearman/log.c \ - libgearman/packet.c \ - libgearman/universal.c +bin_gearman_LDADD = \ + libgearman/libgearman.la -libgearman_libgearmancore_la_CFLAGS = \ - ${AM_CFLAGS} +GEARMAN_CLIENT_TEST = bin/gearman +GEARMAN_VALGRIND_CLIENT_TEST = $(VALGRIND_COMMAND) bin/gearman +GEARMAN_PIDFILE = ${abs_top_builddir}/tests/var/tmp/Xugear.pid +GEARMAND_PIDFILE = ${abs_top_builddir}/tests/var/tmp/Xugearmand.pid +GEARMAND_PORT = 5999 +EXAMPLES_LDADD = \ + $(BOOST_PROGRAM_OPTIONS_LIBS) \ + libgearman/libgearman.la + +EXAMPLES_LD_FLAGS = \ + $(AM_LDFLAGS) \ + $(CLIENT_LDFLAGS) \ + $(LTLIBEVENT) \ + $(LTLIBUUID) + +EXAMPLES_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(BOOST_CPPFLAGS) + +examples_echo_client_SOURCES = examples/echo_client.cc +examples_echo_client_LDADD = $(EXAMPLES_LDADD) +examples_echo_client_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_echo_client_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_echo_worker_SOURCES = examples/echo_worker.cc +examples_echo_worker_LDADD = $(EXAMPLES_LDADD) +examples_echo_worker_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_echo_worker_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_reverse_client_SOURCES = examples/reverse_client.cc +examples_reverse_client_LDADD = $(EXAMPLES_LDADD) +examples_reverse_client_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_reverse_client_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_reverse_client_bg_SOURCES = examples/reverse_client_bg.cc +examples_reverse_client_bg_LDADD = $(EXAMPLES_LDADD) +examples_reverse_client_bg_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_reverse_client_bg_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_reverse_client_epoch_SOURCES = examples/reverse_client_epoch.cc +examples_reverse_client_epoch_LDADD = $(EXAMPLES_LDADD) +examples_reverse_client_epoch_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_reverse_client_epoch_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_reverse_client_cb_SOURCES = examples/reverse_client_cb.cc +examples_reverse_client_cb_LDADD = $(EXAMPLES_LDADD) +examples_reverse_client_cb_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_reverse_client_cb_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_reverse_worker_SOURCES = examples/reverse_worker.cc +examples_reverse_worker_LDADD = $(EXAMPLES_LDADD) +examples_reverse_worker_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_reverse_worker_LDFLAGS = $(EXAMPLES_LD_FLAGS) +examples_wc_worker_SOURCES = examples/wc_worker.cc +examples_wc_worker_LDADD = $(EXAMPLES_LDADD) +examples_wc_worker_CPPFLAGS = $(EXAMPLES_CPPFLAGS) +examples_wc_worker_LDFLAGS = $(EXAMPLES_LD_FLAGS) +gearmand_gearmand_LDADD = $(AM_LDADD) $(BOOST_PROGRAM_OPTIONS_LIBS) \ + ${BETTER_MALLOC_LIBS} libgearman-server/libgearman-server.la \ + $(am__append_5) $(am__append_11) +gearmand_gearmand_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LDFLAGS) +gearmand_gearmand_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \ + $(am__append_6) $(am__append_12) +gearmand_gearmand_SOURCES = \ + gearmand/gearmand.cc \ + util/daemon.cc \ + util/pidfile.cc + +libgearman_server_libgearman_server_la_SOURCES = \ + libgearman-server/error/strerror.cc \ + libgearman-server/plugins/protocol/http/protocol.cc \ + $(am__append_2) $(am__append_8) $(am__append_14) \ + $(am__append_17) $(am__append_20) \ + libgearman-server/byteorder.cc libgearman-server/client.cc \ + libgearman-server/connection.c \ + libgearman-server/connection_list.cc libgearman-server/fifo.c \ + libgearman-server/function.cc libgearman-server/gearmand.cc \ + libgearman-server/gearmand_con.c \ + libgearman-server/gearmand_thread.cc libgearman-server/hash.c \ + libgearman-server/io.cc libgearman-server/job.c \ + libgearman-server/list.c libgearman-server/log.cc \ + libgearman-server/packet.cc libgearman-server/plugins.cc \ + libgearman-server/queue.cc libgearman-server/server.c \ + libgearman-server/thread.c libgearman-server/wakeup.cc \ + libgearman-server/worker.cc libgearman/command.cc +libgearman_server_libgearman_server_la_LIBADD = $(am__append_3) \ + $(am__append_10) $(am__append_15) $(am__append_18) \ + $(am__append_21) $(LTLIBEVENT) +libgearman_server_libgearman_server_la_CXXFLAGS = $(am__append_4) \ + $(am__append_9) ${AM_CXXFLAGS} -DBUILDING_LIBGEARMAN +libgearman_server_libgearman_server_la_CFLAGS = ${AM_CFLAGS} \ + -DBUILDING_LIBGEARMAN +libgearman_libgearmancore_la_SOURCES = \ + libgearman/allocator.cc \ + libgearman/byteorder.cc \ + libgearman/command.cc \ + libgearman/connection.cc \ + libgearman/error.cc \ + libgearman/log.cc \ + libgearman/packet.cc \ + libgearman/strcommand.cc \ + libgearman/strerror.cc \ + libgearman/universal.cc \ + libgearman/vector.cc + +libgearman_libgearmancore_la_CXXFLAGS = \ + ${AM_CXXFLAGS} \ + -DBUILDING_LIBGEARMAN libgearman_libgearman_la_SOURCES = \ - libgearman/client.c \ - libgearman/gearman.c \ - libgearman/job.c \ - libgearman/strerror.c \ - libgearman/task.c \ - libgearman/worker.c - -libgearman_libgearman_la_DEPENDENCIES = libgearman/libgearmancore.la -libgearman_libgearman_la_CFLAGS = \ - ${AM_CFLAGS} + libgearman/actions.cc \ + libgearman/aggregator.cc \ + libgearman/allocator.cc \ + libgearman/argument.cc \ + libgearman/add.cc \ + libgearman/byteorder.cc \ + libgearman/client.cc \ + libgearman/command.cc \ + libgearman/connection.cc \ + libgearman/do.cc \ + libgearman/error.cc \ + libgearman/execute.cc \ + libgearman/function.cc \ + libgearman/function/function_v2.cc \ + libgearman/function/make.cc \ + libgearman/function/partition.cc \ + libgearman/gearman.cc \ + libgearman/job.cc \ + libgearman/log.cc \ + libgearman/packet.cc \ + libgearman/parse.cc \ + libgearman/result.cc \ + libgearman/run.cc \ + libgearman/strcommand.cc \ + libgearman/strerror.cc \ + libgearman/string.cc \ + libgearman/task.cc \ + libgearman/task_attr.cc \ + libgearman/unique.cc \ + libgearman/universal.cc \ + libgearman/vector.cc \ + libgearman/worker.cc + +libgearman_libgearman_la_DEPENDENCIES = +libgearman_libgearman_la_CXXFLAGS = \ + ${AM_CXXFLAGS} \ + -DBUILDING_LIBGEARMAN libgearman_libgearman_la_LDFLAGS = \ $(AM_LDFLAGS) \ -version-info $(GEARMAN_LIBRARY_VERSION) libgearman_libgearman_la_LIBADD = \ - libgearman/libgearmancore.la \ - $(LTLIBUUID) + $(LTLIBUUID) -@HAVE_LIBDRIZZLE_TRUE@QUEUE_LIBDRIZZLE_H = libgearman-server/queue_libdrizzle.h -@HAVE_LIBDRIZZLE_TRUE@QUEUE_LIBDRIZZLE_C = libgearman-server/queue_libdrizzle.c -@HAVE_LIBMEMCACHED_TRUE@QUEUE_LIBMEMCACHED_H = libgearman-server/queue_libmemcached.h -@HAVE_LIBMEMCACHED_TRUE@QUEUE_LIBMEMCACHED_C = libgearman-server/queue_libmemcached.c -@HAVE_LIBSQLITE3_TRUE@QUEUE_LIBSQLITE3_H = libgearman-server/queue_libsqlite3.h -@HAVE_LIBSQLITE3_TRUE@QUEUE_LIBSQLITE3_C = libgearman-server/queue_libsqlite3.c -@HAVE_LIBPQ_TRUE@QUEUE_LIBPQ_H = libgearman-server/queue_libpq.h -@HAVE_LIBPQ_TRUE@QUEUE_LIBPQ_C = libgearman-server/queue_libpq.c -@HAVE_LIBTOKYOCABINET_TRUE@QUEUE_LIBTOKYOCABINET_H = libgearman-server/queue_libtokyocabinet.h -@HAVE_LIBTOKYOCABINET_TRUE@QUEUE_LIBTOKYOCABINET_C = libgearman-server/queue_libtokyocabinet.c -libgearman_server_libgearman_server_la_SOURCES = \ - $(QUEUE_LIBDRIZZLE_C) \ - $(QUEUE_LIBMEMCACHED_C) \ - $(QUEUE_LIBPQ_C) \ - $(QUEUE_LIBSQLITE3_C) \ - $(QUEUE_LIBTOKYOCABINET_C) \ - libgearman-server/client.c \ - libgearman-server/conf.c \ - libgearman-server/conf_module.c \ - libgearman-server/connection.c \ - libgearman-server/function.c \ - libgearman-server/gearmand.c \ - libgearman-server/gearmand_con.c \ - libgearman-server/gearmand_thread.c \ - libgearman-server/job.c \ - libgearman-server/log.c \ - libgearman-server/packet.c \ - libgearman-server/protocol_http.c \ - libgearman-server/server.c \ - libgearman-server/thread.c \ - libgearman-server/worker.c - -libgearman_server_libgearman_server_la_CFLAGS = \ - ${AM_CFLAGS} \ - -DBUILDING_LIBGEARMAN - -libgearman_server_libgearman_server_la_LIBADD = \ - $(LTLIBDRIZZLE) \ - $(LTLIBEVENT) \ - $(LTLIBMEMCACHED) \ - $(LTLIBPQ) \ - $(LTLIBSQLITE3) \ - $(LTLIBTOKYOCABINET) \ - libgearman/libgearman.la \ - libgearman/libgearmancore.la - -tests_libtest_la_SOURCES = tests/test.c tests/test_gearmand.c -VALGRIND_COMMAND = $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes -TEST_LDADD = \ - tests/libtest.la \ - libgearman/libgearman.la \ - libgearman-server/libgearman-server.la +libtest_libserver_la_SOURCES = \ + libtest/gearmand.cc \ + libtest/worker.cc + +libtest_libtest_la_SOURCES = \ + libtest/cmdline.cc \ + libtest/framework.cc \ + libtest/test.cc + +libtest_unittest_LDADD = \ + libtest/libtest.la + +libtest_unittest_SOURCES = \ + libtest/unittest.cc + +libtest_wait_SOURCES = libtest/wait.cc +VALGRIND_COMMAND = $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --malloc-fill=A5 --free-fill=DE --track-fds=yes +CLIENT_LDADD = \ + libtest/libtest.la \ + libtest/libserver.la \ + libgearman/libgearman.la + +tests_client_test_SOURCES = \ + tests/client_test.cc \ + tests/do.cc \ + tests/do_background.cc \ + tests/execute.cc \ + tests/gearman_client_do_job_handle.cc \ + tests/gearman_execute_partition.cc \ + tests/protocol.cc \ + tests/server_options.cc \ + tests/task.cc \ + tests/unique.cc \ + tests/workers.cc \ + tests/workers_v1.cc + +tests_client_test_LDADD = ${CLIENT_LDADD} +tests_client_test_DEPENDENCIES = ${CLIENT_LDADD} +tests_burnin_test_SOURCES = tests/burnin.cc +tests_burnin_test_LDADD = ${CLIENT_LDADD} +tests_internals_test_SOURCES = \ + tests/internals.cc \ + tests/regression.cc + +tests_internals_test_LDADD = ${CLIENT_LDADD} libgearman/libgearmancore.la +tests_internals_test_DEPENDENCIES = ${CLIENT_LDADD} libgearman/libgearmancore.la +tests_round_robin_test_SOURCES = tests/round_robin.cc +tests_round_robin_test_LDADD = ${CLIENT_LDADD} libgearman/libgearmancore.la +tests_worker_test_SOURCES = tests/worker_test.cc +tests_worker_test_LDADD = \ + ${CLIENT_LDADD} \ + libgearman/libgearmancore.la + +# Test linking with C++ application +tests_cpp_test_SOURCES = tests/cpp_test.cc +tests_cpp_test_LDADD = ${CLIENT_LDADD} + +# Test linking with C application +tests_c_test_SOURCES = tests/c_test.c +tests_c_test_LDADD = ${CLIENT_LDADD} +@HAVE_LIBDRIZZLE_TRUE@DRIZZLE_TEST = tests/drizzle_test +tests_drizzle_test_SOURCES = \ + tests/basic.cc \ + tests/drizzle_test.cc + +tests_drizzle_test_LDADD = ${CLIENT_LDADD} +tests_memcached_test_SOURCES = \ + tests/basic.cc \ + tests/memcached_test.cc + +tests_memcached_test_LDADD = ${CLIENT_LDADD} @HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@LIBMEMCACHED_PIDFILE = ${abs_top_builddir}/tests/Xumemc.pid @HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@LIBMEMCACHED_TEST = tests/memcached_test # Note, SETUP should do a test for existance and then kill if it exists. -@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@LIBMEMCACHED_SETUP = @$(MEMCACHED_BINARY) -d -P ${LIBMEMCACHED_PIDFILE} -p 12555 +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@LIBMEMCACHED_SETUP = @$(MEMCACHED_BINARY) -d -u root -P ${LIBMEMCACHED_PIDFILE} -p 12555 @HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@LIBMEMCACHED_TEARDOWN = @\ @HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ cat ${LIBMEMCACHED_PIDFILE} | xargs kill; \ @HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ rm ${LIBMEMCACHED_PIDFILE} -tests_memcached_test_SOURCES = tests/memcached_test.c -tests_memcached_test_LDADD = ${TEST_LDADD} @HAVE_LIBSQLITE3_TRUE@SQLITE_TEST = tests/sqlite_test -@HAVE_LIBSQLITE3_TRUE@SQLITE_RM = @rm -f tests/gearman.sql tests/gearman.sql-journal -tests_sqlite_test_SOURCES = tests/sqlite_test.c -tests_sqlite_test_LDADD = ${TEST_LDADD} +tests_sqlite_test_SOURCES = \ + tests/basic.cc \ + tests/sqlite_test.cc + +tests_sqlite_test_LDADD = ${CLIENT_LDADD} @HAVE_LIBTOKYOCABINET_TRUE@TOKYOCABINET_TEST = tests/tokyocabinet_test @HAVE_LIBTOKYOCABINET_TRUE@TOKYOCABINET_RM = @rm -f tests/gearman.tcb -tests_tokyocabinet_test_SOURCES = tests/tokyocabinet_test.c -tests_tokyocabinet_test_LDADD = ${TEST_LDADD} -tests_client_test_SOURCES = tests/test_worker.c tests/client_test.c -tests_client_test_LDADD = ${TEST_LDADD} -tests_internals_test_SOURCES = tests/internals.c -tests_internals_test_LDADD = ${TEST_LDADD} libgearman/libgearmancore.la -tests_regression_test_SOURCES = tests/regression.c -tests_regression_test_LDADD = ${TEST_LDADD} libgearman/libgearmancore.la -tests_round_robin_test_SOURCES = tests/round_robin.c -tests_round_robin_test_LDADD = ${TEST_LDADD} libgearman/libgearmancore.la -tests_worker_test_SOURCES = tests/worker_test.c -tests_worker_test_LDADD = ${TEST_LDADD} - -# Test linking with C++ application -tests_cpp_test_SOURCES = tests/cpp_test.cc -tests_cpp_test_LDADD = ${TEST_LDADD} -GEARMAN_CLIENT_TEST = bin/gearman -GEARMAN_PIDFILE = ${abs_top_builddir}/tests/Xugear.pid -unittests_unittests_SOURCES = \ - unittests/main.cc - -unittests_unittests_CXXFLAGS = ${AM_CXXFLAGS} ${NO_WERROR} -unittests_unittests_LDADD = \ - libgearman/libgearman.la \ - libgearman-server/libgearman-server.la \ - ${LTLIBGTEST} - +tests_tokyocabinet_test_SOURCES = tests/tokyocabinet_test.cc tests/basic.cc +tests_tokyocabinet_test_LDADD = ${CLIENT_LDADD} pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = support/gearmand.pc -dist_man_MANS = docs/man/man1/gearman.1 docs/man/man8/gearmand.8 \ - docs/man/man3/gearman_client_create.3 \ - docs/man/man3/gearman_client_clone.3 \ - docs/man/man3/gearman_client_free.3 \ - docs/man/man3/gearman_client_error.3 \ - docs/man/man3/gearman_client_errno.3 \ - docs/man/man3/gearman_client_options.3 \ - docs/man/man3/gearman_client_set_options.3 \ - docs/man/man3/gearman_client_add_options.3 \ - docs/man/man3/gearman_client_remove_options.3 \ - docs/man/man3/gearman_client_timeout.3 \ - docs/man/man3/gearman_client_set_timeout.3 \ - docs/man/man3/gearman_client_context.3 \ - docs/man/man3/gearman_client_set_context.3 \ - docs/man/man3/gearman_client_set_log_fn.3 \ - docs/man/man3/gearman_client_set_workload_malloc_fn.3 \ - docs/man/man3/gearman_client_set_workload_free_fn.3 \ - docs/man/man3/gearman_client_add_server.3 \ - docs/man/man3/gearman_client_add_servers.3 \ - docs/man/man3/gearman_client_remove_servers.3 \ - docs/man/man3/gearman_client_wait.3 \ - docs/man/man3/gearman_client_do.3 \ - docs/man/man3/gearman_client_do_high.3 \ - docs/man/man3/gearman_client_do_low.3 \ - docs/man/man3/gearman_client_do_job_handle.3 \ - docs/man/man3/gearman_client_do_status.3 \ - docs/man/man3/gearman_client_do_background.3 \ - docs/man/man3/gearman_client_do_high_background.3 \ - docs/man/man3/gearman_client_do_low_background.3 \ - docs/man/man3/gearman_client_job_status.3 \ - docs/man/man3/gearman_client_echo.3 \ - docs/man/man3/gearman_client_task_free_all.3 \ - docs/man/man3/gearman_client_set_task_context_free_fn.3 \ - docs/man/man3/gearman_client_add_task.3 \ - docs/man/man3/gearman_client_add_task_high.3 \ - docs/man/man3/gearman_client_add_task_low.3 \ - docs/man/man3/gearman_client_add_task_background.3 \ - docs/man/man3/gearman_client_add_task_high_background.3 \ - docs/man/man3/gearman_client_add_task_low_background.3 \ - docs/man/man3/gearman_client_add_task_status.3 \ - docs/man/man3/gearman_client_set_workload_fn.3 \ - docs/man/man3/gearman_client_set_created_fn.3 \ - docs/man/man3/gearman_client_set_data_fn.3 \ - docs/man/man3/gearman_client_set_warning_fn.3 \ - docs/man/man3/gearman_client_set_status_fn.3 \ - docs/man/man3/gearman_client_set_complete_fn.3 \ - docs/man/man3/gearman_client_set_exception_fn.3 \ - docs/man/man3/gearman_client_set_fail_fn.3 \ - docs/man/man3/gearman_client_clear_fn.3 \ - docs/man/man3/gearman_client_run_tasks.3 \ - docs/man/man3/gearman_version.3 \ - docs/man/man3/gearman_bugreport.3 \ - docs/man/man3/gearman_verbose_name.3 \ - docs/man/man3/gearman_parse_servers.3 \ - docs/man/man3/gearman_job_free.3 \ - docs/man/man3/gearman_job_send_data.3 \ - docs/man/man3/gearman_job_send_warning.3 \ - docs/man/man3/gearman_job_send_status.3 \ - docs/man/man3/gearman_job_send_complete.3 \ - docs/man/man3/gearman_job_send_exception.3 \ - docs/man/man3/gearman_job_send_fail.3 \ - docs/man/man3/gearman_job_handle.3 \ - docs/man/man3/gearman_job_function_name.3 \ - docs/man/man3/gearman_job_unique.3 \ - docs/man/man3/gearman_job_workload.3 \ - docs/man/man3/gearman_job_workload_size.3 \ - docs/man/man3/gearman_job_take_workload.3 \ - docs/man/man3/gearman_task_free.3 \ - docs/man/man3/gearman_task_context.3 \ - docs/man/man3/gearman_task_set_context.3 \ - docs/man/man3/gearman_task_function_name.3 \ - docs/man/man3/gearman_task_unique.3 \ - docs/man/man3/gearman_task_job_handle.3 \ - docs/man/man3/gearman_task_is_known.3 \ - docs/man/man3/gearman_task_is_running.3 \ - docs/man/man3/gearman_task_numerator.3 \ - docs/man/man3/gearman_task_denominator.3 \ - docs/man/man3/gearman_task_give_workload.3 \ - docs/man/man3/gearman_task_send_workload.3 \ - docs/man/man3/gearman_task_data.3 \ - docs/man/man3/gearman_task_data_size.3 \ - docs/man/man3/gearman_task_take_data.3 \ - docs/man/man3/gearman_task_recv_data.3 \ - docs/man/man3/gearman_worker_create.3 \ - docs/man/man3/gearman_worker_clone.3 \ - docs/man/man3/gearman_worker_free.3 \ - docs/man/man3/gearman_worker_error.3 \ - docs/man/man3/gearman_worker_errno.3 \ - docs/man/man3/gearman_worker_options.3 \ - docs/man/man3/gearman_worker_set_options.3 \ - docs/man/man3/gearman_worker_add_options.3 \ - docs/man/man3/gearman_worker_remove_options.3 \ - docs/man/man3/gearman_worker_timeout.3 \ - docs/man/man3/gearman_worker_set_timeout.3 \ - docs/man/man3/gearman_worker_context.3 \ - docs/man/man3/gearman_worker_set_context.3 \ - docs/man/man3/gearman_worker_set_log_fn.3 \ - docs/man/man3/gearman_worker_set_workload_malloc_fn.3 \ - docs/man/man3/gearman_worker_set_workload_free_fn.3 \ - docs/man/man3/gearman_worker_add_server.3 \ - docs/man/man3/gearman_worker_add_servers.3 \ - docs/man/man3/gearman_worker_remove_servers.3 \ - docs/man/man3/gearman_worker_wait.3 \ - docs/man/man3/gearman_worker_register.3 \ - docs/man/man3/gearman_worker_unregister.3 \ - docs/man/man3/gearman_worker_unregister_all.3 \ - docs/man/man3/gearman_worker_grab_job.3 \ - docs/man/man3/gearman_job_free_all.3 \ - docs/man/man3/gearman_worker_function_exist.3 \ - docs/man/man3/gearman_worker_add_function.3 \ - docs/man/man3/gearman_worker_work.3 \ - docs/man/man3/gearman_worker_echo.3 - +SPHINXOPTS = ${SPHINX_WARNINGS} +PAPER = +SPHINX_BUILDDIR = ${top_builddir}/docs + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(SPHINX_BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ${top_srcdir}/docs +docs_libgearman_examples_gearman_execute_example_SOURCES = docs/libgearman/examples/gearman_execute_example.c +docs_libgearman_examples_gearman_execute_example_LDADD = libgearman/libgearman.la +docs_libgearman_examples_gearman_execute_partition_SOURCES = docs/libgearman/examples/gearman_execute_partition.c +docs_libgearman_examples_gearman_execute_partition_LDADD = libgearman/libgearman.la +docs_libgearman_examples_gearman_client_do_example_SOURCES = docs/libgearman/examples/gearman_client_do_example.c +docs_libgearman_examples_gearman_client_do_example_LDADD = libgearman/libgearman.la +docs_libgearman_examples_gearman_client_do_background_example_SOURCES = docs/libgearman/examples/gearman_client_do_background_example.c +docs_libgearman_examples_gearman_client_do_background_example_LDADD = libgearman/libgearman.la all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -1071,7 +1706,7 @@ .SUFFIXES: .c .cc .lo .o .obj am--refresh: @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/benchmark/include.am $(srcdir)/bin/include.am $(srcdir)/examples/include.am $(srcdir)/gearmand/include.am $(srcdir)/libgearman/include.am $(srcdir)/libgearman-server/include.am $(srcdir)/tests/include.am $(srcdir)/unittests/include.am $(srcdir)/support/include.am $(srcdir)/docs/man_list $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/benchmark/include.am $(srcdir)/bin/include.am $(srcdir)/examples/include.am $(srcdir)/gearmand/include.am $(srcdir)/libgearman-server/include.am $(srcdir)/libgearman-server/error/include.am $(srcdir)/libgearman-server/plugins/include.am $(srcdir)/libgearman-server/plugins/protocol/include.am $(srcdir)/libgearman-server/plugins/protocol/http/include.am $(srcdir)/libgearman-server/plugins/queue/include.am $(srcdir)/libgearman-server/plugins/queue/drizzle/include.am $(srcdir)/libgearman-server/plugins/queue/libmemcached/include.am $(srcdir)/libgearman-server/plugins/queue/postgres/include.am $(srcdir)/libgearman-server/plugins/queue/sqlite/include.am $(srcdir)/libgearman-server/plugins/queue/tokyocabinet/include.am $(srcdir)/libgearman/include.am $(srcdir)/util/include.am $(srcdir)/libtest/include.am $(srcdir)/tests/include.am $(srcdir)/tests/httpd.am $(srcdir)/tests/libdrizzle.am $(srcdir)/tests/libmemcached.am $(srcdir)/tests/postgres.am $(srcdir)/tests/sqlite.am $(srcdir)/tests/tokyocabinet.am $(srcdir)/support/include.am $(srcdir)/docs/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -1120,7 +1755,9 @@ distclean-hdr: -rm -f config.h stamp-h1 -libgearman/configure.h: $(top_builddir)/config.status $(top_srcdir)/libgearman/configure.h.in +docs/conf.py: $(top_builddir)/config.status $(top_srcdir)/docs/conf.py.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libgearman/version.h: $(top_builddir)/config.status $(top_srcdir)/libgearman/version.h.in cd $(top_builddir) && $(SHELL) ./config.status $@ scripts/gearmand: $(top_builddir)/config.status $(top_srcdir)/scripts/gearmand.in cd $(top_builddir) && $(SHELL) ./config.status $@ @@ -1183,38 +1820,89 @@ benchmark/benchmark.lo: benchmark/$(am__dirstamp) \ benchmark/$(DEPDIR)/$(am__dirstamp) benchmark/libbenchmark.la: $(benchmark_libbenchmark_la_OBJECTS) $(benchmark_libbenchmark_la_DEPENDENCIES) benchmark/$(am__dirstamp) - $(AM_V_CCLD)$(LINK) $(benchmark_libbenchmark_la_OBJECTS) $(benchmark_libbenchmark_la_LIBADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(benchmark_libbenchmark_la_OBJECTS) $(benchmark_libbenchmark_la_LIBADD) $(LIBS) +libgearman-server/error/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/error + @: > libgearman-server/error/$(am__dirstamp) +libgearman-server/error/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/error/$(DEPDIR) + @: > libgearman-server/error/$(DEPDIR)/$(am__dirstamp) +libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo: \ + libgearman-server/error/$(am__dirstamp) \ + libgearman-server/error/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/protocol/http/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/protocol/http + @: > libgearman-server/plugins/protocol/http/$(am__dirstamp) +libgearman-server/plugins/protocol/http/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/protocol/http/$(DEPDIR) + @: > libgearman-server/plugins/protocol/http/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo: \ + libgearman-server/plugins/protocol/http/$(am__dirstamp) \ + libgearman-server/plugins/protocol/http/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/drizzle/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/drizzle + @: > libgearman-server/plugins/queue/drizzle/$(am__dirstamp) +libgearman-server/plugins/queue/drizzle/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/drizzle/$(DEPDIR) + @: > libgearman-server/plugins/queue/drizzle/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo: \ + libgearman-server/plugins/queue/drizzle/$(am__dirstamp) \ + libgearman-server/plugins/queue/drizzle/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/libmemcached/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/libmemcached + @: > libgearman-server/plugins/queue/libmemcached/$(am__dirstamp) +libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/libmemcached/$(DEPDIR) + @: > libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo: \ + libgearman-server/plugins/queue/libmemcached/$(am__dirstamp) \ + libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/postgres/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/postgres + @: > libgearman-server/plugins/queue/postgres/$(am__dirstamp) +libgearman-server/plugins/queue/postgres/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/postgres/$(DEPDIR) + @: > libgearman-server/plugins/queue/postgres/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo: \ + libgearman-server/plugins/queue/postgres/$(am__dirstamp) \ + libgearman-server/plugins/queue/postgres/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/sqlite/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/sqlite + @: > libgearman-server/plugins/queue/sqlite/$(am__dirstamp) +libgearman-server/plugins/queue/sqlite/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/sqlite/$(DEPDIR) + @: > libgearman-server/plugins/queue/sqlite/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo: \ + libgearman-server/plugins/queue/sqlite/$(am__dirstamp) \ + libgearman-server/plugins/queue/sqlite/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/tokyocabinet/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/tokyocabinet + @: > libgearman-server/plugins/queue/tokyocabinet/$(am__dirstamp) +libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR) + @: > libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/$(am__dirstamp) +libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo: \ + libgearman-server/plugins/queue/tokyocabinet/$(am__dirstamp) \ + libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/$(am__dirstamp) libgearman-server/$(am__dirstamp): @$(MKDIR_P) libgearman-server @: > libgearman-server/$(am__dirstamp) libgearman-server/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) libgearman-server/$(DEPDIR) @: > libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo: \ - libgearman-server/$(am__dirstamp) \ - libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo: \ - libgearman-server/$(am__dirstamp) \ - libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo: \ - libgearman-server/$(am__dirstamp) \ - libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo: \ - libgearman-server/$(am__dirstamp) \ - libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo: \ +libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-client.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-conf.lo: \ +libgearman-server/libgearman_server_libgearman_server_la-connection.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo: \ +libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-connection.lo: \ +libgearman-server/libgearman_server_libgearman_server_la-fifo.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-function.lo: \ @@ -1229,16 +1917,28 @@ libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) +libgearman-server/libgearman_server_libgearman_server_la-hash.lo: \ + libgearman-server/$(am__dirstamp) \ + libgearman-server/$(DEPDIR)/$(am__dirstamp) +libgearman-server/libgearman_server_libgearman_server_la-io.lo: \ + libgearman-server/$(am__dirstamp) \ + libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-job.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) +libgearman-server/libgearman_server_libgearman_server_la-list.lo: \ + libgearman-server/$(am__dirstamp) \ + libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-log.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-packet.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo: \ +libgearman-server/libgearman_server_libgearman_server_la-plugins.lo: \ + libgearman-server/$(am__dirstamp) \ + libgearman-server/$(DEPDIR)/$(am__dirstamp) +libgearman-server/libgearman_server_libgearman_server_la-queue.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-server.lo: \ @@ -1247,65 +1947,181 @@ libgearman-server/libgearman_server_libgearman_server_la-thread.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) +libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo: \ + libgearman-server/$(am__dirstamp) \ + libgearman-server/$(DEPDIR)/$(am__dirstamp) libgearman-server/libgearman_server_libgearman_server_la-worker.lo: \ libgearman-server/$(am__dirstamp) \ libgearman-server/$(DEPDIR)/$(am__dirstamp) -libgearman-server/libgearman-server.la: $(libgearman_server_libgearman_server_la_OBJECTS) $(libgearman_server_libgearman_server_la_DEPENDENCIES) libgearman-server/$(am__dirstamp) - $(AM_V_CCLD)$(libgearman_server_libgearman_server_la_LINK) $(libgearman_server_libgearman_server_la_OBJECTS) $(libgearman_server_libgearman_server_la_LIBADD) $(LIBS) libgearman/$(am__dirstamp): @$(MKDIR_P) libgearman @: > libgearman/$(am__dirstamp) libgearman/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) libgearman/$(DEPDIR) @: > libgearman/$(DEPDIR)/$(am__dirstamp) -libgearman/libgearman_libgearman_la-client.lo: \ +libgearman/libgearman_server_libgearman_server_la-command.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) -libgearman/libgearman_libgearman_la-gearman.lo: \ +libgearman-server/libgearman-server.la: $(libgearman_server_libgearman_server_la_OBJECTS) $(libgearman_server_libgearman_server_la_DEPENDENCIES) libgearman-server/$(am__dirstamp) + $(AM_V_CXXLD)$(libgearman_server_libgearman_server_la_LINK) $(libgearman_server_libgearman_server_la_OBJECTS) $(libgearman_server_libgearman_server_la_LIBADD) $(LIBS) +libgearman/libgearman_libgearman_la-actions.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) -libgearman/libgearman_libgearman_la-job.lo: \ +libgearman/libgearman_libgearman_la-aggregator.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) -libgearman/libgearman_libgearman_la-strerror.lo: \ +libgearman/libgearman_libgearman_la-allocator.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) -libgearman/libgearman_libgearman_la-task.lo: \ +libgearman/libgearman_libgearman_la-argument.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-add.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-byteorder.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-client.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-command.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-connection.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-do.lo: libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-error.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-execute.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-function.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/function/$(am__dirstamp): + @$(MKDIR_P) libgearman/function + @: > libgearman/function/$(am__dirstamp) +libgearman/function/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libgearman/function/$(DEPDIR) + @: > libgearman/function/$(DEPDIR)/$(am__dirstamp) +libgearman/function/libgearman_libgearman_la-function_v2.lo: \ + libgearman/function/$(am__dirstamp) \ + libgearman/function/$(DEPDIR)/$(am__dirstamp) +libgearman/function/libgearman_libgearman_la-make.lo: \ + libgearman/function/$(am__dirstamp) \ + libgearman/function/$(DEPDIR)/$(am__dirstamp) +libgearman/function/libgearman_libgearman_la-partition.lo: \ + libgearman/function/$(am__dirstamp) \ + libgearman/function/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-gearman.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-job.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-log.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-packet.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-parse.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-result.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-run.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-strcommand.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-strerror.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-string.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-task.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-task_attr.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-unique.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-universal.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearman_la-vector.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman_libgearman_la-worker.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman.la: $(libgearman_libgearman_la_OBJECTS) $(libgearman_libgearman_la_DEPENDENCIES) libgearman/$(am__dirstamp) - $(AM_V_CCLD)$(libgearman_libgearman_la_LINK) -rpath $(libdir) $(libgearman_libgearman_la_OBJECTS) $(libgearman_libgearman_la_LIBADD) $(LIBS) + $(AM_V_CXXLD)$(libgearman_libgearman_la_LINK) -rpath $(libdir) $(libgearman_libgearman_la_OBJECTS) $(libgearman_libgearman_la_LIBADD) $(LIBS) +libgearman/libgearman_libgearmancore_la-allocator.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman_libgearmancore_la-byteorder.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearmancore_la-command.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman_libgearmancore_la-connection.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearmancore_la-error.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman_libgearmancore_la-log.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman_libgearmancore_la-packet.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearmancore_la-strcommand.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearmancore_la-strerror.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearman_libgearmancore_la-universal.lo: \ libgearman/$(am__dirstamp) \ libgearman/$(DEPDIR)/$(am__dirstamp) +libgearman/libgearman_libgearmancore_la-vector.lo: \ + libgearman/$(am__dirstamp) \ + libgearman/$(DEPDIR)/$(am__dirstamp) libgearman/libgearmancore.la: $(libgearman_libgearmancore_la_OBJECTS) $(libgearman_libgearmancore_la_DEPENDENCIES) libgearman/$(am__dirstamp) - $(AM_V_CCLD)$(libgearman_libgearmancore_la_LINK) $(libgearman_libgearmancore_la_OBJECTS) $(libgearman_libgearmancore_la_LIBADD) $(LIBS) -tests/$(am__dirstamp): - @$(MKDIR_P) tests - @: > tests/$(am__dirstamp) -tests/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) tests/$(DEPDIR) - @: > tests/$(DEPDIR)/$(am__dirstamp) -tests/test.lo: tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp) -tests/test_gearmand.lo: tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) -tests/libtest.la: $(tests_libtest_la_OBJECTS) $(tests_libtest_la_DEPENDENCIES) tests/$(am__dirstamp) - $(AM_V_CCLD)$(LINK) $(tests_libtest_la_OBJECTS) $(tests_libtest_la_LIBADD) $(LIBS) + $(AM_V_CXXLD)$(libgearman_libgearmancore_la_LINK) $(libgearman_libgearmancore_la_OBJECTS) $(libgearman_libgearmancore_la_LIBADD) $(LIBS) +libtest/$(am__dirstamp): + @$(MKDIR_P) libtest + @: > libtest/$(am__dirstamp) +libtest/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) libtest/$(DEPDIR) + @: > libtest/$(DEPDIR)/$(am__dirstamp) +libtest/gearmand.lo: libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/worker.lo: libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/libserver.la: $(libtest_libserver_la_OBJECTS) $(libtest_libserver_la_DEPENDENCIES) libtest/$(am__dirstamp) + $(AM_V_CXXLD)$(CXXLINK) $(libtest_libserver_la_OBJECTS) $(libtest_libserver_la_LIBADD) $(LIBS) +libtest/cmdline.lo: libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/framework.lo: libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/test.lo: libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/libtest.la: $(libtest_libtest_la_OBJECTS) $(libtest_libtest_la_DEPENDENCIES) libtest/$(am__dirstamp) + $(AM_V_CXXLD)$(CXXLINK) $(libtest_libtest_la_OBJECTS) $(libtest_libtest_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @@ -1414,133 +2230,234 @@ benchmark/$(DEPDIR)/$(am__dirstamp) benchmark/blobslap_client$(EXEEXT): $(benchmark_blobslap_client_OBJECTS) $(benchmark_blobslap_client_DEPENDENCIES) benchmark/$(am__dirstamp) @rm -f benchmark/blobslap_client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(benchmark_blobslap_client_OBJECTS) $(benchmark_blobslap_client_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(benchmark_blobslap_client_OBJECTS) $(benchmark_blobslap_client_LDADD) $(LIBS) benchmark/blobslap_worker.$(OBJEXT): benchmark/$(am__dirstamp) \ benchmark/$(DEPDIR)/$(am__dirstamp) +util/$(am__dirstamp): + @$(MKDIR_P) util + @: > util/$(am__dirstamp) +util/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) util/$(DEPDIR) + @: > util/$(DEPDIR)/$(am__dirstamp) +util/daemon.$(OBJEXT): util/$(am__dirstamp) \ + util/$(DEPDIR)/$(am__dirstamp) benchmark/blobslap_worker$(EXEEXT): $(benchmark_blobslap_worker_OBJECTS) $(benchmark_blobslap_worker_DEPENDENCIES) benchmark/$(am__dirstamp) @rm -f benchmark/blobslap_worker$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(benchmark_blobslap_worker_OBJECTS) $(benchmark_blobslap_worker_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(benchmark_blobslap_worker_OBJECTS) $(benchmark_blobslap_worker_LDADD) $(LIBS) bin/$(am__dirstamp): @$(MKDIR_P) bin @: > bin/$(am__dirstamp) bin/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) bin/$(DEPDIR) @: > bin/$(DEPDIR)/$(am__dirstamp) +bin/bin_gearadmin-gearadmin.$(OBJEXT): bin/$(am__dirstamp) \ + bin/$(DEPDIR)/$(am__dirstamp) +util/bin_gearadmin-instance.$(OBJEXT): util/$(am__dirstamp) \ + util/$(DEPDIR)/$(am__dirstamp) +bin/gearadmin$(EXEEXT): $(bin_gearadmin_OBJECTS) $(bin_gearadmin_DEPENDENCIES) bin/$(am__dirstamp) + @rm -f bin/gearadmin$(EXEEXT) + $(AM_V_CXXLD)$(bin_gearadmin_LINK) $(bin_gearadmin_OBJECTS) $(bin_gearadmin_LDADD) $(LIBS) +bin/arguments.$(OBJEXT): bin/$(am__dirstamp) \ + bin/$(DEPDIR)/$(am__dirstamp) +bin/function.$(OBJEXT): bin/$(am__dirstamp) \ + bin/$(DEPDIR)/$(am__dirstamp) bin/gearman.$(OBJEXT): bin/$(am__dirstamp) \ bin/$(DEPDIR)/$(am__dirstamp) +util/error.$(OBJEXT): util/$(am__dirstamp) \ + util/$(DEPDIR)/$(am__dirstamp) +util/pidfile.$(OBJEXT): util/$(am__dirstamp) \ + util/$(DEPDIR)/$(am__dirstamp) bin/gearman$(EXEEXT): $(bin_gearman_OBJECTS) $(bin_gearman_DEPENDENCIES) bin/$(am__dirstamp) @rm -f bin/gearman$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bin_gearman_OBJECTS) $(bin_gearman_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(bin_gearman_OBJECTS) $(bin_gearman_LDADD) $(LIBS) +docs/libgearman/examples/$(am__dirstamp): + @$(MKDIR_P) docs/libgearman/examples + @: > docs/libgearman/examples/$(am__dirstamp) +docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) docs/libgearman/examples/$(DEPDIR) + @: > docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp) +docs/libgearman/examples/gearman_client_do_background_example.$(OBJEXT): \ + docs/libgearman/examples/$(am__dirstamp) \ + docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp) +docs/libgearman/examples/gearman_client_do_background_example$(EXEEXT): $(docs_libgearman_examples_gearman_client_do_background_example_OBJECTS) $(docs_libgearman_examples_gearman_client_do_background_example_DEPENDENCIES) docs/libgearman/examples/$(am__dirstamp) + @rm -f docs/libgearman/examples/gearman_client_do_background_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(docs_libgearman_examples_gearman_client_do_background_example_OBJECTS) $(docs_libgearman_examples_gearman_client_do_background_example_LDADD) $(LIBS) +docs/libgearman/examples/gearman_client_do_example.$(OBJEXT): \ + docs/libgearman/examples/$(am__dirstamp) \ + docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp) +docs/libgearman/examples/gearman_client_do_example$(EXEEXT): $(docs_libgearman_examples_gearman_client_do_example_OBJECTS) $(docs_libgearman_examples_gearman_client_do_example_DEPENDENCIES) docs/libgearman/examples/$(am__dirstamp) + @rm -f docs/libgearman/examples/gearman_client_do_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(docs_libgearman_examples_gearman_client_do_example_OBJECTS) $(docs_libgearman_examples_gearman_client_do_example_LDADD) $(LIBS) +docs/libgearman/examples/gearman_execute_example.$(OBJEXT): \ + docs/libgearman/examples/$(am__dirstamp) \ + docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp) +docs/libgearman/examples/gearman_execute_example$(EXEEXT): $(docs_libgearman_examples_gearman_execute_example_OBJECTS) $(docs_libgearman_examples_gearman_execute_example_DEPENDENCIES) docs/libgearman/examples/$(am__dirstamp) + @rm -f docs/libgearman/examples/gearman_execute_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(docs_libgearman_examples_gearman_execute_example_OBJECTS) $(docs_libgearman_examples_gearman_execute_example_LDADD) $(LIBS) +docs/libgearman/examples/gearman_execute_partition.$(OBJEXT): \ + docs/libgearman/examples/$(am__dirstamp) \ + docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp) +docs/libgearman/examples/gearman_execute_partition$(EXEEXT): $(docs_libgearman_examples_gearman_execute_partition_OBJECTS) $(docs_libgearman_examples_gearman_execute_partition_DEPENDENCIES) docs/libgearman/examples/$(am__dirstamp) + @rm -f docs/libgearman/examples/gearman_execute_partition$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(docs_libgearman_examples_gearman_execute_partition_OBJECTS) $(docs_libgearman_examples_gearman_execute_partition_LDADD) $(LIBS) examples/$(am__dirstamp): @$(MKDIR_P) examples @: > examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) examples/$(DEPDIR) @: > examples/$(DEPDIR)/$(am__dirstamp) -examples/echo_client.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) +examples/examples_echo_client-echo_client.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/echo_client$(EXEEXT): $(examples_echo_client_OBJECTS) $(examples_echo_client_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/echo_client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_echo_client_OBJECTS) $(examples_echo_client_LDADD) $(LIBS) -examples/echo_worker.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) + $(AM_V_CXXLD)$(examples_echo_client_LINK) $(examples_echo_client_OBJECTS) $(examples_echo_client_LDADD) $(LIBS) +examples/examples_echo_worker-echo_worker.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/echo_worker$(EXEEXT): $(examples_echo_worker_OBJECTS) $(examples_echo_worker_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/echo_worker$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_echo_worker_OBJECTS) $(examples_echo_worker_LDADD) $(LIBS) -examples/reverse_client.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) + $(AM_V_CXXLD)$(examples_echo_worker_LINK) $(examples_echo_worker_OBJECTS) $(examples_echo_worker_LDADD) $(LIBS) +examples/examples_reverse_client-reverse_client.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/reverse_client$(EXEEXT): $(examples_reverse_client_OBJECTS) $(examples_reverse_client_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/reverse_client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_reverse_client_OBJECTS) $(examples_reverse_client_LDADD) $(LIBS) -examples/reverse_client_bg.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) + $(AM_V_CXXLD)$(examples_reverse_client_LINK) $(examples_reverse_client_OBJECTS) $(examples_reverse_client_LDADD) $(LIBS) +examples/examples_reverse_client_bg-reverse_client_bg.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/reverse_client_bg$(EXEEXT): $(examples_reverse_client_bg_OBJECTS) $(examples_reverse_client_bg_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/reverse_client_bg$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_reverse_client_bg_OBJECTS) $(examples_reverse_client_bg_LDADD) $(LIBS) -examples/reverse_client_cb.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) + $(AM_V_CXXLD)$(examples_reverse_client_bg_LINK) $(examples_reverse_client_bg_OBJECTS) $(examples_reverse_client_bg_LDADD) $(LIBS) +examples/examples_reverse_client_cb-reverse_client_cb.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/reverse_client_cb$(EXEEXT): $(examples_reverse_client_cb_OBJECTS) $(examples_reverse_client_cb_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/reverse_client_cb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_reverse_client_cb_OBJECTS) $(examples_reverse_client_cb_LDADD) $(LIBS) -examples/reverse_worker.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) + $(AM_V_CXXLD)$(examples_reverse_client_cb_LINK) $(examples_reverse_client_cb_OBJECTS) $(examples_reverse_client_cb_LDADD) $(LIBS) +examples/examples_reverse_client_epoch-reverse_client_epoch.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) +examples/reverse_client_epoch$(EXEEXT): $(examples_reverse_client_epoch_OBJECTS) $(examples_reverse_client_epoch_DEPENDENCIES) examples/$(am__dirstamp) + @rm -f examples/reverse_client_epoch$(EXEEXT) + $(AM_V_CXXLD)$(examples_reverse_client_epoch_LINK) $(examples_reverse_client_epoch_OBJECTS) $(examples_reverse_client_epoch_LDADD) $(LIBS) +examples/examples_reverse_worker-reverse_worker.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/reverse_worker$(EXEEXT): $(examples_reverse_worker_OBJECTS) $(examples_reverse_worker_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/reverse_worker$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_reverse_worker_OBJECTS) $(examples_reverse_worker_LDADD) $(LIBS) -examples/wc_worker.$(OBJEXT): examples/$(am__dirstamp) \ - examples/$(DEPDIR)/$(am__dirstamp) + $(AM_V_CXXLD)$(examples_reverse_worker_LINK) $(examples_reverse_worker_OBJECTS) $(examples_reverse_worker_LDADD) $(LIBS) +examples/examples_wc_worker-wc_worker.$(OBJEXT): \ + examples/$(am__dirstamp) examples/$(DEPDIR)/$(am__dirstamp) examples/wc_worker$(EXEEXT): $(examples_wc_worker_OBJECTS) $(examples_wc_worker_DEPENDENCIES) examples/$(am__dirstamp) @rm -f examples/wc_worker$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(examples_wc_worker_OBJECTS) $(examples_wc_worker_LDADD) $(LIBS) + $(AM_V_CXXLD)$(examples_wc_worker_LINK) $(examples_wc_worker_OBJECTS) $(examples_wc_worker_LDADD) $(LIBS) gearmand/$(am__dirstamp): @$(MKDIR_P) gearmand @: > gearmand/$(am__dirstamp) gearmand/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) gearmand/$(DEPDIR) @: > gearmand/$(DEPDIR)/$(am__dirstamp) -gearmand/gearmand.$(OBJEXT): gearmand/$(am__dirstamp) \ - gearmand/$(DEPDIR)/$(am__dirstamp) +gearmand/gearmand_gearmand-gearmand.$(OBJEXT): \ + gearmand/$(am__dirstamp) gearmand/$(DEPDIR)/$(am__dirstamp) +util/gearmand_gearmand-daemon.$(OBJEXT): util/$(am__dirstamp) \ + util/$(DEPDIR)/$(am__dirstamp) +util/gearmand_gearmand-pidfile.$(OBJEXT): util/$(am__dirstamp) \ + util/$(DEPDIR)/$(am__dirstamp) gearmand/gearmand$(EXEEXT): $(gearmand_gearmand_OBJECTS) $(gearmand_gearmand_DEPENDENCIES) gearmand/$(am__dirstamp) @rm -f gearmand/gearmand$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(gearmand_gearmand_OBJECTS) $(gearmand_gearmand_LDADD) $(LIBS) -tests/test_worker.$(OBJEXT): tests/$(am__dirstamp) \ + $(AM_V_CXXLD)$(gearmand_gearmand_LINK) $(gearmand_gearmand_OBJECTS) $(gearmand_gearmand_LDADD) $(LIBS) +libtest/unittest.$(OBJEXT): libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/unittest$(EXEEXT): $(libtest_unittest_OBJECTS) $(libtest_unittest_DEPENDENCIES) libtest/$(am__dirstamp) + @rm -f libtest/unittest$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(libtest_unittest_OBJECTS) $(libtest_unittest_LDADD) $(LIBS) +libtest/wait.$(OBJEXT): libtest/$(am__dirstamp) \ + libtest/$(DEPDIR)/$(am__dirstamp) +libtest/wait$(EXEEXT): $(libtest_wait_OBJECTS) $(libtest_wait_DEPENDENCIES) libtest/$(am__dirstamp) + @rm -f libtest/wait$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(libtest_wait_OBJECTS) $(libtest_wait_LDADD) $(LIBS) +tests/$(am__dirstamp): + @$(MKDIR_P) tests + @: > tests/$(am__dirstamp) +tests/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) tests/$(DEPDIR) + @: > tests/$(DEPDIR)/$(am__dirstamp) +tests/burnin.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/burnin_test$(EXEEXT): $(tests_burnin_test_OBJECTS) $(tests_burnin_test_DEPENDENCIES) tests/$(am__dirstamp) + @rm -f tests/burnin_test$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(tests_burnin_test_OBJECTS) $(tests_burnin_test_LDADD) $(LIBS) +tests/c_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/c_test$(EXEEXT): $(tests_c_test_OBJECTS) $(tests_c_test_DEPENDENCIES) tests/$(am__dirstamp) + @rm -f tests/c_test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tests_c_test_OBJECTS) $(tests_c_test_LDADD) $(LIBS) tests/client_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/do.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/do_background.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/execute.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/gearman_client_do_job_handle.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/gearman_execute_partition.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/protocol.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/server_options.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/task.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/unique.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/workers.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/workers_v1.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/client_test$(EXEEXT): $(tests_client_test_OBJECTS) $(tests_client_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/client_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_client_test_OBJECTS) $(tests_client_test_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_client_test_OBJECTS) $(tests_client_test_LDADD) $(LIBS) tests/cpp_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/cpp_test$(EXEEXT): $(tests_cpp_test_OBJECTS) $(tests_cpp_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/cpp_test$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(tests_cpp_test_OBJECTS) $(tests_cpp_test_LDADD) $(LIBS) +tests/basic.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/drizzle_test.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/drizzle_test$(EXEEXT): $(tests_drizzle_test_OBJECTS) $(tests_drizzle_test_DEPENDENCIES) tests/$(am__dirstamp) + @rm -f tests/drizzle_test$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(tests_drizzle_test_OBJECTS) $(tests_drizzle_test_LDADD) $(LIBS) tests/internals.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/regression.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/internals_test$(EXEEXT): $(tests_internals_test_OBJECTS) $(tests_internals_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/internals_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_internals_test_OBJECTS) $(tests_internals_test_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_internals_test_OBJECTS) $(tests_internals_test_LDADD) $(LIBS) tests/memcached_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/memcached_test$(EXEEXT): $(tests_memcached_test_OBJECTS) $(tests_memcached_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/memcached_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_memcached_test_OBJECTS) $(tests_memcached_test_LDADD) $(LIBS) -tests/regression.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) -tests/regression_test$(EXEEXT): $(tests_regression_test_OBJECTS) $(tests_regression_test_DEPENDENCIES) tests/$(am__dirstamp) - @rm -f tests/regression_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_regression_test_OBJECTS) $(tests_regression_test_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_memcached_test_OBJECTS) $(tests_memcached_test_LDADD) $(LIBS) tests/round_robin.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/round_robin_test$(EXEEXT): $(tests_round_robin_test_OBJECTS) $(tests_round_robin_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/round_robin_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_round_robin_test_OBJECTS) $(tests_round_robin_test_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_round_robin_test_OBJECTS) $(tests_round_robin_test_LDADD) $(LIBS) tests/sqlite_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/sqlite_test$(EXEEXT): $(tests_sqlite_test_OBJECTS) $(tests_sqlite_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/sqlite_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_sqlite_test_OBJECTS) $(tests_sqlite_test_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_sqlite_test_OBJECTS) $(tests_sqlite_test_LDADD) $(LIBS) tests/tokyocabinet_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/tokyocabinet_test$(EXEEXT): $(tests_tokyocabinet_test_OBJECTS) $(tests_tokyocabinet_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/tokyocabinet_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_tokyocabinet_test_OBJECTS) $(tests_tokyocabinet_test_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_tokyocabinet_test_OBJECTS) $(tests_tokyocabinet_test_LDADD) $(LIBS) tests/worker_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/worker_test$(EXEEXT): $(tests_worker_test_OBJECTS) $(tests_worker_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/worker_test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tests_worker_test_OBJECTS) $(tests_worker_test_LDADD) $(LIBS) -unittests/$(am__dirstamp): - @$(MKDIR_P) unittests - @: > unittests/$(am__dirstamp) -unittests/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) unittests/$(DEPDIR) - @: > unittests/$(DEPDIR)/$(am__dirstamp) -unittests/unittests_unittests-main.$(OBJEXT): \ - unittests/$(am__dirstamp) unittests/$(DEPDIR)/$(am__dirstamp) -unittests/unittests$(EXEEXT): $(unittests_unittests_OBJECTS) $(unittests_unittests_DEPENDENCIES) unittests/$(am__dirstamp) - @rm -f unittests/unittests$(EXEEXT) - $(AM_V_CXXLD)$(unittests_unittests_LINK) $(unittests_unittests_OBJECTS) $(unittests_unittests_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(tests_worker_test_OBJECTS) $(tests_worker_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -1548,23 +2465,35 @@ -rm -f benchmark/benchmark.lo -rm -f benchmark/blobslap_client.$(OBJEXT) -rm -f benchmark/blobslap_worker.$(OBJEXT) + -rm -f bin/arguments.$(OBJEXT) + -rm -f bin/bin_gearadmin-gearadmin.$(OBJEXT) + -rm -f bin/function.$(OBJEXT) -rm -f bin/gearman.$(OBJEXT) - -rm -f examples/echo_client.$(OBJEXT) - -rm -f examples/echo_worker.$(OBJEXT) - -rm -f examples/reverse_client.$(OBJEXT) - -rm -f examples/reverse_client_bg.$(OBJEXT) - -rm -f examples/reverse_client_cb.$(OBJEXT) - -rm -f examples/reverse_worker.$(OBJEXT) - -rm -f examples/wc_worker.$(OBJEXT) - -rm -f gearmand/gearmand.$(OBJEXT) + -rm -f docs/libgearman/examples/gearman_client_do_background_example.$(OBJEXT) + -rm -f docs/libgearman/examples/gearman_client_do_example.$(OBJEXT) + -rm -f docs/libgearman/examples/gearman_execute_example.$(OBJEXT) + -rm -f docs/libgearman/examples/gearman_execute_partition.$(OBJEXT) + -rm -f examples/examples_echo_client-echo_client.$(OBJEXT) + -rm -f examples/examples_echo_worker-echo_worker.$(OBJEXT) + -rm -f examples/examples_reverse_client-reverse_client.$(OBJEXT) + -rm -f examples/examples_reverse_client_bg-reverse_client_bg.$(OBJEXT) + -rm -f examples/examples_reverse_client_cb-reverse_client_cb.$(OBJEXT) + -rm -f examples/examples_reverse_client_epoch-reverse_client_epoch.$(OBJEXT) + -rm -f examples/examples_reverse_worker-reverse_worker.$(OBJEXT) + -rm -f examples/examples_wc_worker-wc_worker.$(OBJEXT) + -rm -f gearmand/gearmand_gearmand-gearmand.$(OBJEXT) + -rm -f libgearman-server/error/libgearman_server_libgearman_server_la-strerror.$(OBJEXT) + -rm -f libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-byteorder.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-client.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-client.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-conf.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-conf.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-conf_module.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-connection.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-connection.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-connection_list.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-fifo.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-fifo.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-function.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-function.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-gearmand.$(OBJEXT) @@ -1573,67 +2502,172 @@ -rm -f libgearman-server/libgearman_server_libgearman_server_la-gearmand_con.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-hash.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-hash.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-io.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-io.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-job.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-job.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-list.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-list.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-log.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-log.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-packet.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-packet.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-protocol_http.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.$(OBJEXT) - -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-plugins.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-plugins.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-queue.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-server.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-server.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-thread.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-thread.lo + -rm -f libgearman-server/libgearman_server_libgearman_server_la-wakeup.$(OBJEXT) + -rm -f libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo -rm -f libgearman-server/libgearman_server_libgearman_server_la-worker.$(OBJEXT) -rm -f libgearman-server/libgearman_server_libgearman_server_la-worker.lo + -rm -f libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.$(OBJEXT) + -rm -f libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo + -rm -f libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.$(OBJEXT) + -rm -f libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo + -rm -f libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.$(OBJEXT) + -rm -f libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo + -rm -f libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.$(OBJEXT) + -rm -f libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo + -rm -f libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.$(OBJEXT) + -rm -f libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo + -rm -f libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.$(OBJEXT) + -rm -f libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo + -rm -f libgearman/function/libgearman_libgearman_la-function_v2.$(OBJEXT) + -rm -f libgearman/function/libgearman_libgearman_la-function_v2.lo + -rm -f libgearman/function/libgearman_libgearman_la-make.$(OBJEXT) + -rm -f libgearman/function/libgearman_libgearman_la-make.lo + -rm -f libgearman/function/libgearman_libgearman_la-partition.$(OBJEXT) + -rm -f libgearman/function/libgearman_libgearman_la-partition.lo + -rm -f libgearman/libgearman_libgearman_la-actions.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-actions.lo + -rm -f libgearman/libgearman_libgearman_la-add.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-add.lo + -rm -f libgearman/libgearman_libgearman_la-aggregator.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-aggregator.lo + -rm -f libgearman/libgearman_libgearman_la-allocator.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-allocator.lo + -rm -f libgearman/libgearman_libgearman_la-argument.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-argument.lo + -rm -f libgearman/libgearman_libgearman_la-byteorder.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-byteorder.lo -rm -f libgearman/libgearman_libgearman_la-client.$(OBJEXT) -rm -f libgearman/libgearman_libgearman_la-client.lo + -rm -f libgearman/libgearman_libgearman_la-command.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-command.lo + -rm -f libgearman/libgearman_libgearman_la-connection.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-connection.lo + -rm -f libgearman/libgearman_libgearman_la-do.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-do.lo + -rm -f libgearman/libgearman_libgearman_la-error.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-error.lo + -rm -f libgearman/libgearman_libgearman_la-execute.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-execute.lo + -rm -f libgearman/libgearman_libgearman_la-function.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-function.lo -rm -f libgearman/libgearman_libgearman_la-gearman.$(OBJEXT) -rm -f libgearman/libgearman_libgearman_la-gearman.lo -rm -f libgearman/libgearman_libgearman_la-job.$(OBJEXT) -rm -f libgearman/libgearman_libgearman_la-job.lo + -rm -f libgearman/libgearman_libgearman_la-log.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-log.lo + -rm -f libgearman/libgearman_libgearman_la-packet.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-packet.lo + -rm -f libgearman/libgearman_libgearman_la-parse.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-parse.lo + -rm -f libgearman/libgearman_libgearman_la-result.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-result.lo + -rm -f libgearman/libgearman_libgearman_la-run.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-run.lo + -rm -f libgearman/libgearman_libgearman_la-strcommand.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-strcommand.lo -rm -f libgearman/libgearman_libgearman_la-strerror.$(OBJEXT) -rm -f libgearman/libgearman_libgearman_la-strerror.lo + -rm -f libgearman/libgearman_libgearman_la-string.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-string.lo -rm -f libgearman/libgearman_libgearman_la-task.$(OBJEXT) -rm -f libgearman/libgearman_libgearman_la-task.lo + -rm -f libgearman/libgearman_libgearman_la-task_attr.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-task_attr.lo + -rm -f libgearman/libgearman_libgearman_la-unique.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-unique.lo + -rm -f libgearman/libgearman_libgearman_la-universal.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-universal.lo + -rm -f libgearman/libgearman_libgearman_la-vector.$(OBJEXT) + -rm -f libgearman/libgearman_libgearman_la-vector.lo -rm -f libgearman/libgearman_libgearman_la-worker.$(OBJEXT) -rm -f libgearman/libgearman_libgearman_la-worker.lo + -rm -f libgearman/libgearman_libgearmancore_la-allocator.$(OBJEXT) + -rm -f libgearman/libgearman_libgearmancore_la-allocator.lo -rm -f libgearman/libgearman_libgearmancore_la-byteorder.$(OBJEXT) -rm -f libgearman/libgearman_libgearmancore_la-byteorder.lo + -rm -f libgearman/libgearman_libgearmancore_la-command.$(OBJEXT) + -rm -f libgearman/libgearman_libgearmancore_la-command.lo -rm -f libgearman/libgearman_libgearmancore_la-connection.$(OBJEXT) -rm -f libgearman/libgearman_libgearmancore_la-connection.lo + -rm -f libgearman/libgearman_libgearmancore_la-error.$(OBJEXT) + -rm -f libgearman/libgearman_libgearmancore_la-error.lo -rm -f libgearman/libgearman_libgearmancore_la-log.$(OBJEXT) -rm -f libgearman/libgearman_libgearmancore_la-log.lo -rm -f libgearman/libgearman_libgearmancore_la-packet.$(OBJEXT) -rm -f libgearman/libgearman_libgearmancore_la-packet.lo + -rm -f libgearman/libgearman_libgearmancore_la-strcommand.$(OBJEXT) + -rm -f libgearman/libgearman_libgearmancore_la-strcommand.lo + -rm -f libgearman/libgearman_libgearmancore_la-strerror.$(OBJEXT) + -rm -f libgearman/libgearman_libgearmancore_la-strerror.lo -rm -f libgearman/libgearman_libgearmancore_la-universal.$(OBJEXT) -rm -f libgearman/libgearman_libgearmancore_la-universal.lo + -rm -f libgearman/libgearman_libgearmancore_la-vector.$(OBJEXT) + -rm -f libgearman/libgearman_libgearmancore_la-vector.lo + -rm -f libgearman/libgearman_server_libgearman_server_la-command.$(OBJEXT) + -rm -f libgearman/libgearman_server_libgearman_server_la-command.lo + -rm -f libtest/cmdline.$(OBJEXT) + -rm -f libtest/cmdline.lo + -rm -f libtest/framework.$(OBJEXT) + -rm -f libtest/framework.lo + -rm -f libtest/gearmand.$(OBJEXT) + -rm -f libtest/gearmand.lo + -rm -f libtest/test.$(OBJEXT) + -rm -f libtest/test.lo + -rm -f libtest/unittest.$(OBJEXT) + -rm -f libtest/wait.$(OBJEXT) + -rm -f libtest/worker.$(OBJEXT) + -rm -f libtest/worker.lo + -rm -f tests/basic.$(OBJEXT) + -rm -f tests/burnin.$(OBJEXT) + -rm -f tests/c_test.$(OBJEXT) -rm -f tests/client_test.$(OBJEXT) -rm -f tests/cpp_test.$(OBJEXT) + -rm -f tests/do.$(OBJEXT) + -rm -f tests/do_background.$(OBJEXT) + -rm -f tests/drizzle_test.$(OBJEXT) + -rm -f tests/execute.$(OBJEXT) + -rm -f tests/gearman_client_do_job_handle.$(OBJEXT) + -rm -f tests/gearman_execute_partition.$(OBJEXT) -rm -f tests/internals.$(OBJEXT) -rm -f tests/memcached_test.$(OBJEXT) + -rm -f tests/protocol.$(OBJEXT) -rm -f tests/regression.$(OBJEXT) -rm -f tests/round_robin.$(OBJEXT) + -rm -f tests/server_options.$(OBJEXT) -rm -f tests/sqlite_test.$(OBJEXT) - -rm -f tests/test.$(OBJEXT) - -rm -f tests/test.lo - -rm -f tests/test_gearmand.$(OBJEXT) - -rm -f tests/test_gearmand.lo - -rm -f tests/test_worker.$(OBJEXT) + -rm -f tests/task.$(OBJEXT) -rm -f tests/tokyocabinet_test.$(OBJEXT) + -rm -f tests/unique.$(OBJEXT) -rm -f tests/worker_test.$(OBJEXT) - -rm -f unittests/unittests_unittests-main.$(OBJEXT) + -rm -f tests/workers.$(OBJEXT) + -rm -f tests/workers_v1.$(OBJEXT) + -rm -f util/bin_gearadmin-instance.$(OBJEXT) + -rm -f util/daemon.$(OBJEXT) + -rm -f util/error.$(OBJEXT) + -rm -f util/gearmand_gearmand-daemon.$(OBJEXT) + -rm -f util/gearmand_gearmand-pidfile.$(OBJEXT) + -rm -f util/pidfile.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -1641,59 +2675,132 @@ @AMDEP_TRUE@@am__include@ @am__quote@benchmark/$(DEPDIR)/benchmark.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@benchmark/$(DEPDIR)/blobslap_client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@benchmark/$(DEPDIR)/blobslap_worker.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@bin/$(DEPDIR)/arguments.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@bin/$(DEPDIR)/bin_gearadmin-gearadmin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@bin/$(DEPDIR)/function.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@bin/$(DEPDIR)/gearman.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/echo_client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/echo_worker.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/reverse_client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/reverse_client_bg.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/reverse_client_cb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/reverse_worker.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/wc_worker.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@gearmand/$(DEPDIR)/gearmand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@docs/libgearman/examples/$(DEPDIR)/gearman_client_do_background_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@docs/libgearman/examples/$(DEPDIR)/gearman_client_do_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@docs/libgearman/examples/$(DEPDIR)/gearman_execute_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@docs/libgearman/examples/$(DEPDIR)/gearman_execute_partition.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_echo_client-echo_client.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_echo_worker-echo_worker.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_reverse_client-reverse_client.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/examples_wc_worker-wc_worker.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-byteorder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf_module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection_list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-fifo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_con.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-hash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-job.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol_http.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libdrizzle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libmemcached.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libpq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libsqlite3.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libtokyocabinet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-plugins.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-thread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-wakeup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/error/$(DEPDIR)/libgearman_server_libgearman_server_la-strerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/plugins/protocol/http/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/plugins/queue/drizzle/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/plugins/queue/postgres/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/plugins/queue/sqlite/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-actions.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-add.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-aggregator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-allocator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-argument.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-byteorder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-command.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-connection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-do.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-execute.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-function.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-log.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-packet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-parse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-result.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-run.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-strcommand.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-task_attr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-unique.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-universal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-vector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-allocator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-command.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strcommand.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strerror.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_libgearmancore_la-vector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/$(DEPDIR)/libgearman_server_libgearman_server_la-command.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/function/$(DEPDIR)/libgearman_libgearman_la-function_v2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/function/$(DEPDIR)/libgearman_libgearman_la-make.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libgearman/function/$(DEPDIR)/libgearman_libgearman_la-partition.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/cmdline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/framework.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/gearmand.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/test.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/wait.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libtest/$(DEPDIR)/worker.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/basic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/burnin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/c_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/client_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/cpp_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/do.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/do_background.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/drizzle_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/execute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/gearman_client_do_job_handle.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/gearman_execute_partition.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/internals.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/memcached_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/protocol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/regression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/round_robin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/server_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/sqlite_test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test_gearmand.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test_worker.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/task.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tokyocabinet_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/unique.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/worker_test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@unittests/$(DEPDIR)/unittests_unittests-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/workers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/workers_v1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/bin_gearadmin-instance.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/daemon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/gearmand_gearmand-daemon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/gearmand_gearmand-pidfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/pidfile.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1722,70 +2829,6 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo: libgearman-server/queue_libdrizzle.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libdrizzle.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo `test -f 'libgearman-server/queue_libdrizzle.c' || echo '$(srcdir)/'`libgearman-server/queue_libdrizzle.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libdrizzle.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libdrizzle.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/queue_libdrizzle.c' object='libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libdrizzle.lo `test -f 'libgearman-server/queue_libdrizzle.c' || echo '$(srcdir)/'`libgearman-server/queue_libdrizzle.c - -libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo: libgearman-server/queue_libmemcached.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libmemcached.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo `test -f 'libgearman-server/queue_libmemcached.c' || echo '$(srcdir)/'`libgearman-server/queue_libmemcached.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libmemcached.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libmemcached.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/queue_libmemcached.c' object='libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libmemcached.lo `test -f 'libgearman-server/queue_libmemcached.c' || echo '$(srcdir)/'`libgearman-server/queue_libmemcached.c - -libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo: libgearman-server/queue_libpq.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libpq.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo `test -f 'libgearman-server/queue_libpq.c' || echo '$(srcdir)/'`libgearman-server/queue_libpq.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libpq.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libpq.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/queue_libpq.c' object='libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libpq.lo `test -f 'libgearman-server/queue_libpq.c' || echo '$(srcdir)/'`libgearman-server/queue_libpq.c - -libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo: libgearman-server/queue_libsqlite3.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libsqlite3.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo `test -f 'libgearman-server/queue_libsqlite3.c' || echo '$(srcdir)/'`libgearman-server/queue_libsqlite3.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libsqlite3.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libsqlite3.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/queue_libsqlite3.c' object='libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libsqlite3.lo `test -f 'libgearman-server/queue_libsqlite3.c' || echo '$(srcdir)/'`libgearman-server/queue_libsqlite3.c - -libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo: libgearman-server/queue_libtokyocabinet.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libtokyocabinet.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo `test -f 'libgearman-server/queue_libtokyocabinet.c' || echo '$(srcdir)/'`libgearman-server/queue_libtokyocabinet.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libtokyocabinet.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue_libtokyocabinet.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/queue_libtokyocabinet.c' object='libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-queue_libtokyocabinet.lo `test -f 'libgearman-server/queue_libtokyocabinet.c' || echo '$(srcdir)/'`libgearman-server/queue_libtokyocabinet.c - -libgearman-server/libgearman_server_libgearman_server_la-client.lo: libgearman-server/client.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-client.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-client.lo `test -f 'libgearman-server/client.c' || echo '$(srcdir)/'`libgearman-server/client.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/client.c' object='libgearman-server/libgearman_server_libgearman_server_la-client.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-client.lo `test -f 'libgearman-server/client.c' || echo '$(srcdir)/'`libgearman-server/client.c - -libgearman-server/libgearman_server_libgearman_server_la-conf.lo: libgearman-server/conf.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-conf.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-conf.lo `test -f 'libgearman-server/conf.c' || echo '$(srcdir)/'`libgearman-server/conf.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/conf.c' object='libgearman-server/libgearman_server_libgearman_server_la-conf.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-conf.lo `test -f 'libgearman-server/conf.c' || echo '$(srcdir)/'`libgearman-server/conf.c - -libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo: libgearman-server/conf_module.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf_module.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo `test -f 'libgearman-server/conf_module.c' || echo '$(srcdir)/'`libgearman-server/conf_module.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf_module.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-conf_module.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/conf_module.c' object='libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-conf_module.lo `test -f 'libgearman-server/conf_module.c' || echo '$(srcdir)/'`libgearman-server/conf_module.c - libgearman-server/libgearman_server_libgearman_server_la-connection.lo: libgearman-server/connection.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-connection.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-connection.lo `test -f 'libgearman-server/connection.c' || echo '$(srcdir)/'`libgearman-server/connection.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection.Plo @@ -1794,21 +2837,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-connection.lo `test -f 'libgearman-server/connection.c' || echo '$(srcdir)/'`libgearman-server/connection.c -libgearman-server/libgearman_server_libgearman_server_la-function.lo: libgearman-server/function.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-function.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-function.lo `test -f 'libgearman-server/function.c' || echo '$(srcdir)/'`libgearman-server/function.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Plo +libgearman-server/libgearman_server_libgearman_server_la-fifo.lo: libgearman-server/fifo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-fifo.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-fifo.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-fifo.lo `test -f 'libgearman-server/fifo.c' || echo '$(srcdir)/'`libgearman-server/fifo.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-fifo.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-fifo.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/function.c' object='libgearman-server/libgearman_server_libgearman_server_la-function.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/fifo.c' object='libgearman-server/libgearman_server_libgearman_server_la-fifo.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-function.lo `test -f 'libgearman-server/function.c' || echo '$(srcdir)/'`libgearman-server/function.c - -libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo: libgearman-server/gearmand.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo `test -f 'libgearman-server/gearmand.c' || echo '$(srcdir)/'`libgearman-server/gearmand.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/gearmand.c' object='libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo `test -f 'libgearman-server/gearmand.c' || echo '$(srcdir)/'`libgearman-server/gearmand.c +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-fifo.lo `test -f 'libgearman-server/fifo.c' || echo '$(srcdir)/'`libgearman-server/fifo.c libgearman-server/libgearman_server_libgearman_server_la-gearmand_con.lo: libgearman-server/gearmand_con.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-gearmand_con.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_con.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand_con.lo `test -f 'libgearman-server/gearmand_con.c' || echo '$(srcdir)/'`libgearman-server/gearmand_con.c @@ -1818,13 +2853,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand_con.lo `test -f 'libgearman-server/gearmand_con.c' || echo '$(srcdir)/'`libgearman-server/gearmand_con.c -libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo: libgearman-server/gearmand_thread.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo `test -f 'libgearman-server/gearmand_thread.c' || echo '$(srcdir)/'`libgearman-server/gearmand_thread.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Plo +libgearman-server/libgearman_server_libgearman_server_la-hash.lo: libgearman-server/hash.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-hash.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-hash.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-hash.lo `test -f 'libgearman-server/hash.c' || echo '$(srcdir)/'`libgearman-server/hash.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-hash.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-hash.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/gearmand_thread.c' object='libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/hash.c' object='libgearman-server/libgearman_server_libgearman_server_la-hash.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo `test -f 'libgearman-server/gearmand_thread.c' || echo '$(srcdir)/'`libgearman-server/gearmand_thread.c +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-hash.lo `test -f 'libgearman-server/hash.c' || echo '$(srcdir)/'`libgearman-server/hash.c libgearman-server/libgearman_server_libgearman_server_la-job.lo: libgearman-server/job.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-job.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-job.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-job.lo `test -f 'libgearman-server/job.c' || echo '$(srcdir)/'`libgearman-server/job.c @@ -1834,29 +2869,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-job.lo `test -f 'libgearman-server/job.c' || echo '$(srcdir)/'`libgearman-server/job.c -libgearman-server/libgearman_server_libgearman_server_la-log.lo: libgearman-server/log.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-log.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-log.lo `test -f 'libgearman-server/log.c' || echo '$(srcdir)/'`libgearman-server/log.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/log.c' object='libgearman-server/libgearman_server_libgearman_server_la-log.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-log.lo `test -f 'libgearman-server/log.c' || echo '$(srcdir)/'`libgearman-server/log.c - -libgearman-server/libgearman_server_libgearman_server_la-packet.lo: libgearman-server/packet.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-packet.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-packet.lo `test -f 'libgearman-server/packet.c' || echo '$(srcdir)/'`libgearman-server/packet.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/packet.c' object='libgearman-server/libgearman_server_libgearman_server_la-packet.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-packet.lo `test -f 'libgearman-server/packet.c' || echo '$(srcdir)/'`libgearman-server/packet.c - -libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo: libgearman-server/protocol_http.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol_http.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo `test -f 'libgearman-server/protocol_http.c' || echo '$(srcdir)/'`libgearman-server/protocol_http.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol_http.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol_http.Plo +libgearman-server/libgearman_server_libgearman_server_la-list.lo: libgearman-server/list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-list.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-list.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-list.lo `test -f 'libgearman-server/list.c' || echo '$(srcdir)/'`libgearman-server/list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-list.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-list.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/protocol_http.c' object='libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/list.c' object='libgearman-server/libgearman_server_libgearman_server_la-list.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-protocol_http.lo `test -f 'libgearman-server/protocol_http.c' || echo '$(srcdir)/'`libgearman-server/protocol_http.c +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-list.lo `test -f 'libgearman-server/list.c' || echo '$(srcdir)/'`libgearman-server/list.c libgearman-server/libgearman_server_libgearman_server_la-server.lo: libgearman-server/server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-server.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-server.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-server.lo `test -f 'libgearman-server/server.c' || echo '$(srcdir)/'`libgearman-server/server.c @@ -1874,102 +2893,6 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-thread.lo `test -f 'libgearman-server/thread.c' || echo '$(srcdir)/'`libgearman-server/thread.c -libgearman-server/libgearman_server_libgearman_server_la-worker.lo: libgearman-server/worker.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-worker.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-worker.lo `test -f 'libgearman-server/worker.c' || echo '$(srcdir)/'`libgearman-server/worker.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman-server/worker.c' object='libgearman-server/libgearman_server_libgearman_server_la-worker.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CFLAGS) $(CFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-worker.lo `test -f 'libgearman-server/worker.c' || echo '$(srcdir)/'`libgearman-server/worker.c - -libgearman/libgearman_libgearman_la-client.lo: libgearman/client.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearman_la-client.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Tpo -c -o libgearman/libgearman_libgearman_la-client.lo `test -f 'libgearman/client.c' || echo '$(srcdir)/'`libgearman/client.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/client.c' object='libgearman/libgearman_libgearman_la-client.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearman_la-client.lo `test -f 'libgearman/client.c' || echo '$(srcdir)/'`libgearman/client.c - -libgearman/libgearman_libgearman_la-gearman.lo: libgearman/gearman.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearman_la-gearman.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Tpo -c -o libgearman/libgearman_libgearman_la-gearman.lo `test -f 'libgearman/gearman.c' || echo '$(srcdir)/'`libgearman/gearman.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/gearman.c' object='libgearman/libgearman_libgearman_la-gearman.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearman_la-gearman.lo `test -f 'libgearman/gearman.c' || echo '$(srcdir)/'`libgearman/gearman.c - -libgearman/libgearman_libgearman_la-job.lo: libgearman/job.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearman_la-job.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Tpo -c -o libgearman/libgearman_libgearman_la-job.lo `test -f 'libgearman/job.c' || echo '$(srcdir)/'`libgearman/job.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/job.c' object='libgearman/libgearman_libgearman_la-job.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearman_la-job.lo `test -f 'libgearman/job.c' || echo '$(srcdir)/'`libgearman/job.c - -libgearman/libgearman_libgearman_la-strerror.lo: libgearman/strerror.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearman_la-strerror.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Tpo -c -o libgearman/libgearman_libgearman_la-strerror.lo `test -f 'libgearman/strerror.c' || echo '$(srcdir)/'`libgearman/strerror.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/strerror.c' object='libgearman/libgearman_libgearman_la-strerror.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearman_la-strerror.lo `test -f 'libgearman/strerror.c' || echo '$(srcdir)/'`libgearman/strerror.c - -libgearman/libgearman_libgearman_la-task.lo: libgearman/task.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearman_la-task.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Tpo -c -o libgearman/libgearman_libgearman_la-task.lo `test -f 'libgearman/task.c' || echo '$(srcdir)/'`libgearman/task.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/task.c' object='libgearman/libgearman_libgearman_la-task.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearman_la-task.lo `test -f 'libgearman/task.c' || echo '$(srcdir)/'`libgearman/task.c - -libgearman/libgearman_libgearman_la-worker.lo: libgearman/worker.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearman_la-worker.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Tpo -c -o libgearman/libgearman_libgearman_la-worker.lo `test -f 'libgearman/worker.c' || echo '$(srcdir)/'`libgearman/worker.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/worker.c' object='libgearman/libgearman_libgearman_la-worker.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearman_la-worker.lo `test -f 'libgearman/worker.c' || echo '$(srcdir)/'`libgearman/worker.c - -libgearman/libgearman_libgearmancore_la-byteorder.lo: libgearman/byteorder.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearmancore_la-byteorder.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Tpo -c -o libgearman/libgearman_libgearmancore_la-byteorder.lo `test -f 'libgearman/byteorder.c' || echo '$(srcdir)/'`libgearman/byteorder.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/byteorder.c' object='libgearman/libgearman_libgearmancore_la-byteorder.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearmancore_la-byteorder.lo `test -f 'libgearman/byteorder.c' || echo '$(srcdir)/'`libgearman/byteorder.c - -libgearman/libgearman_libgearmancore_la-connection.lo: libgearman/connection.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearmancore_la-connection.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Tpo -c -o libgearman/libgearman_libgearmancore_la-connection.lo `test -f 'libgearman/connection.c' || echo '$(srcdir)/'`libgearman/connection.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/connection.c' object='libgearman/libgearman_libgearmancore_la-connection.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearmancore_la-connection.lo `test -f 'libgearman/connection.c' || echo '$(srcdir)/'`libgearman/connection.c - -libgearman/libgearman_libgearmancore_la-log.lo: libgearman/log.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearmancore_la-log.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Tpo -c -o libgearman/libgearman_libgearmancore_la-log.lo `test -f 'libgearman/log.c' || echo '$(srcdir)/'`libgearman/log.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/log.c' object='libgearman/libgearman_libgearmancore_la-log.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearmancore_la-log.lo `test -f 'libgearman/log.c' || echo '$(srcdir)/'`libgearman/log.c - -libgearman/libgearman_libgearmancore_la-packet.lo: libgearman/packet.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearmancore_la-packet.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Tpo -c -o libgearman/libgearman_libgearmancore_la-packet.lo `test -f 'libgearman/packet.c' || echo '$(srcdir)/'`libgearman/packet.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/packet.c' object='libgearman/libgearman_libgearmancore_la-packet.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearmancore_la-packet.lo `test -f 'libgearman/packet.c' || echo '$(srcdir)/'`libgearman/packet.c - -libgearman/libgearman_libgearmancore_la-universal.lo: libgearman/universal.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -MT libgearman/libgearman_libgearmancore_la-universal.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Tpo -c -o libgearman/libgearman_libgearmancore_la-universal.lo `test -f 'libgearman/universal.c' || echo '$(srcdir)/'`libgearman/universal.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgearman/universal.c' object='libgearman/libgearman_libgearmancore_la-universal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CFLAGS) $(CFLAGS) -c -o libgearman/libgearman_libgearmancore_la-universal.lo `test -f 'libgearman/universal.c' || echo '$(srcdir)/'`libgearman/universal.c - .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @@ -1997,21 +2920,725 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< -unittests/unittests_unittests-main.o: unittests/main.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unittests_unittests_CXXFLAGS) $(CXXFLAGS) -MT unittests/unittests_unittests-main.o -MD -MP -MF unittests/$(DEPDIR)/unittests_unittests-main.Tpo -c -o unittests/unittests_unittests-main.o `test -f 'unittests/main.cc' || echo '$(srcdir)/'`unittests/main.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unittests/$(DEPDIR)/unittests_unittests-main.Tpo unittests/$(DEPDIR)/unittests_unittests-main.Po +libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo: libgearman-server/error/strerror.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo -MD -MP -MF libgearman-server/error/$(DEPDIR)/libgearman_server_libgearman_server_la-strerror.Tpo -c -o libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo `test -f 'libgearman-server/error/strerror.cc' || echo '$(srcdir)/'`libgearman-server/error/strerror.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/error/$(DEPDIR)/libgearman_server_libgearman_server_la-strerror.Tpo libgearman-server/error/$(DEPDIR)/libgearman_server_libgearman_server_la-strerror.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/error/strerror.cc' object='libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/error/libgearman_server_libgearman_server_la-strerror.lo `test -f 'libgearman-server/error/strerror.cc' || echo '$(srcdir)/'`libgearman-server/error/strerror.cc + +libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo: libgearman-server/plugins/protocol/http/protocol.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo -MD -MP -MF libgearman-server/plugins/protocol/http/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol.Tpo -c -o libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo `test -f 'libgearman-server/plugins/protocol/http/protocol.cc' || echo '$(srcdir)/'`libgearman-server/plugins/protocol/http/protocol.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/plugins/protocol/http/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol.Tpo libgearman-server/plugins/protocol/http/$(DEPDIR)/libgearman_server_libgearman_server_la-protocol.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins/protocol/http/protocol.cc' object='libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/plugins/protocol/http/libgearman_server_libgearman_server_la-protocol.lo `test -f 'libgearman-server/plugins/protocol/http/protocol.cc' || echo '$(srcdir)/'`libgearman-server/plugins/protocol/http/protocol.cc + +libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo: libgearman-server/plugins/queue/drizzle/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo -MD -MP -MF libgearman-server/plugins/queue/drizzle/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo -c -o libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/drizzle/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/drizzle/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/plugins/queue/drizzle/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo libgearman-server/plugins/queue/drizzle/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins/queue/drizzle/queue.cc' object='libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/plugins/queue/drizzle/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/drizzle/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/drizzle/queue.cc + +libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo: libgearman-server/plugins/queue/libmemcached/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo -MD -MP -MF libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo -c -o libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/libmemcached/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/libmemcached/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins/queue/libmemcached/queue.cc' object='libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/plugins/queue/libmemcached/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/libmemcached/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/libmemcached/queue.cc + +libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo: libgearman-server/plugins/queue/postgres/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo -MD -MP -MF libgearman-server/plugins/queue/postgres/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo -c -o libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/postgres/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/postgres/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/plugins/queue/postgres/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo libgearman-server/plugins/queue/postgres/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins/queue/postgres/queue.cc' object='libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/plugins/queue/postgres/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/postgres/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/postgres/queue.cc + +libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo: libgearman-server/plugins/queue/sqlite/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo -MD -MP -MF libgearman-server/plugins/queue/sqlite/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo -c -o libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/sqlite/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/sqlite/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/plugins/queue/sqlite/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo libgearman-server/plugins/queue/sqlite/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins/queue/sqlite/queue.cc' object='libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/plugins/queue/sqlite/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/sqlite/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/sqlite/queue.cc + +libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo: libgearman-server/plugins/queue/tokyocabinet/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo -MD -MP -MF libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo -c -o libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/tokyocabinet/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/tokyocabinet/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins/queue/tokyocabinet/queue.cc' object='libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/plugins/queue/tokyocabinet/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/plugins/queue/tokyocabinet/queue.cc' || echo '$(srcdir)/'`libgearman-server/plugins/queue/tokyocabinet/queue.cc + +libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo: libgearman-server/byteorder.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-byteorder.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo `test -f 'libgearman-server/byteorder.cc' || echo '$(srcdir)/'`libgearman-server/byteorder.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-byteorder.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-byteorder.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/byteorder.cc' object='libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-byteorder.lo `test -f 'libgearman-server/byteorder.cc' || echo '$(srcdir)/'`libgearman-server/byteorder.cc + +libgearman-server/libgearman_server_libgearman_server_la-client.lo: libgearman-server/client.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-client.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-client.lo `test -f 'libgearman-server/client.cc' || echo '$(srcdir)/'`libgearman-server/client.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-client.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/client.cc' object='libgearman-server/libgearman_server_libgearman_server_la-client.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-client.lo `test -f 'libgearman-server/client.cc' || echo '$(srcdir)/'`libgearman-server/client.cc + +libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo: libgearman-server/connection_list.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection_list.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo `test -f 'libgearman-server/connection_list.cc' || echo '$(srcdir)/'`libgearman-server/connection_list.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection_list.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-connection_list.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/connection_list.cc' object='libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-connection_list.lo `test -f 'libgearman-server/connection_list.cc' || echo '$(srcdir)/'`libgearman-server/connection_list.cc + +libgearman-server/libgearman_server_libgearman_server_la-function.lo: libgearman-server/function.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-function.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-function.lo `test -f 'libgearman-server/function.cc' || echo '$(srcdir)/'`libgearman-server/function.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-function.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/function.cc' object='libgearman-server/libgearman_server_libgearman_server_la-function.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-function.lo `test -f 'libgearman-server/function.cc' || echo '$(srcdir)/'`libgearman-server/function.cc + +libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo: libgearman-server/gearmand.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo `test -f 'libgearman-server/gearmand.cc' || echo '$(srcdir)/'`libgearman-server/gearmand.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/gearmand.cc' object='libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand.lo `test -f 'libgearman-server/gearmand.cc' || echo '$(srcdir)/'`libgearman-server/gearmand.cc + +libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo: libgearman-server/gearmand_thread.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo `test -f 'libgearman-server/gearmand_thread.cc' || echo '$(srcdir)/'`libgearman-server/gearmand_thread.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-gearmand_thread.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/gearmand_thread.cc' object='libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-gearmand_thread.lo `test -f 'libgearman-server/gearmand_thread.cc' || echo '$(srcdir)/'`libgearman-server/gearmand_thread.cc + +libgearman-server/libgearman_server_libgearman_server_la-io.lo: libgearman-server/io.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-io.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-io.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-io.lo `test -f 'libgearman-server/io.cc' || echo '$(srcdir)/'`libgearman-server/io.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-io.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-io.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/io.cc' object='libgearman-server/libgearman_server_libgearman_server_la-io.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-io.lo `test -f 'libgearman-server/io.cc' || echo '$(srcdir)/'`libgearman-server/io.cc + +libgearman-server/libgearman_server_libgearman_server_la-log.lo: libgearman-server/log.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-log.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-log.lo `test -f 'libgearman-server/log.cc' || echo '$(srcdir)/'`libgearman-server/log.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-log.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/log.cc' object='libgearman-server/libgearman_server_libgearman_server_la-log.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-log.lo `test -f 'libgearman-server/log.cc' || echo '$(srcdir)/'`libgearman-server/log.cc + +libgearman-server/libgearman_server_libgearman_server_la-packet.lo: libgearman-server/packet.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-packet.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-packet.lo `test -f 'libgearman-server/packet.cc' || echo '$(srcdir)/'`libgearman-server/packet.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-packet.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/packet.cc' object='libgearman-server/libgearman_server_libgearman_server_la-packet.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-packet.lo `test -f 'libgearman-server/packet.cc' || echo '$(srcdir)/'`libgearman-server/packet.cc + +libgearman-server/libgearman_server_libgearman_server_la-plugins.lo: libgearman-server/plugins.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-plugins.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-plugins.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-plugins.lo `test -f 'libgearman-server/plugins.cc' || echo '$(srcdir)/'`libgearman-server/plugins.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-plugins.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-plugins.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/plugins.cc' object='libgearman-server/libgearman_server_libgearman_server_la-plugins.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-plugins.lo `test -f 'libgearman-server/plugins.cc' || echo '$(srcdir)/'`libgearman-server/plugins.cc + +libgearman-server/libgearman_server_libgearman_server_la-queue.lo: libgearman-server/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-queue.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/queue.cc' || echo '$(srcdir)/'`libgearman-server/queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-queue.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/queue.cc' object='libgearman-server/libgearman_server_libgearman_server_la-queue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-queue.lo `test -f 'libgearman-server/queue.cc' || echo '$(srcdir)/'`libgearman-server/queue.cc + +libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo: libgearman-server/wakeup.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-wakeup.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo `test -f 'libgearman-server/wakeup.cc' || echo '$(srcdir)/'`libgearman-server/wakeup.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-wakeup.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-wakeup.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/wakeup.cc' object='libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-wakeup.lo `test -f 'libgearman-server/wakeup.cc' || echo '$(srcdir)/'`libgearman-server/wakeup.cc + +libgearman-server/libgearman_server_libgearman_server_la-worker.lo: libgearman-server/worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman-server/libgearman_server_libgearman_server_la-worker.lo -MD -MP -MF libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Tpo -c -o libgearman-server/libgearman_server_libgearman_server_la-worker.lo `test -f 'libgearman-server/worker.cc' || echo '$(srcdir)/'`libgearman-server/worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Tpo libgearman-server/$(DEPDIR)/libgearman_server_libgearman_server_la-worker.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman-server/worker.cc' object='libgearman-server/libgearman_server_libgearman_server_la-worker.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman-server/libgearman_server_libgearman_server_la-worker.lo `test -f 'libgearman-server/worker.cc' || echo '$(srcdir)/'`libgearman-server/worker.cc + +libgearman/libgearman_server_libgearman_server_la-command.lo: libgearman/command.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_server_libgearman_server_la-command.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_server_libgearman_server_la-command.Tpo -c -o libgearman/libgearman_server_libgearman_server_la-command.lo `test -f 'libgearman/command.cc' || echo '$(srcdir)/'`libgearman/command.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_server_libgearman_server_la-command.Tpo libgearman/$(DEPDIR)/libgearman_server_libgearman_server_la-command.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/command.cc' object='libgearman/libgearman_server_libgearman_server_la-command.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_server_libgearman_server_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_server_libgearman_server_la-command.lo `test -f 'libgearman/command.cc' || echo '$(srcdir)/'`libgearman/command.cc + +libgearman/libgearman_libgearman_la-actions.lo: libgearman/actions.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-actions.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-actions.Tpo -c -o libgearman/libgearman_libgearman_la-actions.lo `test -f 'libgearman/actions.cc' || echo '$(srcdir)/'`libgearman/actions.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-actions.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-actions.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/actions.cc' object='libgearman/libgearman_libgearman_la-actions.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-actions.lo `test -f 'libgearman/actions.cc' || echo '$(srcdir)/'`libgearman/actions.cc + +libgearman/libgearman_libgearman_la-aggregator.lo: libgearman/aggregator.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-aggregator.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-aggregator.Tpo -c -o libgearman/libgearman_libgearman_la-aggregator.lo `test -f 'libgearman/aggregator.cc' || echo '$(srcdir)/'`libgearman/aggregator.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-aggregator.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-aggregator.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/aggregator.cc' object='libgearman/libgearman_libgearman_la-aggregator.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-aggregator.lo `test -f 'libgearman/aggregator.cc' || echo '$(srcdir)/'`libgearman/aggregator.cc + +libgearman/libgearman_libgearman_la-allocator.lo: libgearman/allocator.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-allocator.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-allocator.Tpo -c -o libgearman/libgearman_libgearman_la-allocator.lo `test -f 'libgearman/allocator.cc' || echo '$(srcdir)/'`libgearman/allocator.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-allocator.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-allocator.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/allocator.cc' object='libgearman/libgearman_libgearman_la-allocator.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-allocator.lo `test -f 'libgearman/allocator.cc' || echo '$(srcdir)/'`libgearman/allocator.cc + +libgearman/libgearman_libgearman_la-argument.lo: libgearman/argument.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-argument.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-argument.Tpo -c -o libgearman/libgearman_libgearman_la-argument.lo `test -f 'libgearman/argument.cc' || echo '$(srcdir)/'`libgearman/argument.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-argument.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-argument.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/argument.cc' object='libgearman/libgearman_libgearman_la-argument.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-argument.lo `test -f 'libgearman/argument.cc' || echo '$(srcdir)/'`libgearman/argument.cc + +libgearman/libgearman_libgearman_la-add.lo: libgearman/add.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-add.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-add.Tpo -c -o libgearman/libgearman_libgearman_la-add.lo `test -f 'libgearman/add.cc' || echo '$(srcdir)/'`libgearman/add.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-add.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-add.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/add.cc' object='libgearman/libgearman_libgearman_la-add.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-add.lo `test -f 'libgearman/add.cc' || echo '$(srcdir)/'`libgearman/add.cc + +libgearman/libgearman_libgearman_la-byteorder.lo: libgearman/byteorder.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-byteorder.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-byteorder.Tpo -c -o libgearman/libgearman_libgearman_la-byteorder.lo `test -f 'libgearman/byteorder.cc' || echo '$(srcdir)/'`libgearman/byteorder.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-byteorder.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-byteorder.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/byteorder.cc' object='libgearman/libgearman_libgearman_la-byteorder.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-byteorder.lo `test -f 'libgearman/byteorder.cc' || echo '$(srcdir)/'`libgearman/byteorder.cc + +libgearman/libgearman_libgearman_la-client.lo: libgearman/client.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-client.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Tpo -c -o libgearman/libgearman_libgearman_la-client.lo `test -f 'libgearman/client.cc' || echo '$(srcdir)/'`libgearman/client.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-client.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/client.cc' object='libgearman/libgearman_libgearman_la-client.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-client.lo `test -f 'libgearman/client.cc' || echo '$(srcdir)/'`libgearman/client.cc + +libgearman/libgearman_libgearman_la-command.lo: libgearman/command.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-command.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-command.Tpo -c -o libgearman/libgearman_libgearman_la-command.lo `test -f 'libgearman/command.cc' || echo '$(srcdir)/'`libgearman/command.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-command.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-command.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/command.cc' object='libgearman/libgearman_libgearman_la-command.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-command.lo `test -f 'libgearman/command.cc' || echo '$(srcdir)/'`libgearman/command.cc + +libgearman/libgearman_libgearman_la-connection.lo: libgearman/connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-connection.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-connection.Tpo -c -o libgearman/libgearman_libgearman_la-connection.lo `test -f 'libgearman/connection.cc' || echo '$(srcdir)/'`libgearman/connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-connection.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-connection.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/connection.cc' object='libgearman/libgearman_libgearman_la-connection.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-connection.lo `test -f 'libgearman/connection.cc' || echo '$(srcdir)/'`libgearman/connection.cc + +libgearman/libgearman_libgearman_la-do.lo: libgearman/do.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-do.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-do.Tpo -c -o libgearman/libgearman_libgearman_la-do.lo `test -f 'libgearman/do.cc' || echo '$(srcdir)/'`libgearman/do.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-do.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-do.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/do.cc' object='libgearman/libgearman_libgearman_la-do.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-do.lo `test -f 'libgearman/do.cc' || echo '$(srcdir)/'`libgearman/do.cc + +libgearman/libgearman_libgearman_la-error.lo: libgearman/error.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-error.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-error.Tpo -c -o libgearman/libgearman_libgearman_la-error.lo `test -f 'libgearman/error.cc' || echo '$(srcdir)/'`libgearman/error.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-error.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-error.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/error.cc' object='libgearman/libgearman_libgearman_la-error.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-error.lo `test -f 'libgearman/error.cc' || echo '$(srcdir)/'`libgearman/error.cc + +libgearman/libgearman_libgearman_la-execute.lo: libgearman/execute.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-execute.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-execute.Tpo -c -o libgearman/libgearman_libgearman_la-execute.lo `test -f 'libgearman/execute.cc' || echo '$(srcdir)/'`libgearman/execute.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-execute.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-execute.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/execute.cc' object='libgearman/libgearman_libgearman_la-execute.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-execute.lo `test -f 'libgearman/execute.cc' || echo '$(srcdir)/'`libgearman/execute.cc + +libgearman/libgearman_libgearman_la-function.lo: libgearman/function.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-function.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-function.Tpo -c -o libgearman/libgearman_libgearman_la-function.lo `test -f 'libgearman/function.cc' || echo '$(srcdir)/'`libgearman/function.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-function.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-function.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/function.cc' object='libgearman/libgearman_libgearman_la-function.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-function.lo `test -f 'libgearman/function.cc' || echo '$(srcdir)/'`libgearman/function.cc + +libgearman/function/libgearman_libgearman_la-function_v2.lo: libgearman/function/function_v2.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/function/libgearman_libgearman_la-function_v2.lo -MD -MP -MF libgearman/function/$(DEPDIR)/libgearman_libgearman_la-function_v2.Tpo -c -o libgearman/function/libgearman_libgearman_la-function_v2.lo `test -f 'libgearman/function/function_v2.cc' || echo '$(srcdir)/'`libgearman/function/function_v2.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/function/$(DEPDIR)/libgearman_libgearman_la-function_v2.Tpo libgearman/function/$(DEPDIR)/libgearman_libgearman_la-function_v2.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/function/function_v2.cc' object='libgearman/function/libgearman_libgearman_la-function_v2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/function/libgearman_libgearman_la-function_v2.lo `test -f 'libgearman/function/function_v2.cc' || echo '$(srcdir)/'`libgearman/function/function_v2.cc + +libgearman/function/libgearman_libgearman_la-make.lo: libgearman/function/make.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/function/libgearman_libgearman_la-make.lo -MD -MP -MF libgearman/function/$(DEPDIR)/libgearman_libgearman_la-make.Tpo -c -o libgearman/function/libgearman_libgearman_la-make.lo `test -f 'libgearman/function/make.cc' || echo '$(srcdir)/'`libgearman/function/make.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/function/$(DEPDIR)/libgearman_libgearman_la-make.Tpo libgearman/function/$(DEPDIR)/libgearman_libgearman_la-make.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/function/make.cc' object='libgearman/function/libgearman_libgearman_la-make.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/function/libgearman_libgearman_la-make.lo `test -f 'libgearman/function/make.cc' || echo '$(srcdir)/'`libgearman/function/make.cc + +libgearman/function/libgearman_libgearman_la-partition.lo: libgearman/function/partition.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/function/libgearman_libgearman_la-partition.lo -MD -MP -MF libgearman/function/$(DEPDIR)/libgearman_libgearman_la-partition.Tpo -c -o libgearman/function/libgearman_libgearman_la-partition.lo `test -f 'libgearman/function/partition.cc' || echo '$(srcdir)/'`libgearman/function/partition.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/function/$(DEPDIR)/libgearman_libgearman_la-partition.Tpo libgearman/function/$(DEPDIR)/libgearman_libgearman_la-partition.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/function/partition.cc' object='libgearman/function/libgearman_libgearman_la-partition.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/function/libgearman_libgearman_la-partition.lo `test -f 'libgearman/function/partition.cc' || echo '$(srcdir)/'`libgearman/function/partition.cc + +libgearman/libgearman_libgearman_la-gearman.lo: libgearman/gearman.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-gearman.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Tpo -c -o libgearman/libgearman_libgearman_la-gearman.lo `test -f 'libgearman/gearman.cc' || echo '$(srcdir)/'`libgearman/gearman.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-gearman.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/gearman.cc' object='libgearman/libgearman_libgearman_la-gearman.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-gearman.lo `test -f 'libgearman/gearman.cc' || echo '$(srcdir)/'`libgearman/gearman.cc + +libgearman/libgearman_libgearman_la-job.lo: libgearman/job.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-job.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Tpo -c -o libgearman/libgearman_libgearman_la-job.lo `test -f 'libgearman/job.cc' || echo '$(srcdir)/'`libgearman/job.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-job.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/job.cc' object='libgearman/libgearman_libgearman_la-job.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-job.lo `test -f 'libgearman/job.cc' || echo '$(srcdir)/'`libgearman/job.cc + +libgearman/libgearman_libgearman_la-log.lo: libgearman/log.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-log.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-log.Tpo -c -o libgearman/libgearman_libgearman_la-log.lo `test -f 'libgearman/log.cc' || echo '$(srcdir)/'`libgearman/log.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-log.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-log.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/log.cc' object='libgearman/libgearman_libgearman_la-log.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-log.lo `test -f 'libgearman/log.cc' || echo '$(srcdir)/'`libgearman/log.cc + +libgearman/libgearman_libgearman_la-packet.lo: libgearman/packet.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-packet.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-packet.Tpo -c -o libgearman/libgearman_libgearman_la-packet.lo `test -f 'libgearman/packet.cc' || echo '$(srcdir)/'`libgearman/packet.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-packet.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-packet.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/packet.cc' object='libgearman/libgearman_libgearman_la-packet.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-packet.lo `test -f 'libgearman/packet.cc' || echo '$(srcdir)/'`libgearman/packet.cc + +libgearman/libgearman_libgearman_la-parse.lo: libgearman/parse.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-parse.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-parse.Tpo -c -o libgearman/libgearman_libgearman_la-parse.lo `test -f 'libgearman/parse.cc' || echo '$(srcdir)/'`libgearman/parse.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-parse.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-parse.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/parse.cc' object='libgearman/libgearman_libgearman_la-parse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-parse.lo `test -f 'libgearman/parse.cc' || echo '$(srcdir)/'`libgearman/parse.cc + +libgearman/libgearman_libgearman_la-result.lo: libgearman/result.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-result.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-result.Tpo -c -o libgearman/libgearman_libgearman_la-result.lo `test -f 'libgearman/result.cc' || echo '$(srcdir)/'`libgearman/result.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-result.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-result.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/result.cc' object='libgearman/libgearman_libgearman_la-result.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-result.lo `test -f 'libgearman/result.cc' || echo '$(srcdir)/'`libgearman/result.cc + +libgearman/libgearman_libgearman_la-run.lo: libgearman/run.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-run.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-run.Tpo -c -o libgearman/libgearman_libgearman_la-run.lo `test -f 'libgearman/run.cc' || echo '$(srcdir)/'`libgearman/run.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-run.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-run.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/run.cc' object='libgearman/libgearman_libgearman_la-run.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-run.lo `test -f 'libgearman/run.cc' || echo '$(srcdir)/'`libgearman/run.cc + +libgearman/libgearman_libgearman_la-strcommand.lo: libgearman/strcommand.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-strcommand.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-strcommand.Tpo -c -o libgearman/libgearman_libgearman_la-strcommand.lo `test -f 'libgearman/strcommand.cc' || echo '$(srcdir)/'`libgearman/strcommand.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-strcommand.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-strcommand.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/strcommand.cc' object='libgearman/libgearman_libgearman_la-strcommand.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-strcommand.lo `test -f 'libgearman/strcommand.cc' || echo '$(srcdir)/'`libgearman/strcommand.cc + +libgearman/libgearman_libgearman_la-strerror.lo: libgearman/strerror.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-strerror.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Tpo -c -o libgearman/libgearman_libgearman_la-strerror.lo `test -f 'libgearman/strerror.cc' || echo '$(srcdir)/'`libgearman/strerror.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-strerror.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/strerror.cc' object='libgearman/libgearman_libgearman_la-strerror.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-strerror.lo `test -f 'libgearman/strerror.cc' || echo '$(srcdir)/'`libgearman/strerror.cc + +libgearman/libgearman_libgearman_la-string.lo: libgearman/string.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-string.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-string.Tpo -c -o libgearman/libgearman_libgearman_la-string.lo `test -f 'libgearman/string.cc' || echo '$(srcdir)/'`libgearman/string.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-string.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-string.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/string.cc' object='libgearman/libgearman_libgearman_la-string.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-string.lo `test -f 'libgearman/string.cc' || echo '$(srcdir)/'`libgearman/string.cc + +libgearman/libgearman_libgearman_la-task.lo: libgearman/task.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-task.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Tpo -c -o libgearman/libgearman_libgearman_la-task.lo `test -f 'libgearman/task.cc' || echo '$(srcdir)/'`libgearman/task.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-task.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/task.cc' object='libgearman/libgearman_libgearman_la-task.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-task.lo `test -f 'libgearman/task.cc' || echo '$(srcdir)/'`libgearman/task.cc + +libgearman/libgearman_libgearman_la-task_attr.lo: libgearman/task_attr.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-task_attr.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-task_attr.Tpo -c -o libgearman/libgearman_libgearman_la-task_attr.lo `test -f 'libgearman/task_attr.cc' || echo '$(srcdir)/'`libgearman/task_attr.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-task_attr.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-task_attr.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/task_attr.cc' object='libgearman/libgearman_libgearman_la-task_attr.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-task_attr.lo `test -f 'libgearman/task_attr.cc' || echo '$(srcdir)/'`libgearman/task_attr.cc + +libgearman/libgearman_libgearman_la-unique.lo: libgearman/unique.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-unique.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-unique.Tpo -c -o libgearman/libgearman_libgearman_la-unique.lo `test -f 'libgearman/unique.cc' || echo '$(srcdir)/'`libgearman/unique.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-unique.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-unique.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/unique.cc' object='libgearman/libgearman_libgearman_la-unique.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-unique.lo `test -f 'libgearman/unique.cc' || echo '$(srcdir)/'`libgearman/unique.cc + +libgearman/libgearman_libgearman_la-universal.lo: libgearman/universal.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-universal.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-universal.Tpo -c -o libgearman/libgearman_libgearman_la-universal.lo `test -f 'libgearman/universal.cc' || echo '$(srcdir)/'`libgearman/universal.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-universal.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-universal.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/universal.cc' object='libgearman/libgearman_libgearman_la-universal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-universal.lo `test -f 'libgearman/universal.cc' || echo '$(srcdir)/'`libgearman/universal.cc + +libgearman/libgearman_libgearman_la-vector.lo: libgearman/vector.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-vector.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-vector.Tpo -c -o libgearman/libgearman_libgearman_la-vector.lo `test -f 'libgearman/vector.cc' || echo '$(srcdir)/'`libgearman/vector.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-vector.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-vector.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/vector.cc' object='libgearman/libgearman_libgearman_la-vector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-vector.lo `test -f 'libgearman/vector.cc' || echo '$(srcdir)/'`libgearman/vector.cc + +libgearman/libgearman_libgearman_la-worker.lo: libgearman/worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearman_la-worker.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Tpo -c -o libgearman/libgearman_libgearman_la-worker.lo `test -f 'libgearman/worker.cc' || echo '$(srcdir)/'`libgearman/worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Tpo libgearman/$(DEPDIR)/libgearman_libgearman_la-worker.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/worker.cc' object='libgearman/libgearman_libgearman_la-worker.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearman_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearman_la-worker.lo `test -f 'libgearman/worker.cc' || echo '$(srcdir)/'`libgearman/worker.cc + +libgearman/libgearman_libgearmancore_la-allocator.lo: libgearman/allocator.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-allocator.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-allocator.Tpo -c -o libgearman/libgearman_libgearmancore_la-allocator.lo `test -f 'libgearman/allocator.cc' || echo '$(srcdir)/'`libgearman/allocator.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-allocator.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-allocator.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/allocator.cc' object='libgearman/libgearman_libgearmancore_la-allocator.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-allocator.lo `test -f 'libgearman/allocator.cc' || echo '$(srcdir)/'`libgearman/allocator.cc + +libgearman/libgearman_libgearmancore_la-byteorder.lo: libgearman/byteorder.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-byteorder.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Tpo -c -o libgearman/libgearman_libgearmancore_la-byteorder.lo `test -f 'libgearman/byteorder.cc' || echo '$(srcdir)/'`libgearman/byteorder.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-byteorder.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/byteorder.cc' object='libgearman/libgearman_libgearmancore_la-byteorder.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-byteorder.lo `test -f 'libgearman/byteorder.cc' || echo '$(srcdir)/'`libgearman/byteorder.cc + +libgearman/libgearman_libgearmancore_la-command.lo: libgearman/command.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-command.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-command.Tpo -c -o libgearman/libgearman_libgearmancore_la-command.lo `test -f 'libgearman/command.cc' || echo '$(srcdir)/'`libgearman/command.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-command.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-command.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/command.cc' object='libgearman/libgearman_libgearmancore_la-command.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-command.lo `test -f 'libgearman/command.cc' || echo '$(srcdir)/'`libgearman/command.cc + +libgearman/libgearman_libgearmancore_la-connection.lo: libgearman/connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-connection.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Tpo -c -o libgearman/libgearman_libgearmancore_la-connection.lo `test -f 'libgearman/connection.cc' || echo '$(srcdir)/'`libgearman/connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-connection.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/connection.cc' object='libgearman/libgearman_libgearmancore_la-connection.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-connection.lo `test -f 'libgearman/connection.cc' || echo '$(srcdir)/'`libgearman/connection.cc + +libgearman/libgearman_libgearmancore_la-error.lo: libgearman/error.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-error.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-error.Tpo -c -o libgearman/libgearman_libgearmancore_la-error.lo `test -f 'libgearman/error.cc' || echo '$(srcdir)/'`libgearman/error.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-error.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-error.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/error.cc' object='libgearman/libgearman_libgearmancore_la-error.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-error.lo `test -f 'libgearman/error.cc' || echo '$(srcdir)/'`libgearman/error.cc + +libgearman/libgearman_libgearmancore_la-log.lo: libgearman/log.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-log.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Tpo -c -o libgearman/libgearman_libgearmancore_la-log.lo `test -f 'libgearman/log.cc' || echo '$(srcdir)/'`libgearman/log.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-log.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/log.cc' object='libgearman/libgearman_libgearmancore_la-log.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-log.lo `test -f 'libgearman/log.cc' || echo '$(srcdir)/'`libgearman/log.cc + +libgearman/libgearman_libgearmancore_la-packet.lo: libgearman/packet.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-packet.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Tpo -c -o libgearman/libgearman_libgearmancore_la-packet.lo `test -f 'libgearman/packet.cc' || echo '$(srcdir)/'`libgearman/packet.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-packet.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/packet.cc' object='libgearman/libgearman_libgearmancore_la-packet.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-packet.lo `test -f 'libgearman/packet.cc' || echo '$(srcdir)/'`libgearman/packet.cc + +libgearman/libgearman_libgearmancore_la-strcommand.lo: libgearman/strcommand.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-strcommand.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strcommand.Tpo -c -o libgearman/libgearman_libgearmancore_la-strcommand.lo `test -f 'libgearman/strcommand.cc' || echo '$(srcdir)/'`libgearman/strcommand.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strcommand.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strcommand.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/strcommand.cc' object='libgearman/libgearman_libgearmancore_la-strcommand.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-strcommand.lo `test -f 'libgearman/strcommand.cc' || echo '$(srcdir)/'`libgearman/strcommand.cc + +libgearman/libgearman_libgearmancore_la-strerror.lo: libgearman/strerror.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-strerror.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strerror.Tpo -c -o libgearman/libgearman_libgearmancore_la-strerror.lo `test -f 'libgearman/strerror.cc' || echo '$(srcdir)/'`libgearman/strerror.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strerror.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-strerror.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/strerror.cc' object='libgearman/libgearman_libgearmancore_la-strerror.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-strerror.lo `test -f 'libgearman/strerror.cc' || echo '$(srcdir)/'`libgearman/strerror.cc + +libgearman/libgearman_libgearmancore_la-universal.lo: libgearman/universal.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-universal.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Tpo -c -o libgearman/libgearman_libgearmancore_la-universal.lo `test -f 'libgearman/universal.cc' || echo '$(srcdir)/'`libgearman/universal.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-universal.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/universal.cc' object='libgearman/libgearman_libgearmancore_la-universal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-universal.lo `test -f 'libgearman/universal.cc' || echo '$(srcdir)/'`libgearman/universal.cc + +libgearman/libgearman_libgearmancore_la-vector.lo: libgearman/vector.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -MT libgearman/libgearman_libgearmancore_la-vector.lo -MD -MP -MF libgearman/$(DEPDIR)/libgearman_libgearmancore_la-vector.Tpo -c -o libgearman/libgearman_libgearmancore_la-vector.lo `test -f 'libgearman/vector.cc' || echo '$(srcdir)/'`libgearman/vector.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) libgearman/$(DEPDIR)/libgearman_libgearmancore_la-vector.Tpo libgearman/$(DEPDIR)/libgearman_libgearmancore_la-vector.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgearman/vector.cc' object='libgearman/libgearman_libgearmancore_la-vector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgearman_libgearmancore_la_CXXFLAGS) $(CXXFLAGS) -c -o libgearman/libgearman_libgearmancore_la-vector.lo `test -f 'libgearman/vector.cc' || echo '$(srcdir)/'`libgearman/vector.cc + +bin/bin_gearadmin-gearadmin.o: bin/gearadmin.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bin/bin_gearadmin-gearadmin.o -MD -MP -MF bin/$(DEPDIR)/bin_gearadmin-gearadmin.Tpo -c -o bin/bin_gearadmin-gearadmin.o `test -f 'bin/gearadmin.cc' || echo '$(srcdir)/'`bin/gearadmin.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) bin/$(DEPDIR)/bin_gearadmin-gearadmin.Tpo bin/$(DEPDIR)/bin_gearadmin-gearadmin.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bin/gearadmin.cc' object='bin/bin_gearadmin-gearadmin.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bin/bin_gearadmin-gearadmin.o `test -f 'bin/gearadmin.cc' || echo '$(srcdir)/'`bin/gearadmin.cc + +bin/bin_gearadmin-gearadmin.obj: bin/gearadmin.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bin/bin_gearadmin-gearadmin.obj -MD -MP -MF bin/$(DEPDIR)/bin_gearadmin-gearadmin.Tpo -c -o bin/bin_gearadmin-gearadmin.obj `if test -f 'bin/gearadmin.cc'; then $(CYGPATH_W) 'bin/gearadmin.cc'; else $(CYGPATH_W) '$(srcdir)/bin/gearadmin.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) bin/$(DEPDIR)/bin_gearadmin-gearadmin.Tpo bin/$(DEPDIR)/bin_gearadmin-gearadmin.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bin/gearadmin.cc' object='bin/bin_gearadmin-gearadmin.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bin/bin_gearadmin-gearadmin.obj `if test -f 'bin/gearadmin.cc'; then $(CYGPATH_W) 'bin/gearadmin.cc'; else $(CYGPATH_W) '$(srcdir)/bin/gearadmin.cc'; fi` + +util/bin_gearadmin-instance.o: util/instance.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT util/bin_gearadmin-instance.o -MD -MP -MF util/$(DEPDIR)/bin_gearadmin-instance.Tpo -c -o util/bin_gearadmin-instance.o `test -f 'util/instance.cc' || echo '$(srcdir)/'`util/instance.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/bin_gearadmin-instance.Tpo util/$(DEPDIR)/bin_gearadmin-instance.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/instance.cc' object='util/bin_gearadmin-instance.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o util/bin_gearadmin-instance.o `test -f 'util/instance.cc' || echo '$(srcdir)/'`util/instance.cc + +util/bin_gearadmin-instance.obj: util/instance.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT util/bin_gearadmin-instance.obj -MD -MP -MF util/$(DEPDIR)/bin_gearadmin-instance.Tpo -c -o util/bin_gearadmin-instance.obj `if test -f 'util/instance.cc'; then $(CYGPATH_W) 'util/instance.cc'; else $(CYGPATH_W) '$(srcdir)/util/instance.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/bin_gearadmin-instance.Tpo util/$(DEPDIR)/bin_gearadmin-instance.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/instance.cc' object='util/bin_gearadmin-instance.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_gearadmin_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o util/bin_gearadmin-instance.obj `if test -f 'util/instance.cc'; then $(CYGPATH_W) 'util/instance.cc'; else $(CYGPATH_W) '$(srcdir)/util/instance.cc'; fi` + +examples/examples_echo_client-echo_client.o: examples/echo_client.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_echo_client-echo_client.o -MD -MP -MF examples/$(DEPDIR)/examples_echo_client-echo_client.Tpo -c -o examples/examples_echo_client-echo_client.o `test -f 'examples/echo_client.cc' || echo '$(srcdir)/'`examples/echo_client.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_echo_client-echo_client.Tpo examples/$(DEPDIR)/examples_echo_client-echo_client.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/echo_client.cc' object='examples/examples_echo_client-echo_client.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_echo_client-echo_client.o `test -f 'examples/echo_client.cc' || echo '$(srcdir)/'`examples/echo_client.cc + +examples/examples_echo_client-echo_client.obj: examples/echo_client.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_echo_client-echo_client.obj -MD -MP -MF examples/$(DEPDIR)/examples_echo_client-echo_client.Tpo -c -o examples/examples_echo_client-echo_client.obj `if test -f 'examples/echo_client.cc'; then $(CYGPATH_W) 'examples/echo_client.cc'; else $(CYGPATH_W) '$(srcdir)/examples/echo_client.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_echo_client-echo_client.Tpo examples/$(DEPDIR)/examples_echo_client-echo_client.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/echo_client.cc' object='examples/examples_echo_client-echo_client.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_echo_client-echo_client.obj `if test -f 'examples/echo_client.cc'; then $(CYGPATH_W) 'examples/echo_client.cc'; else $(CYGPATH_W) '$(srcdir)/examples/echo_client.cc'; fi` + +examples/examples_echo_worker-echo_worker.o: examples/echo_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_echo_worker-echo_worker.o -MD -MP -MF examples/$(DEPDIR)/examples_echo_worker-echo_worker.Tpo -c -o examples/examples_echo_worker-echo_worker.o `test -f 'examples/echo_worker.cc' || echo '$(srcdir)/'`examples/echo_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_echo_worker-echo_worker.Tpo examples/$(DEPDIR)/examples_echo_worker-echo_worker.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/echo_worker.cc' object='examples/examples_echo_worker-echo_worker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_echo_worker-echo_worker.o `test -f 'examples/echo_worker.cc' || echo '$(srcdir)/'`examples/echo_worker.cc + +examples/examples_echo_worker-echo_worker.obj: examples/echo_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_echo_worker-echo_worker.obj -MD -MP -MF examples/$(DEPDIR)/examples_echo_worker-echo_worker.Tpo -c -o examples/examples_echo_worker-echo_worker.obj `if test -f 'examples/echo_worker.cc'; then $(CYGPATH_W) 'examples/echo_worker.cc'; else $(CYGPATH_W) '$(srcdir)/examples/echo_worker.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_echo_worker-echo_worker.Tpo examples/$(DEPDIR)/examples_echo_worker-echo_worker.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/echo_worker.cc' object='examples/examples_echo_worker-echo_worker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_echo_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_echo_worker-echo_worker.obj `if test -f 'examples/echo_worker.cc'; then $(CYGPATH_W) 'examples/echo_worker.cc'; else $(CYGPATH_W) '$(srcdir)/examples/echo_worker.cc'; fi` + +examples/examples_reverse_client-reverse_client.o: examples/reverse_client.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client-reverse_client.o -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client-reverse_client.Tpo -c -o examples/examples_reverse_client-reverse_client.o `test -f 'examples/reverse_client.cc' || echo '$(srcdir)/'`examples/reverse_client.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client-reverse_client.Tpo examples/$(DEPDIR)/examples_reverse_client-reverse_client.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client.cc' object='examples/examples_reverse_client-reverse_client.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client-reverse_client.o `test -f 'examples/reverse_client.cc' || echo '$(srcdir)/'`examples/reverse_client.cc + +examples/examples_reverse_client-reverse_client.obj: examples/reverse_client.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client-reverse_client.obj -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client-reverse_client.Tpo -c -o examples/examples_reverse_client-reverse_client.obj `if test -f 'examples/reverse_client.cc'; then $(CYGPATH_W) 'examples/reverse_client.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client-reverse_client.Tpo examples/$(DEPDIR)/examples_reverse_client-reverse_client.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client.cc' object='examples/examples_reverse_client-reverse_client.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client-reverse_client.obj `if test -f 'examples/reverse_client.cc'; then $(CYGPATH_W) 'examples/reverse_client.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client.cc'; fi` + +examples/examples_reverse_client_bg-reverse_client_bg.o: examples/reverse_client_bg.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_bg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client_bg-reverse_client_bg.o -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Tpo -c -o examples/examples_reverse_client_bg-reverse_client_bg.o `test -f 'examples/reverse_client_bg.cc' || echo '$(srcdir)/'`examples/reverse_client_bg.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Tpo examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client_bg.cc' object='examples/examples_reverse_client_bg-reverse_client_bg.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_bg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client_bg-reverse_client_bg.o `test -f 'examples/reverse_client_bg.cc' || echo '$(srcdir)/'`examples/reverse_client_bg.cc + +examples/examples_reverse_client_bg-reverse_client_bg.obj: examples/reverse_client_bg.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_bg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client_bg-reverse_client_bg.obj -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Tpo -c -o examples/examples_reverse_client_bg-reverse_client_bg.obj `if test -f 'examples/reverse_client_bg.cc'; then $(CYGPATH_W) 'examples/reverse_client_bg.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client_bg.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Tpo examples/$(DEPDIR)/examples_reverse_client_bg-reverse_client_bg.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client_bg.cc' object='examples/examples_reverse_client_bg-reverse_client_bg.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_bg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client_bg-reverse_client_bg.obj `if test -f 'examples/reverse_client_bg.cc'; then $(CYGPATH_W) 'examples/reverse_client_bg.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client_bg.cc'; fi` + +examples/examples_reverse_client_cb-reverse_client_cb.o: examples/reverse_client_cb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_cb_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client_cb-reverse_client_cb.o -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Tpo -c -o examples/examples_reverse_client_cb-reverse_client_cb.o `test -f 'examples/reverse_client_cb.cc' || echo '$(srcdir)/'`examples/reverse_client_cb.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Tpo examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client_cb.cc' object='examples/examples_reverse_client_cb-reverse_client_cb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_cb_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client_cb-reverse_client_cb.o `test -f 'examples/reverse_client_cb.cc' || echo '$(srcdir)/'`examples/reverse_client_cb.cc + +examples/examples_reverse_client_cb-reverse_client_cb.obj: examples/reverse_client_cb.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_cb_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client_cb-reverse_client_cb.obj -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Tpo -c -o examples/examples_reverse_client_cb-reverse_client_cb.obj `if test -f 'examples/reverse_client_cb.cc'; then $(CYGPATH_W) 'examples/reverse_client_cb.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client_cb.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Tpo examples/$(DEPDIR)/examples_reverse_client_cb-reverse_client_cb.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client_cb.cc' object='examples/examples_reverse_client_cb-reverse_client_cb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_cb_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client_cb-reverse_client_cb.obj `if test -f 'examples/reverse_client_cb.cc'; then $(CYGPATH_W) 'examples/reverse_client_cb.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client_cb.cc'; fi` + +examples/examples_reverse_client_epoch-reverse_client_epoch.o: examples/reverse_client_epoch.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_epoch_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client_epoch-reverse_client_epoch.o -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Tpo -c -o examples/examples_reverse_client_epoch-reverse_client_epoch.o `test -f 'examples/reverse_client_epoch.cc' || echo '$(srcdir)/'`examples/reverse_client_epoch.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Tpo examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client_epoch.cc' object='examples/examples_reverse_client_epoch-reverse_client_epoch.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_epoch_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client_epoch-reverse_client_epoch.o `test -f 'examples/reverse_client_epoch.cc' || echo '$(srcdir)/'`examples/reverse_client_epoch.cc + +examples/examples_reverse_client_epoch-reverse_client_epoch.obj: examples/reverse_client_epoch.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_epoch_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_client_epoch-reverse_client_epoch.obj -MD -MP -MF examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Tpo -c -o examples/examples_reverse_client_epoch-reverse_client_epoch.obj `if test -f 'examples/reverse_client_epoch.cc'; then $(CYGPATH_W) 'examples/reverse_client_epoch.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client_epoch.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Tpo examples/$(DEPDIR)/examples_reverse_client_epoch-reverse_client_epoch.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_client_epoch.cc' object='examples/examples_reverse_client_epoch-reverse_client_epoch.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_client_epoch_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_client_epoch-reverse_client_epoch.obj `if test -f 'examples/reverse_client_epoch.cc'; then $(CYGPATH_W) 'examples/reverse_client_epoch.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_client_epoch.cc'; fi` + +examples/examples_reverse_worker-reverse_worker.o: examples/reverse_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_worker-reverse_worker.o -MD -MP -MF examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Tpo -c -o examples/examples_reverse_worker-reverse_worker.o `test -f 'examples/reverse_worker.cc' || echo '$(srcdir)/'`examples/reverse_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Tpo examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_worker.cc' object='examples/examples_reverse_worker-reverse_worker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_worker-reverse_worker.o `test -f 'examples/reverse_worker.cc' || echo '$(srcdir)/'`examples/reverse_worker.cc + +examples/examples_reverse_worker-reverse_worker.obj: examples/reverse_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_reverse_worker-reverse_worker.obj -MD -MP -MF examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Tpo -c -o examples/examples_reverse_worker-reverse_worker.obj `if test -f 'examples/reverse_worker.cc'; then $(CYGPATH_W) 'examples/reverse_worker.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_worker.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Tpo examples/$(DEPDIR)/examples_reverse_worker-reverse_worker.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/reverse_worker.cc' object='examples/examples_reverse_worker-reverse_worker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_reverse_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_reverse_worker-reverse_worker.obj `if test -f 'examples/reverse_worker.cc'; then $(CYGPATH_W) 'examples/reverse_worker.cc'; else $(CYGPATH_W) '$(srcdir)/examples/reverse_worker.cc'; fi` + +examples/examples_wc_worker-wc_worker.o: examples/wc_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_wc_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_wc_worker-wc_worker.o -MD -MP -MF examples/$(DEPDIR)/examples_wc_worker-wc_worker.Tpo -c -o examples/examples_wc_worker-wc_worker.o `test -f 'examples/wc_worker.cc' || echo '$(srcdir)/'`examples/wc_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_wc_worker-wc_worker.Tpo examples/$(DEPDIR)/examples_wc_worker-wc_worker.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/wc_worker.cc' object='examples/examples_wc_worker-wc_worker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_wc_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_wc_worker-wc_worker.o `test -f 'examples/wc_worker.cc' || echo '$(srcdir)/'`examples/wc_worker.cc + +examples/examples_wc_worker-wc_worker.obj: examples/wc_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_wc_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT examples/examples_wc_worker-wc_worker.obj -MD -MP -MF examples/$(DEPDIR)/examples_wc_worker-wc_worker.Tpo -c -o examples/examples_wc_worker-wc_worker.obj `if test -f 'examples/wc_worker.cc'; then $(CYGPATH_W) 'examples/wc_worker.cc'; else $(CYGPATH_W) '$(srcdir)/examples/wc_worker.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) examples/$(DEPDIR)/examples_wc_worker-wc_worker.Tpo examples/$(DEPDIR)/examples_wc_worker-wc_worker.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='examples/wc_worker.cc' object='examples/examples_wc_worker-wc_worker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(examples_wc_worker_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o examples/examples_wc_worker-wc_worker.obj `if test -f 'examples/wc_worker.cc'; then $(CYGPATH_W) 'examples/wc_worker.cc'; else $(CYGPATH_W) '$(srcdir)/examples/wc_worker.cc'; fi` + +gearmand/gearmand_gearmand-gearmand.o: gearmand/gearmand.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gearmand/gearmand_gearmand-gearmand.o -MD -MP -MF gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Tpo -c -o gearmand/gearmand_gearmand-gearmand.o `test -f 'gearmand/gearmand.cc' || echo '$(srcdir)/'`gearmand/gearmand.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Tpo gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gearmand/gearmand.cc' object='gearmand/gearmand_gearmand-gearmand.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gearmand/gearmand_gearmand-gearmand.o `test -f 'gearmand/gearmand.cc' || echo '$(srcdir)/'`gearmand/gearmand.cc + +gearmand/gearmand_gearmand-gearmand.obj: gearmand/gearmand.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gearmand/gearmand_gearmand-gearmand.obj -MD -MP -MF gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Tpo -c -o gearmand/gearmand_gearmand-gearmand.obj `if test -f 'gearmand/gearmand.cc'; then $(CYGPATH_W) 'gearmand/gearmand.cc'; else $(CYGPATH_W) '$(srcdir)/gearmand/gearmand.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Tpo gearmand/$(DEPDIR)/gearmand_gearmand-gearmand.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gearmand/gearmand.cc' object='gearmand/gearmand_gearmand-gearmand.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gearmand/gearmand_gearmand-gearmand.obj `if test -f 'gearmand/gearmand.cc'; then $(CYGPATH_W) 'gearmand/gearmand.cc'; else $(CYGPATH_W) '$(srcdir)/gearmand/gearmand.cc'; fi` + +util/gearmand_gearmand-daemon.o: util/daemon.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT util/gearmand_gearmand-daemon.o -MD -MP -MF util/$(DEPDIR)/gearmand_gearmand-daemon.Tpo -c -o util/gearmand_gearmand-daemon.o `test -f 'util/daemon.cc' || echo '$(srcdir)/'`util/daemon.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/gearmand_gearmand-daemon.Tpo util/$(DEPDIR)/gearmand_gearmand-daemon.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/daemon.cc' object='util/gearmand_gearmand-daemon.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o util/gearmand_gearmand-daemon.o `test -f 'util/daemon.cc' || echo '$(srcdir)/'`util/daemon.cc + +util/gearmand_gearmand-daemon.obj: util/daemon.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT util/gearmand_gearmand-daemon.obj -MD -MP -MF util/$(DEPDIR)/gearmand_gearmand-daemon.Tpo -c -o util/gearmand_gearmand-daemon.obj `if test -f 'util/daemon.cc'; then $(CYGPATH_W) 'util/daemon.cc'; else $(CYGPATH_W) '$(srcdir)/util/daemon.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/gearmand_gearmand-daemon.Tpo util/$(DEPDIR)/gearmand_gearmand-daemon.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/daemon.cc' object='util/gearmand_gearmand-daemon.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o util/gearmand_gearmand-daemon.obj `if test -f 'util/daemon.cc'; then $(CYGPATH_W) 'util/daemon.cc'; else $(CYGPATH_W) '$(srcdir)/util/daemon.cc'; fi` + +util/gearmand_gearmand-pidfile.o: util/pidfile.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT util/gearmand_gearmand-pidfile.o -MD -MP -MF util/$(DEPDIR)/gearmand_gearmand-pidfile.Tpo -c -o util/gearmand_gearmand-pidfile.o `test -f 'util/pidfile.cc' || echo '$(srcdir)/'`util/pidfile.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/gearmand_gearmand-pidfile.Tpo util/$(DEPDIR)/gearmand_gearmand-pidfile.Po @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='unittests/main.cc' object='unittests/unittests_unittests-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/pidfile.cc' object='util/gearmand_gearmand-pidfile.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unittests_unittests_CXXFLAGS) $(CXXFLAGS) -c -o unittests/unittests_unittests-main.o `test -f 'unittests/main.cc' || echo '$(srcdir)/'`unittests/main.cc +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o util/gearmand_gearmand-pidfile.o `test -f 'util/pidfile.cc' || echo '$(srcdir)/'`util/pidfile.cc -unittests/unittests_unittests-main.obj: unittests/main.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unittests_unittests_CXXFLAGS) $(CXXFLAGS) -MT unittests/unittests_unittests-main.obj -MD -MP -MF unittests/$(DEPDIR)/unittests_unittests-main.Tpo -c -o unittests/unittests_unittests-main.obj `if test -f 'unittests/main.cc'; then $(CYGPATH_W) 'unittests/main.cc'; else $(CYGPATH_W) '$(srcdir)/unittests/main.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) unittests/$(DEPDIR)/unittests_unittests-main.Tpo unittests/$(DEPDIR)/unittests_unittests-main.Po +util/gearmand_gearmand-pidfile.obj: util/pidfile.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT util/gearmand_gearmand-pidfile.obj -MD -MP -MF util/$(DEPDIR)/gearmand_gearmand-pidfile.Tpo -c -o util/gearmand_gearmand-pidfile.obj `if test -f 'util/pidfile.cc'; then $(CYGPATH_W) 'util/pidfile.cc'; else $(CYGPATH_W) '$(srcdir)/util/pidfile.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/gearmand_gearmand-pidfile.Tpo util/$(DEPDIR)/gearmand_gearmand-pidfile.Po @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='unittests/main.cc' object='unittests/unittests_unittests-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/pidfile.cc' object='util/gearmand_gearmand-pidfile.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unittests_unittests_CXXFLAGS) $(CXXFLAGS) -c -o unittests/unittests_unittests-main.obj `if test -f 'unittests/main.cc'; then $(CYGPATH_W) 'unittests/main.cc'; else $(CYGPATH_W) '$(srcdir)/unittests/main.cc'; fi` +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gearmand_gearmand_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o util/gearmand_gearmand-pidfile.obj `if test -f 'util/pidfile.cc'; then $(CYGPATH_W) 'util/pidfile.cc'; else $(CYGPATH_W) '$(srcdir)/util/pidfile.cc'; fi` mostlyclean-libtool: -rm -f *.lo @@ -2020,22 +3647,29 @@ -rm -rf .libs _libs -rm -rf benchmark/.libs benchmark/_libs -rm -rf bin/.libs bin/_libs + -rm -rf docs/libgearman/examples/.libs docs/libgearman/examples/_libs -rm -rf examples/.libs examples/_libs -rm -rf gearmand/.libs gearmand/_libs -rm -rf libgearman/.libs libgearman/_libs -rm -rf libgearman-server/.libs libgearman-server/_libs + -rm -rf libgearman-server/error/.libs libgearman-server/error/_libs + -rm -rf libgearman-server/plugins/protocol/http/.libs libgearman-server/plugins/protocol/http/_libs + -rm -rf libgearman-server/plugins/queue/drizzle/.libs libgearman-server/plugins/queue/drizzle/_libs + -rm -rf libgearman-server/plugins/queue/libmemcached/.libs libgearman-server/plugins/queue/libmemcached/_libs + -rm -rf libgearman-server/plugins/queue/postgres/.libs libgearman-server/plugins/queue/postgres/_libs + -rm -rf libgearman-server/plugins/queue/sqlite/.libs libgearman-server/plugins/queue/sqlite/_libs + -rm -rf libgearman-server/plugins/queue/tokyocabinet/.libs libgearman-server/plugins/queue/tokyocabinet/_libs + -rm -rf libgearman/function/.libs libgearman/function/_libs + -rm -rf libtest/.libs libtest/_libs -rm -rf tests/.libs tests/_libs - -rm -rf unittests/.libs unittests/_libs distclean-libtool: -rm -f libtool config.lt -install-man1: $(dist_man_MANS) +install-man1: $(man1_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list=''; test -n "$(man1dir)" || exit 0; \ + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -2058,22 +3692,18 @@ uninstall-man1: @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man1dir)" || exit 0; \ + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } -install-man3: $(dist_man_MANS) +install-man3: $(man3_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ + @list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -2096,22 +3726,18 @@ uninstall-man3: @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man3dir)" || exit 0; \ + @list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } -install-man8: $(dist_man_MANS) +install-man8: $(man8_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" - @list=''; test -n "$(man8dir)" || exit 0; \ + @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -2134,10 +3760,8 @@ uninstall-man8: @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man8dir)" || exit 0; \ + @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ @@ -2529,31 +4153,54 @@ -rm -f benchmark/$(am__dirstamp) -rm -f bin/$(DEPDIR)/$(am__dirstamp) -rm -f bin/$(am__dirstamp) + -rm -f docs/libgearman/examples/$(DEPDIR)/$(am__dirstamp) + -rm -f docs/libgearman/examples/$(am__dirstamp) -rm -f examples/$(DEPDIR)/$(am__dirstamp) -rm -f examples/$(am__dirstamp) -rm -f gearmand/$(DEPDIR)/$(am__dirstamp) -rm -f gearmand/$(am__dirstamp) -rm -f libgearman-server/$(DEPDIR)/$(am__dirstamp) -rm -f libgearman-server/$(am__dirstamp) + -rm -f libgearman-server/error/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/error/$(am__dirstamp) + -rm -f libgearman-server/plugins/protocol/http/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/plugins/protocol/http/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/drizzle/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/drizzle/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/libmemcached/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/libmemcached/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/postgres/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/postgres/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/sqlite/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/sqlite/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman-server/plugins/queue/tokyocabinet/$(am__dirstamp) -rm -f libgearman/$(DEPDIR)/$(am__dirstamp) -rm -f libgearman/$(am__dirstamp) + -rm -f libgearman/function/$(DEPDIR)/$(am__dirstamp) + -rm -f libgearman/function/$(am__dirstamp) + -rm -f libtest/$(DEPDIR)/$(am__dirstamp) + -rm -f libtest/$(am__dirstamp) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) - -rm -f unittests/$(DEPDIR)/$(am__dirstamp) - -rm -f unittests/$(am__dirstamp) + -rm -f util/$(DEPDIR)/$(am__dirstamp) + -rm -f util/$(am__dirstamp) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@HAVE_SPHINX_FALSE@html-local: clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS clean-sbinPROGRAMS mostlyclean-am + clean-libLTLIBRARIES clean-libtool clean-local \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ + clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf benchmark/$(DEPDIR) bin/$(DEPDIR) examples/$(DEPDIR) gearmand/$(DEPDIR) libgearman-server/$(DEPDIR) libgearman/$(DEPDIR) tests/$(DEPDIR) unittests/$(DEPDIR) + -rm -rf benchmark/$(DEPDIR) bin/$(DEPDIR) docs/libgearman/examples/$(DEPDIR) examples/$(DEPDIR) gearmand/$(DEPDIR) libgearman-server/$(DEPDIR) libgearman-server/error/$(DEPDIR) libgearman-server/plugins/protocol/http/$(DEPDIR) libgearman-server/plugins/queue/drizzle/$(DEPDIR) libgearman-server/plugins/queue/libmemcached/$(DEPDIR) libgearman-server/plugins/queue/postgres/$(DEPDIR) libgearman-server/plugins/queue/sqlite/$(DEPDIR) libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR) libgearman/$(DEPDIR) libgearman/function/$(DEPDIR) libtest/$(DEPDIR) tests/$(DEPDIR) util/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -2564,7 +4211,7 @@ html: html-am -html-am: +html-am: html-local info: info-am @@ -2603,7 +4250,7 @@ maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf benchmark/$(DEPDIR) bin/$(DEPDIR) examples/$(DEPDIR) gearmand/$(DEPDIR) libgearman-server/$(DEPDIR) libgearman/$(DEPDIR) tests/$(DEPDIR) unittests/$(DEPDIR) + -rm -rf benchmark/$(DEPDIR) bin/$(DEPDIR) docs/libgearman/examples/$(DEPDIR) examples/$(DEPDIR) gearmand/$(DEPDIR) libgearman-server/$(DEPDIR) libgearman-server/error/$(DEPDIR) libgearman-server/plugins/protocol/http/$(DEPDIR) libgearman-server/plugins/queue/drizzle/$(DEPDIR) libgearman-server/plugins/queue/libmemcached/$(DEPDIR) libgearman-server/plugins/queue/postgres/$(DEPDIR) libgearman-server/plugins/queue/sqlite/$(DEPDIR) libgearman-server/plugins/queue/tokyocabinet/$(DEPDIR) libgearman/$(DEPDIR) libgearman/function/$(DEPDIR) libtest/$(DEPDIR) tests/$(DEPDIR) util/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -2630,14 +4277,14 @@ .PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ check-local clean clean-binPROGRAMS clean-checkPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ clean-sbinPROGRAMS ctags dist dist-all dist-bzip2 dist-gzip \ dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ distclean distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ + distuninstallcheck dvi dvi-am html html-am html-local info \ + info-am install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man \ @@ -2654,113 +4301,371 @@ uninstall-pkgconfigDATA uninstall-sbinPROGRAMS +benchmark-test: benchmark/blobslap_client benchmark/blobslap_worker gearmand/gearmand + @echo Running benchmarking tool, this may take a couple of seconds + @gearmand/gearmand --port=$(GEARMAND_BENCHMARK_PORT) --daemon --pid-file=$(GEARMAND_BE_PIDFILE) + @libtest/wait $(GEARMAND_BE_PIDFILE) + @benchmark/blobslap_worker -p $(GEARMAND_BENCHMARK_PORT) -d + @benchmark/blobslap_client -c $(BENCHMARK_COUNT) -n $(BENCHMARK_TASK_COUNT) -p $(GEARMAND_BENCHMARK_PORT) -e + cat $(GEARMAND_BE_PIDFILE) | xargs kill + +client-test: client-test-basic + +client-test-basic: $(GEARMAN_CLIENT_TEST) + @$(GEARMAN_CLIENT_TEST) -H 2>&1 > /dev/null + @$(GEARMAN_CLIENT_TEST) -w -f true -d -i $(GEARMAN_PIDFILE) -- false + @libtest/wait $(GEARMAN_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + +client-test-wc: $(GEARMAN_CLIENT_TEST) + @gearmand/gearmand --port=$(GEARMAND_PORT) --daemon --pid-file=$(GEARMAND_PIDFILE) + @echo "1" > $(GEARMAN_TMP)/test_file + @$(GEARMAN_CLIENT_TEST) -w -f wc -d -i $(GEARMAN_PIDFILE) -- wc -l + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @diff -q $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @rm $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @libtest/wait $(GEARMAN_PIDFILE) + @libtest/wait $(GEARMAND_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + @cat $(GEARMAND_PIDFILE) | xargs kill + +client-test-lp738917: $(GEARMAN_CLIENT_TEST) + @gearmand/gearmand --port=$(GEARMAND_PORT) --daemon --pid-file=$(GEARMAND_PIDFILE) + @echo "1" > $(GEARMAN_TMP)/test_file + @$(GEARMAN_CLIENT_TEST) -w -f wc -d -i $(GEARMAN_PIDFILE) -- wc -l + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @$(GEARMAN_CLIENT_TEST) -f wc < $(GEARMAN_TMP)/test_file > $(GEARMAN_TMP)/out_file + @diff -q $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @rm $(GEARMAN_TMP)/test_file $(GEARMAN_TMP)/out_file + @libtest/wait $(GEARMAN_PIDFILE) + @libtest/wait $(GEARMAND_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + @cat $(GEARMAND_PIDFILE) | xargs kill + +valgrind-client-test: $(GEARMAN_CLIENT_TEST) + @$(GEARMAN_VALGRIND_CLIENT_TEST) -H 2>&1 > /dev/null + @$(GEARMAN_CLIENT_TEST) -w -f true -d -i $(GEARMAN_PIDFILE) -- false + @libtest/wait $(GEARMAN_PIDFILE) + @cat $(GEARMAN_PIDFILE) | xargs kill + gearmand-valgrind: gearmand/gearmand $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes gearmand/gearmand gearmand-debug: gearmand/gearmand $(LIBTOOL) --mode=execute gdb gearmand/gearmand -test-client: +gearmand-test-args: gearmand/gearmand + @gearmand/gearmand --check-args + @gearmand/gearmand --backlog=10 --check-args + @gearmand/gearmand --b 10 --check-args + @gearmand/gearmand --d --check-args + @gearmand/gearmand --daemon --check-args + @gearmand/gearmand --file-descriptors=100 --check-args + @gearmand/gearmand --f 100 --check-args + @gearmand/gearmand -h --check-args + @gearmand/gearmand --help --check-args + @gearmand/gearmand -l "tmp/foo" --check-args + @gearmand/gearmand --log-file="tmp/foo" --check-args + @gearmand/gearmand --listen=10 --check-args + @gearmand/gearmand -L 10 --check-args + @gearmand/gearmand --port=10 --check-args + @gearmand/gearmand -p 10 --check-args + @gearmand/gearmand --pid-file="tmp/file.pid" --check-args + @gearmand/gearmand -P "tmp/file.pid" --check-args + @gearmand/gearmand --round-robin --check-args + @gearmand/gearmand -R --check-args + @gearmand/gearmand --pid-file="tmp/file.pid" --check-args + @gearmand/gearmand -P "tmp/file.pid" --check-args + @gearmand/gearmand --threads=10 --check-args + @gearmand/gearmand -t 10 --check-args + @gearmand/gearmand --user=nobody --check-args + @gearmand/gearmand -u nobody --check-args + @gearmand/gearmand --check-args -vvvv + @gearmand/gearmand -V --check-args + @gearmand/gearmand --version --check-args + @gearmand/gearmand -w 10 --check-args + @gearmand/gearmand --worker-wakeup=10 --check-args + @gearmand/gearmand --protocol=http --check-args + @gearmand/gearmand --queue-type=http --check-args + @gearmand/gearmand -j 10 --check-args + @gearmand/gearmand --job-retries=10 --check-args + +test-burnin: tests/burnin_test + @tests/burnin_test $(ARG1) $(ARG2) + +test-client: tests/client_test @tests/client_test $(ARG1) $(ARG2) -test-round-robin: - tests/round_robin_test $(ARG1) $(ARG2) +test-round-robin: tests/round_robin_test + @tests/round_robin_test $(ARG1) $(ARG2) -test-worker: +test-worker: tests/worker_test @tests/worker_test $(ARG1) $(ARG2) -test-internals: +test-internals: tests/internals_test @tests/internals_test $(ARG1) $(ARG2) -test-libmemcached: -@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_SETUP) -@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) -@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_TEARDOWN) +check-local: tests/var gearmand-test-args client-test libtest-tests benchmark-test -test-sqlite: -@HAVE_LIBSQLITE3_TRUE@ $(SQLITE_TEST) $(ARG1) $(ARG2) -@HAVE_LIBSQLITE3_TRUE@ $(SQLITE_RM) - -gdb-sqlite: -@HAVE_LIBSQLITE3_TRUE@ $(LIBTOOL) --mode=execute gdb tests/sqlite_test -@HAVE_LIBSQLITE3_TRUE@ $(SQLITE_RM) - -test-tokyocabinet: -@HAVE_LIBTOKYOCABINET_TRUE@ $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) -@HAVE_LIBTOKYOCABINET_TRUE@ $(TOKYOCABINET_RM) - -check-local: test-client test-round-robin test-worker test-internals test-libmemcached test-sqlite test-tokyocabinet +libtest-tests: test-client test-round-robin test-worker test-internals test-libmemcached test-sqlite test-tokyocabinet test-burnin gdb-client: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/client_test + @$(LIBTOOL) --mode=execute gdb tests/client_test gdb-round-robin: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/round_robin_test + @$(LIBTOOL) --mode=execute gdb tests/round_robin_test gdb-worker: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/worker_test + @$(LIBTOOL) --mode=execute gdb tests/worker_test gdb-internals: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/internals_test + @$(LIBTOOL) --mode=execute gdb tests/internals_test + +gdb-burnin: ${noinst_PROGRAMS} + @$(LIBTOOL) --mode=execute gdb tests/burnin_test valgrind-client: - $(VALGRIND_COMMAND) tests/client_test $(ARG1) $(ARG2) + @$(VALGRIND_COMMAND) tests/client_test $(ARG1) $(ARG2) valgrind-round-robin: - $(VALGRIND_COMMAND) tests/round_robin_test $(ARG1) $(ARG2) + @$(VALGRIND_COMMAND) tests/round_robin_test $(ARG1) $(ARG2) + +valgrind-worker: tests/worker_test + @$(VALGRIND_COMMAND) tests/worker_test $(ARG1) $(ARG2) + +valgrind-internals: tests/internals_test + @$(VALGRIND_COMMAND) tests/internals_test $(ARG1) $(ARG2) + +valgrind-burnin: tests/burnin_test + @$(VALGRIND_COMMAND) tests/burnin_test $(ARG1) $(ARG2) + +tests/var: tests/var/log tests/var/tmp + $(mkdir_p) tests/var + +tests/var/log: + $(mkdir_p) tests/var/log + +tests/var/tmp: + $(mkdir_p) tests/var/tmp + +valgrind: ${noinst_PROGRAMS} valgrind-client valgrind-round-robin valgrind-worker valgrind-internals valgrind-sqlite valgrind-tokyocabinet valgrind-burnin -valgrind-worker: - $(VALGRIND_COMMAND) tests/worker_test $(ARG1) $(ARG2) +tests-httpd-args: gearmand/gearmand + @gearmand/gearmand --http-port=80 -valgrind-internals: - $(VALGRIND_COMMAND) tests/internals_test $(ARG1) $(ARG2) +test-drizzle: test-libdrizzle-args test-drizzle-queue + +tests-libdrizzle-args: gearmand/gearmand +@HAVE_LIBDRIZZLE_TRUE@ @gearmand/gearmand --check-args --libdrizzle-host=localhost --libdrizzle-port=90 --libdrizzle-uds=tmp/foo.socket --libdrizzle-user=root --libdrizzle-password=test --libdrizzle-db=gearman --libdrizzle-table=gearman --libdrizzle-mysql + +test-drizzle-queue: gearmand/gearmand +@HAVE_LIBDRIZZLE_TRUE@ $(DRIZZLE_TEST) $(ARG1) $(ARG2) + +test-libmemcached: tests-libmemcached-args test-libmemcached-queue + +tests-libmemcached-args: gearmand/gearmand +@HAVE_LIBMEMCACHED_TRUE@ @gearmand/gearmand --check-args --queue=libmemcached --libmemcached-servers=localhost:12555 + +test-libmemcached-queue: +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_SETUP) +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_TEARDOWN) valgrind-libmemcached: - $(LIBMEMCACHED_SETUP) - $(VALGRIND_COMMAND) $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) - $(LIBMEMCACHED_TEARDOWN) +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_SETUP) +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(VALGRIND_COMMAND) $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) +@HAVE_LIBMEMCACHED_TRUE@@HAVE_MEMCACHED_TRUE@ $(LIBMEMCACHED_TEARDOWN) + +test-postgres: tests-postgres-args + +tests-postgres-args: gearmand/gearmand +@HAVE_LIBPQ_TRUE@ @gearmand/gearmand --libpq-conninfo="foo" --libpq-table="gearmand" + +test-sqlite: tests-sqlite-args test-sqlite-queue + +tests-sqlite-args: gearmand/gearmand +@HAVE_LIBSQLITE3_TRUE@ @gearmand/gearmand --check-args --libsqlite3-db=tmp/schema --libsqlite3-table=tmp/table + +sqlite-nuke: + @rm -f tests/gearman.sql + @rm -f tests/gearman.sql-journal + @rm -f tests/gearmand.log* -valgrind-sqlite: +test-sqlite-queue: sqlite-nuke +@HAVE_LIBSQLITE3_TRUE@ $(SQLITE_TEST) $(ARG1) $(ARG2) + +gdb-sqlite: sqlite-nuke +@HAVE_LIBSQLITE3_TRUE@ $(LIBTOOL) --mode=execute gdb tests/sqlite_test + +valgrind-sqlite: sqlite-nuke @HAVE_LIBSQLITE3_TRUE@ $(VALGRIND_COMMAND) $(SQLITE_TEST) $(ARG1) $(ARG2) -@HAVE_LIBSQLITE3_TRUE@ $(SQLITE_RM) + +test-tokyocabinet: test-tokyocabinet-args test-tokyocabinet-queue + +test-tokyocabinet-args: gearmand/gearmand +@HAVE_LIBTOKYOCABINET_TRUE@ @gearmand/gearmand --check-args --libtokyocabinet-file=tmp/file --libtokyocabinet-optimize + +test-tokyocabinet-queue: +@HAVE_LIBTOKYOCABINET_TRUE@ $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) +@HAVE_LIBTOKYOCABINET_TRUE@ $(TOKYOCABINET_RM) valgrind-tokyocabinet: @HAVE_LIBTOKYOCABINET_TRUE@ $(VALGRIND_COMMAND) $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) @HAVE_LIBTOKYOCABINET_TRUE@ $(TOKYOCABINET_RM) -client-test: $(GEARMAN_CLIENT_TEST) - @$(GEARMAN_CLIENT_TEST) -H 2>&1 > /dev/null - @$(GEARMAN_CLIENT_TEST) -w -f true -d -i $(GEARMAN_PIDFILE) -- false - cat $(GEARMAN_PIDFILE) | xargs kill - @echo "gearman client success" - -#valgrind: ${noinst_PROGRAMS} valgrind-client valgrind-worker valgrind-internals valgrind-sqlite valgrind-tokyocabinet +bogus: -valgrind: ${noinst_PROGRAMS} valgrind-client valgrind-round-robin valgrind-worker valgrind-internals valgrind-sqlite valgrind-tokyocabinet +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest -bogus: +@HAVE_SPHINX_TRUE@sphinx-help: +@HAVE_SPHINX_TRUE@ @echo "Please use \`make ' where is one of" +@HAVE_SPHINX_TRUE@ @echo " html to make standalone HTML files" +@HAVE_SPHINX_TRUE@ @echo " dirhtml to make HTML files named index.html in directories" +@HAVE_SPHINX_TRUE@ @echo " singlehtml to make a single large HTML file" +@HAVE_SPHINX_TRUE@ @echo " pickle to make pickle files" +@HAVE_SPHINX_TRUE@ @echo " json to make JSON files" +@HAVE_SPHINX_TRUE@ @echo " htmlhelp to make HTML files and a HTML help project" +@HAVE_SPHINX_TRUE@ @echo " qthelp to make HTML files and a qthelp project" +@HAVE_SPHINX_TRUE@ @echo " devhelp to make HTML files and a Devhelp project" +@HAVE_SPHINX_TRUE@ @echo " epub to make an epub" +@HAVE_SPHINX_TRUE@ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" +@HAVE_SPHINX_TRUE@ @echo " latexpdf to make LaTeX files and run them through pdflatex" +@HAVE_SPHINX_TRUE@ @echo " text to make text files" +@HAVE_SPHINX_TRUE@ @echo " man to make manual pages" +@HAVE_SPHINX_TRUE@ @echo " changes to make an overview of all changed/added/deprecated items" +@HAVE_SPHINX_TRUE@ @echo " linkcheck to check all external links for integrity" +@HAVE_SPHINX_TRUE@ @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +@HAVE_SPHINX_TRUE@html-local: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/html +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished. The HTML pages are in $(SPHINX_BUILDDIR)/html." + +@HAVE_SPHINX_TRUE@dirhtml: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/dirhtml +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished. The HTML pages are in $(SPHINX_BUILDDIR)/dirhtml." + +@HAVE_SPHINX_TRUE@singlehtml: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/singlehtml +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished. The HTML page is in $(SPHINX_BUILDDIR)/singlehtml." + +@HAVE_SPHINX_TRUE@pickle: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/pickle +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished; now you can process the pickle files." + +@HAVE_SPHINX_TRUE@json: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/json +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished; now you can process the JSON files." + +@HAVE_SPHINX_TRUE@htmlhelp: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/htmlhelp +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished; now you can run HTML Help Workshop with the" \ +@HAVE_SPHINX_TRUE@ ".hhp project file in $(SPHINX_BUILDDIR)/htmlhelp." + +@HAVE_SPHINX_TRUE@qthelp: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/qthelp +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished; now you can run "qcollectiongenerator" with the" \ +@HAVE_SPHINX_TRUE@ ".qhcp project file in $(SPHINX_BUILDDIR)/qthelp, like this:" +@HAVE_SPHINX_TRUE@ @echo "# qcollectiongenerator $(SPHINX_BUILDDIR)/qthelp/Libmemcached.qhcp" +@HAVE_SPHINX_TRUE@ @echo "To view the help file:" +@HAVE_SPHINX_TRUE@ @echo "# assistant -collectionFile $(SPHINX_BUILDDIR)/qthelp/Libmemcached.qhc" + +@HAVE_SPHINX_TRUE@devhelp: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/devhelp +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished." +@HAVE_SPHINX_TRUE@ @echo "To view the help file:" +@HAVE_SPHINX_TRUE@ @echo "# mkdir -p $$HOME/.local/share/devhelp/Libmemcached" +@HAVE_SPHINX_TRUE@ @echo "# ln -s $(SPHINX_BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Libmemcached" +@HAVE_SPHINX_TRUE@ @echo "# devhelp" + +@HAVE_SPHINX_TRUE@epub: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/epub +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished. The epub file is in $(SPHINX_BUILDDIR)/epub." + +@HAVE_SPHINX_TRUE@latex: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished; the LaTeX files are in $(SPHINX_BUILDDIR)/latex." +@HAVE_SPHINX_TRUE@ @echo "Run \`make' in that directory to run these through (pdf)latex" \ +@HAVE_SPHINX_TRUE@ "(use \`make latexpdf' here to do that automatically)." + +@HAVE_SPHINX_TRUE@latexpdf: latex +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex +@HAVE_SPHINX_TRUE@ @echo "Running LaTeX files through pdflatex..." +@HAVE_SPHINX_TRUE@ make -C $(SPHINX_BUILDDIR)/latex all-pdf +@HAVE_SPHINX_TRUE@ @echo "pdflatex finished; the PDF files are in $(SPHINX_BUILDDIR)/latex." + +@HAVE_SPHINX_TRUE@text: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/text +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished. The text files are in $(SPHINX_BUILDDIR)/text." + +@HAVE_SPHINX_TRUE@man: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/man +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Build finished. The manual pages are in $(SPHINX_BUILDDIR)/man." + +@HAVE_SPHINX_TRUE@changes: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/changes +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "The overview file is in $(SPHINX_BUILDDIR)/changes." + +@HAVE_SPHINX_TRUE@linkcheck: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/linkcheck +@HAVE_SPHINX_TRUE@ @echo +@HAVE_SPHINX_TRUE@ @echo "Link check complete; look for any errors in the above output " \ +@HAVE_SPHINX_TRUE@ "or in $(SPHINX_BUILDDIR)/linkcheck/output.txt." + +@HAVE_SPHINX_TRUE@doctest: docs/conf.py +@HAVE_SPHINX_TRUE@ PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/doctest +@HAVE_SPHINX_TRUE@ @echo "Testing of doctests in the sources finished, look at the " \ +@HAVE_SPHINX_TRUE@ "results in $(SPHINX_BUILDDIR)/doctest/output.txt." -# Shorthand -unit: check-TESTS - support/gearmand.pc - -docs: all - ${DOXYGEN} docs/Doxyfile.api - ${DOXYGEN} docs/Doxyfile.dev +docs: html man test: check -rpm: all dist - cp gearmand-$(VERSION).tar.gz ~/rpmbuild/SOURCES/ - rpmbuild -ba support/gearmand.spec - cp ~/rpmbuild/RPMS/x86_64/gearmand-$(VERSION)*.rpm . - cp ~/rpmbuild/SRPMS/gearmand-$(VERSION)*.rpm . +clean-local: + -rm -rf docs/_build docs/doctrees + +rpm-build: support/gearmand.spec + @rm -f ~/rpmbuild/RPMS/x86_64/gearmand-$(VERSION)*.rpm + @rm -f ~/rpmbuild/SRPMS/gearmand-$(VERSION)*.rpm + @cp gearmand-$(VERSION).tar.gz ~/rpmbuild/SOURCES/ + @cp support/gearmand.init ~/rpmbuild/SOURCES/ + @rpmbuild -ba support/gearmand.spec + @cp ~/rpmbuild/RPMS/x86_64/gearmand-$(VERSION)*.rpm . + @cp ~/rpmbuild/RPMS/x86_64/gearmand-devel-$(VERSION)*.rpm . + @cp ~/rpmbuild/RPMS/x86_64/gearmand-debuginfo-$(VERSION)*.rpm . + @cp ~/rpmbuild/RPMS/x86_64/gearmand-server-$(VERSION)*.rpm . + @cp ~/rpmbuild/SRPMS/gearmand-$(VERSION)*.rpm . + +rpm-sign: rpm-build + @rpm --addsign gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm + @rpm --checksig gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm + +rpm: man distcheck rpm-build + +release: rpm rpm-sign + @rpm --addsign gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm + @rpm --checksig gearmand-$(VERSION)*.rpm gearmand-devel-$(VERSION)*.rpm gearmand-debuginfo-$(VERSION)*.rpm gearmand-server-$(VERSION)*.rpm merge-clean: - find ./ | $(GREP) \.orig | xargs rm -f - find ./ | $(GREP) \.rej | xargs rm -f - find ./ | $(GREP) \~$$ | xargs rm -f - bzr unknowns + @find ./ | $(GREP) \.moved | xargs rm -r -f + @find ./ | $(GREP) \.orig | xargs rm -f + @find ./ | $(GREP) \.rej | xargs rm -f + @find ./ | $(GREP) \~$$ | xargs rm -f + @echo "The follow files need to be removed or checked in:" + @bzr unknowns # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru gearmand-0.14/README gearmand-0.23/README --- gearmand-0.14/README 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/README 2011-06-17 08:47:09.000000000 +0200 @@ -1,21 +1,3 @@ -# Gearman server and library -# Copyright (C) 2008 Brian Aker, Eric Day -# All rights reserved. -# -# Use and distribution licensed under the BSD license. See -# the COPYING file in this directory for full text. - - -*** IMPORTANT *** - -Since release 0.3, the default port has been changed to the new IANA -assigned port, 4730. If you are using this package with older clients, -workers, or job servers that ran on port 7003, be sure to set port -options appropriately! - -*** IMPORTANT *** - - Hi! You've most likely downloaded this package as a tar.gz distribution, @@ -60,7 +42,7 @@ If you want to start writing your own client and workers, be sure to check out the developer API at: -http://www.gearman.org/docs/api/ +http://gearman.info/libgearman.html You can also find other useful resources related to the project at: @@ -99,45 +81,8 @@ https://help.launchpad.net/ -Coding Style ------------- - -Variables during assignment should be like: -a= 12; - -When in doubt, use (). It means I clearly know that you meant for an -operation to follow a specific order. - -Cast return types void when there is a possibility of failure (don't -bother with printf, use common sense): - -(void)some_function(...); - -New functions should be named "object_verb_(item_to_act_on)". You -should email the list if you are extending the API. - -Use spaces after while, for, do, if, else. Don't around anything else. - -If/else bracket style is: -if () -{ -} -else -{ -} - -Make sure structs have a typedef with a _st suffix, enums have a _t -suffix, and functions have a _fn suffix. For example: - -typedef struct gearman_task { ... } gearman_task_st; -typedef enum gearman_return { ... } gearman_return_t; -typedef gearman_return_t (gearman_complete_fn)(gearman_task_st *task); - Thanks and keep hacking! Cheers, -Brian Seattle, WA. - - -Eric - Portland, OR diff -Nru gearmand-0.14/support/gearmand.init gearmand-0.23/support/gearmand.init --- gearmand-0.14/support/gearmand.init 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/support/gearmand.init 2011-06-20 05:31:42.000000000 +0200 @@ -0,0 +1,81 @@ +#!/bin/bash +# +# gearmand Startup script for the Gearman server +# +# chkconfig: - 85 15 +# description: Gearman is a distributed job system. +# processname: gearmand +# config: /etc/sysconfig/gearmand +# pidfile: /var/run/gearmand/gearmand.pid +# +### BEGIN INIT INFO +# Provides: gearmand +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: +# Default-Stop: +# Short-Description: start and stop the Gearman server +# Description: Gearman is a distributed job system. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +if [ -f /etc/sysconfig/gearmand ]; then + . /etc/sysconfig/gearmand +fi + +[ -z "${PIDFILE}" ] && pidfile="/var/run/gearmand/gearmand.pid" +[ -z "${LOCKFILE}" ] && lockfile="/var/lock/subsys/gearmand" + +gearmand=/usr/sbin/gearmand +prog=gearmand + +RETVAL=0 + +start() { + echo -n $"Starting $prog: " + daemon --pidfile=$pidfile --user=gearmand $gearmand -d $OPTIONS + RETVAL=$? + echo + [ $RETVAL = 0 ] && (touch $lockfile; pgrep -f $gearmand > $pidfile) + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pidfile $gearmand + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f $lockfile $pidfile +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p $pidfile $gearmand + RETVAL=$? + ;; + restart|reload) + stop + start + ;; + condrestart|try-restart) + if status -p $pidfile $gearmand >&/dev/null; then + stop + start + fi + ;; + *) + echo $"Usage: $prog {start|stop|restart|reload|condrestart|status|help}" + RETVAL=3 +esac + +exit $RETVAL + diff -Nru gearmand-0.14/support/gearmand.pc gearmand-0.23/support/gearmand.pc --- gearmand-0.14/support/gearmand.pc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/support/gearmand.pc 2011-06-29 23:00:13.000000000 +0200 @@ -0,0 +1,10 @@ +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: gearmand +Description: Gearman Server and C Library +Version: 0.23 +Libs: -L${libdir} -lgearman +Cflags: -I${includedir} diff -Nru gearmand-0.14/support/gearmand.spec gearmand-0.23/support/gearmand.spec --- gearmand-0.14/support/gearmand.spec 2010-06-30 20:31:42.000000000 +0200 +++ gearmand-0.23/support/gearmand.spec 2011-06-29 23:00:13.000000000 +0200 @@ -1,24 +1,49 @@ Summary: Gearman Server and C Library Name: gearmand -Version: 0.14 +Version: 0.23 Release: 1 License: BSD Group: System Environment/Libraries BuildRequires: gcc-c++ -URL: http://www.gearman.org/ +URL: http://launchpad.net/gearmand +Requires: sqlite, libevent >= 1.4, boost-program-options >= 1.39 Packager: Brian Aker Source: http://launchpad.net/gearmand/trunk/%{version}/+download/gearmand-%{version}.tar.gz +Source1: gearmand.init BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot %description Gearman provides a generic framework to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance processing, or to call functions between languages. +This package provides the client utilities. + +%package server +Summary: Gearmand Server +Group: Applications/Databases +Requires: sqlite, libevent >= 1.4, boost-program-options >= 1.39 + +%description server +Gearman provides a generic framework to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance processing, or to call functions between languages. + +This package provides the Gearmand Server. + +%package devel +Summary: Header files and development libraries for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains the header files and development libraries +for %{name}. If you like to develop programs using %{name}, +you will need to install %{name}-devel. + %prep %setup -q -%configure +%configure --disable-libpq --disable-libtokyocabinet --disable-libdrizzle --disable-libmemcached + %build %{__make} %{_smp_mflags} @@ -26,34 +51,103 @@ %install %{__rm} -rf %{buildroot} %{__make} install DESTDIR="%{buildroot}" AM_INSTALL_PROGRAM_FLAGS="" +mkdir -p $RPM_BUILD_ROOT/ +mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +mkdir -p $RPM_BUILD_ROOT/var/log/gearmand +mkdir -p $RPM_BUILD_ROOT/var/run/gearmand +install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/gearmand %clean %{__rm} -rf %{buildroot} +%pre server +if ! /usr/bin/id -g gearmand &>/dev/null; then + /usr/sbin/groupadd -r gearmand +fi +if ! /usr/bin/id gearmand &>/dev/null; then + /usr/sbin/useradd -M -r -g gearmand -d /var/lib/gearmand -s /bin/false \ + -c "Gearman Server" gearmand > /dev/null 2>&1 +fi + +%post server +if test $1 = 1 +then + /sbin/chkconfig --add gearmand +fi + +%preun server +if test $1 = 0 +then + /sbin/chkconfig --del gearmand +fi + +%postun server +if test $1 -ge 1 +then + /sbin/service gearmand condrestart >/dev/null 2>&1 || : +fi + %files +%defattr(-,root,root,-) +%doc AUTHORS COPYING NEWS README HACKING THANKS +%{_bindir}/gearadmin %{_bindir}/gearman +%{_libdir}/libgearman.la +%{_libdir}/libgearman.so.6 +%{_libdir}/libgearman.so.6.0.0 +%{_mandir}/man1/gearadmin.1.gz +%{_mandir}/man1/gearman.1.gz + +%files server +%defattr(-,root,root,-) +%doc AUTHORS COPYING NEWS README HACKING THANKS +%{_mandir}/man8/gearmand.8.gz %{_sbindir}/gearmand -%{_includedir}/libgearman/configure.h +/etc/rc.d/init.d/gearmand +%attr(0755,gearmand,gearmand) %dir /var/log/gearmand +%attr(0755,gearmand,gearmand) %dir /var/run/gearmand + +%files devel +%defattr(-,root,root,-) +%doc AUTHORS COPYING NEWS README HACKING THANKS +%{_includedir}/libgearman/actions.h +%{_includedir}/libgearman/aggregator.h +%{_includedir}/libgearman/allocator.h +%{_includedir}/libgearman/argument.h %{_includedir}/libgearman/byteorder.h %{_includedir}/libgearman/client.h +%{_includedir}/libgearman/client_callbacks.h %{_includedir}/libgearman/command.h +%{_includedir}/libgearman/configure.h %{_includedir}/libgearman/connection.h %{_includedir}/libgearman/constants.h %{_includedir}/libgearman/core.h +%{_includedir}/libgearman/execute.h +%{_includedir}/libgearman/function.h %{_includedir}/libgearman/gearman.h %{_includedir}/libgearman/job.h +%{_includedir}/libgearman/job_handle.h %{_includedir}/libgearman/log.h %{_includedir}/libgearman/packet.h +%{_includedir}/libgearman/parse.h +%{_includedir}/libgearman/priority.h +%{_includedir}/libgearman/protocol.h +%{_includedir}/libgearman/result.h +%{_includedir}/libgearman/return.h %{_includedir}/libgearman/strerror.h +%{_includedir}/libgearman/string.h %{_includedir}/libgearman/task.h +%{_includedir}/libgearman/task_attr.h %{_includedir}/libgearman/universal.h +%{_includedir}/libgearman/version.h %{_includedir}/libgearman/visibility.h %{_includedir}/libgearman/worker.h -%{_libdir}/libgearman.la -%{_libdir}/libgearman.so -%{_libdir}/libgearman.so.* %{_libdir}/pkgconfig/gearmand.pc -%{_mandir}/man1/gearman.1.gz +%{_libdir}/libgearman.so +%{_mandir}/man3/gearman_actions_t.3.gz +%{_mandir}/man3/gearman_allocator_t.3.gz +%{_mandir}/man3/gearman_argument_make.3.gz +%{_mandir}/man3/gearman_argument_t.3.gz %{_mandir}/man3/gearman_bugreport.3.gz %{_mandir}/man3/gearman_client_add_options.3.gz %{_mandir}/man3/gearman_client_add_server.3.gz @@ -81,8 +175,10 @@ %{_mandir}/man3/gearman_client_errno.3.gz %{_mandir}/man3/gearman_client_error.3.gz %{_mandir}/man3/gearman_client_free.3.gz +%{_mandir}/man3/gearman_client_has_option.3.gz %{_mandir}/man3/gearman_client_job_status.3.gz %{_mandir}/man3/gearman_client_options.3.gz +%{_mandir}/man3/gearman_client_options_t.3.gz %{_mandir}/man3/gearman_client_remove_options.3.gz %{_mandir}/man3/gearman_client_remove_servers.3.gz %{_mandir}/man3/gearman_client_run_tasks.3.gz @@ -93,6 +189,8 @@ %{_mandir}/man3/gearman_client_set_exception_fn.3.gz %{_mandir}/man3/gearman_client_set_fail_fn.3.gz %{_mandir}/man3/gearman_client_set_log_fn.3.gz +%{_mandir}/man3/gearman_client_set_memory_allocators.3.gz +%{_mandir}/man3/gearman_client_set_namespace.3.gz %{_mandir}/man3/gearman_client_set_options.3.gz %{_mandir}/man3/gearman_client_set_status_fn.3.gz %{_mandir}/man3/gearman_client_set_task_context_free_fn.3.gz @@ -101,28 +199,52 @@ %{_mandir}/man3/gearman_client_set_workload_fn.3.gz %{_mandir}/man3/gearman_client_set_workload_free_fn.3.gz %{_mandir}/man3/gearman_client_set_workload_malloc_fn.3.gz +%{_mandir}/man3/gearman_client_st.3.gz %{_mandir}/man3/gearman_client_task_free_all.3.gz %{_mandir}/man3/gearman_client_timeout.3.gz %{_mandir}/man3/gearman_client_wait.3.gz +%{_mandir}/man3/gearman_continue.3.gz +%{_mandir}/man3/gearman_execute.3.gz +%{_mandir}/man3/gearman_failed.3.gz %{_mandir}/man3/gearman_job_free.3.gz %{_mandir}/man3/gearman_job_free_all.3.gz %{_mandir}/man3/gearman_job_function_name.3.gz %{_mandir}/man3/gearman_job_handle.3.gz +%{_mandir}/man3/gearman_job_handle_t.3.gz %{_mandir}/man3/gearman_job_send_complete.3.gz %{_mandir}/man3/gearman_job_send_data.3.gz %{_mandir}/man3/gearman_job_send_exception.3.gz %{_mandir}/man3/gearman_job_send_fail.3.gz %{_mandir}/man3/gearman_job_send_status.3.gz %{_mandir}/man3/gearman_job_send_warning.3.gz +%{_mandir}/man3/gearman_job_st.3.gz %{_mandir}/man3/gearman_job_take_workload.3.gz %{_mandir}/man3/gearman_job_unique.3.gz %{_mandir}/man3/gearman_job_workload.3.gz %{_mandir}/man3/gearman_job_workload_size.3.gz +%{_mandir}/man3/gearman_log_fn.3.gz %{_mandir}/man3/gearman_parse_servers.3.gz +%{_mandir}/man3/gearman_result_boolean.3.gz +%{_mandir}/man3/gearman_result_integer.3.gz +%{_mandir}/man3/gearman_result_is_null.3.gz +%{_mandir}/man3/gearman_result_size.3.gz +%{_mandir}/man3/gearman_result_store_integer.3.gz +%{_mandir}/man3/gearman_result_store_string.3.gz +%{_mandir}/man3/gearman_result_store_value.3.gz +%{_mandir}/man3/gearman_result_string.3.gz +%{_mandir}/man3/gearman_return_t.3.gz +%{_mandir}/man3/gearman_strerror.3.gz +%{_mandir}/man3/gearman_string_t.3.gz +%{_mandir}/man3/gearman_success.3.gz +%{_mandir}/man3/gearman_task_attr_init.3.gz +%{_mandir}/man3/gearman_task_attr_init_background.3.gz +%{_mandir}/man3/gearman_task_attr_init_epoch.3.gz +%{_mandir}/man3/gearman_task_attr_t.3.gz %{_mandir}/man3/gearman_task_context.3.gz %{_mandir}/man3/gearman_task_data.3.gz %{_mandir}/man3/gearman_task_data_size.3.gz %{_mandir}/man3/gearman_task_denominator.3.gz +%{_mandir}/man3/gearman_task_error.3.gz %{_mandir}/man3/gearman_task_free.3.gz %{_mandir}/man3/gearman_task_function_name.3.gz %{_mandir}/man3/gearman_task_give_workload.3.gz @@ -131,11 +253,14 @@ %{_mandir}/man3/gearman_task_job_handle.3.gz %{_mandir}/man3/gearman_task_numerator.3.gz %{_mandir}/man3/gearman_task_recv_data.3.gz +%{_mandir}/man3/gearman_task_return.3.gz %{_mandir}/man3/gearman_task_send_workload.3.gz %{_mandir}/man3/gearman_task_set_context.3.gz +%{_mandir}/man3/gearman_task_st.3.gz %{_mandir}/man3/gearman_task_take_data.3.gz %{_mandir}/man3/gearman_task_unique.3.gz %{_mandir}/man3/gearman_verbose_name.3.gz +%{_mandir}/man3/gearman_verbose_t.3.gz %{_mandir}/man3/gearman_version.3.gz %{_mandir}/man3/gearman_worker_add_function.3.gz %{_mandir}/man3/gearman_worker_add_options.3.gz @@ -144,6 +269,7 @@ %{_mandir}/man3/gearman_worker_clone.3.gz %{_mandir}/man3/gearman_worker_context.3.gz %{_mandir}/man3/gearman_worker_create.3.gz +%{_mandir}/man3/gearman_worker_define_function.3.gz %{_mandir}/man3/gearman_worker_echo.3.gz %{_mandir}/man3/gearman_worker_errno.3.gz %{_mandir}/man3/gearman_worker_error.3.gz @@ -156,16 +282,19 @@ %{_mandir}/man3/gearman_worker_remove_servers.3.gz %{_mandir}/man3/gearman_worker_set_context.3.gz %{_mandir}/man3/gearman_worker_set_log_fn.3.gz +%{_mandir}/man3/gearman_worker_set_memory_allocators.3.gz +%{_mandir}/man3/gearman_worker_set_namespace.3.gz %{_mandir}/man3/gearman_worker_set_options.3.gz %{_mandir}/man3/gearman_worker_set_timeout.3.gz %{_mandir}/man3/gearman_worker_set_workload_free_fn.3.gz %{_mandir}/man3/gearman_worker_set_workload_malloc_fn.3.gz +%{_mandir}/man3/gearman_worker_st.3.gz %{_mandir}/man3/gearman_worker_timeout.3.gz %{_mandir}/man3/gearman_worker_unregister.3.gz %{_mandir}/man3/gearman_worker_unregister_all.3.gz %{_mandir}/man3/gearman_worker_wait.3.gz %{_mandir}/man3/gearman_worker_work.3.gz -%{_mandir}/man8/gearmand.8.gz +%{_mandir}/man3/libgearman.3.gz %changelog diff -Nru gearmand-0.14/support/gearmand.spec.in gearmand-0.23/support/gearmand.spec.in --- gearmand-0.14/support/gearmand.spec.in 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/support/gearmand.spec.in 2011-06-29 22:18:02.000000000 +0200 @@ -5,20 +5,45 @@ License: BSD Group: System Environment/Libraries BuildRequires: gcc-c++ -URL: http://www.gearman.org/ +URL: http://launchpad.net/gearmand +Requires: sqlite, libevent >= 1.4, boost-program-options >= 1.39 Packager: Brian Aker Source: http://launchpad.net/gearmand/trunk/%{version}/+download/gearmand-%{version}.tar.gz +Source1: gearmand.init BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot %description Gearman provides a generic framework to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance processing, or to call functions between languages. +This package provides the client utilities. + +%package server +Summary: Gearmand Server +Group: Applications/Databases +Requires: sqlite, libevent >= 1.4, boost-program-options >= 1.39 + +%description server +Gearman provides a generic framework to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance processing, or to call functions between languages. + +This package provides the Gearmand Server. + +%package devel +Summary: Header files and development libraries for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains the header files and development libraries +for %{name}. If you like to develop programs using %{name}, +you will need to install %{name}-devel. + %prep %setup -q -%configure +%configure --disable-libpq --disable-libtokyocabinet --disable-libdrizzle --disable-libmemcached + %build %{__make} %{_smp_mflags} @@ -26,34 +51,103 @@ %install %{__rm} -rf %{buildroot} %{__make} install DESTDIR="%{buildroot}" AM_INSTALL_PROGRAM_FLAGS="" +mkdir -p $RPM_BUILD_ROOT/ +mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +mkdir -p $RPM_BUILD_ROOT/var/log/gearmand +mkdir -p $RPM_BUILD_ROOT/var/run/gearmand +install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/gearmand %clean %{__rm} -rf %{buildroot} +%pre server +if ! /usr/bin/id -g gearmand &>/dev/null; then + /usr/sbin/groupadd -r gearmand +fi +if ! /usr/bin/id gearmand &>/dev/null; then + /usr/sbin/useradd -M -r -g gearmand -d /var/lib/gearmand -s /bin/false \ + -c "Gearman Server" gearmand > /dev/null 2>&1 +fi + +%post server +if test $1 = 1 +then + /sbin/chkconfig --add gearmand +fi + +%preun server +if test $1 = 0 +then + /sbin/chkconfig --del gearmand +fi + +%postun server +if test $1 -ge 1 +then + /sbin/service gearmand condrestart >/dev/null 2>&1 || : +fi + %files +%defattr(-,root,root,-) +%doc AUTHORS COPYING NEWS README HACKING THANKS +%{_bindir}/gearadmin %{_bindir}/gearman +%{_libdir}/libgearman.la +%{_libdir}/libgearman.so.6 +%{_libdir}/libgearman.so.6.0.0 +%{_mandir}/man1/gearadmin.1.gz +%{_mandir}/man1/gearman.1.gz + +%files server +%defattr(-,root,root,-) +%doc AUTHORS COPYING NEWS README HACKING THANKS +%{_mandir}/man8/gearmand.8.gz %{_sbindir}/gearmand -%{_includedir}/libgearman/configure.h +/etc/rc.d/init.d/gearmand +%attr(0755,gearmand,gearmand) %dir /var/log/gearmand +%attr(0755,gearmand,gearmand) %dir /var/run/gearmand + +%files devel +%defattr(-,root,root,-) +%doc AUTHORS COPYING NEWS README HACKING THANKS +%{_includedir}/libgearman/actions.h +%{_includedir}/libgearman/aggregator.h +%{_includedir}/libgearman/allocator.h +%{_includedir}/libgearman/argument.h %{_includedir}/libgearman/byteorder.h %{_includedir}/libgearman/client.h +%{_includedir}/libgearman/client_callbacks.h %{_includedir}/libgearman/command.h +%{_includedir}/libgearman/configure.h %{_includedir}/libgearman/connection.h %{_includedir}/libgearman/constants.h %{_includedir}/libgearman/core.h +%{_includedir}/libgearman/execute.h +%{_includedir}/libgearman/function.h %{_includedir}/libgearman/gearman.h %{_includedir}/libgearman/job.h +%{_includedir}/libgearman/job_handle.h %{_includedir}/libgearman/log.h %{_includedir}/libgearman/packet.h +%{_includedir}/libgearman/parse.h +%{_includedir}/libgearman/priority.h +%{_includedir}/libgearman/protocol.h +%{_includedir}/libgearman/result.h +%{_includedir}/libgearman/return.h %{_includedir}/libgearman/strerror.h +%{_includedir}/libgearman/string.h %{_includedir}/libgearman/task.h +%{_includedir}/libgearman/task_attr.h %{_includedir}/libgearman/universal.h +%{_includedir}/libgearman/version.h %{_includedir}/libgearman/visibility.h %{_includedir}/libgearman/worker.h -%{_libdir}/libgearman.la -%{_libdir}/libgearman.so -%{_libdir}/libgearman.so.* %{_libdir}/pkgconfig/gearmand.pc -%{_mandir}/man1/gearman.1.gz +%{_libdir}/libgearman.so +%{_mandir}/man3/gearman_actions_t.3.gz +%{_mandir}/man3/gearman_allocator_t.3.gz +%{_mandir}/man3/gearman_argument_make.3.gz +%{_mandir}/man3/gearman_argument_t.3.gz %{_mandir}/man3/gearman_bugreport.3.gz %{_mandir}/man3/gearman_client_add_options.3.gz %{_mandir}/man3/gearman_client_add_server.3.gz @@ -81,8 +175,10 @@ %{_mandir}/man3/gearman_client_errno.3.gz %{_mandir}/man3/gearman_client_error.3.gz %{_mandir}/man3/gearman_client_free.3.gz +%{_mandir}/man3/gearman_client_has_option.3.gz %{_mandir}/man3/gearman_client_job_status.3.gz %{_mandir}/man3/gearman_client_options.3.gz +%{_mandir}/man3/gearman_client_options_t.3.gz %{_mandir}/man3/gearman_client_remove_options.3.gz %{_mandir}/man3/gearman_client_remove_servers.3.gz %{_mandir}/man3/gearman_client_run_tasks.3.gz @@ -93,6 +189,8 @@ %{_mandir}/man3/gearman_client_set_exception_fn.3.gz %{_mandir}/man3/gearman_client_set_fail_fn.3.gz %{_mandir}/man3/gearman_client_set_log_fn.3.gz +%{_mandir}/man3/gearman_client_set_memory_allocators.3.gz +%{_mandir}/man3/gearman_client_set_namespace.3.gz %{_mandir}/man3/gearman_client_set_options.3.gz %{_mandir}/man3/gearman_client_set_status_fn.3.gz %{_mandir}/man3/gearman_client_set_task_context_free_fn.3.gz @@ -101,28 +199,52 @@ %{_mandir}/man3/gearman_client_set_workload_fn.3.gz %{_mandir}/man3/gearman_client_set_workload_free_fn.3.gz %{_mandir}/man3/gearman_client_set_workload_malloc_fn.3.gz +%{_mandir}/man3/gearman_client_st.3.gz %{_mandir}/man3/gearman_client_task_free_all.3.gz %{_mandir}/man3/gearman_client_timeout.3.gz %{_mandir}/man3/gearman_client_wait.3.gz +%{_mandir}/man3/gearman_continue.3.gz +%{_mandir}/man3/gearman_execute.3.gz +%{_mandir}/man3/gearman_failed.3.gz %{_mandir}/man3/gearman_job_free.3.gz %{_mandir}/man3/gearman_job_free_all.3.gz %{_mandir}/man3/gearman_job_function_name.3.gz %{_mandir}/man3/gearman_job_handle.3.gz +%{_mandir}/man3/gearman_job_handle_t.3.gz %{_mandir}/man3/gearman_job_send_complete.3.gz %{_mandir}/man3/gearman_job_send_data.3.gz %{_mandir}/man3/gearman_job_send_exception.3.gz %{_mandir}/man3/gearman_job_send_fail.3.gz %{_mandir}/man3/gearman_job_send_status.3.gz %{_mandir}/man3/gearman_job_send_warning.3.gz +%{_mandir}/man3/gearman_job_st.3.gz %{_mandir}/man3/gearman_job_take_workload.3.gz %{_mandir}/man3/gearman_job_unique.3.gz %{_mandir}/man3/gearman_job_workload.3.gz %{_mandir}/man3/gearman_job_workload_size.3.gz +%{_mandir}/man3/gearman_log_fn.3.gz %{_mandir}/man3/gearman_parse_servers.3.gz +%{_mandir}/man3/gearman_result_boolean.3.gz +%{_mandir}/man3/gearman_result_integer.3.gz +%{_mandir}/man3/gearman_result_is_null.3.gz +%{_mandir}/man3/gearman_result_size.3.gz +%{_mandir}/man3/gearman_result_store_integer.3.gz +%{_mandir}/man3/gearman_result_store_string.3.gz +%{_mandir}/man3/gearman_result_store_value.3.gz +%{_mandir}/man3/gearman_result_string.3.gz +%{_mandir}/man3/gearman_return_t.3.gz +%{_mandir}/man3/gearman_strerror.3.gz +%{_mandir}/man3/gearman_string_t.3.gz +%{_mandir}/man3/gearman_success.3.gz +%{_mandir}/man3/gearman_task_attr_init.3.gz +%{_mandir}/man3/gearman_task_attr_init_background.3.gz +%{_mandir}/man3/gearman_task_attr_init_epoch.3.gz +%{_mandir}/man3/gearman_task_attr_t.3.gz %{_mandir}/man3/gearman_task_context.3.gz %{_mandir}/man3/gearman_task_data.3.gz %{_mandir}/man3/gearman_task_data_size.3.gz %{_mandir}/man3/gearman_task_denominator.3.gz +%{_mandir}/man3/gearman_task_error.3.gz %{_mandir}/man3/gearman_task_free.3.gz %{_mandir}/man3/gearman_task_function_name.3.gz %{_mandir}/man3/gearman_task_give_workload.3.gz @@ -131,11 +253,14 @@ %{_mandir}/man3/gearman_task_job_handle.3.gz %{_mandir}/man3/gearman_task_numerator.3.gz %{_mandir}/man3/gearman_task_recv_data.3.gz +%{_mandir}/man3/gearman_task_return.3.gz %{_mandir}/man3/gearman_task_send_workload.3.gz %{_mandir}/man3/gearman_task_set_context.3.gz +%{_mandir}/man3/gearman_task_st.3.gz %{_mandir}/man3/gearman_task_take_data.3.gz %{_mandir}/man3/gearman_task_unique.3.gz %{_mandir}/man3/gearman_verbose_name.3.gz +%{_mandir}/man3/gearman_verbose_t.3.gz %{_mandir}/man3/gearman_version.3.gz %{_mandir}/man3/gearman_worker_add_function.3.gz %{_mandir}/man3/gearman_worker_add_options.3.gz @@ -144,6 +269,7 @@ %{_mandir}/man3/gearman_worker_clone.3.gz %{_mandir}/man3/gearman_worker_context.3.gz %{_mandir}/man3/gearman_worker_create.3.gz +%{_mandir}/man3/gearman_worker_define_function.3.gz %{_mandir}/man3/gearman_worker_echo.3.gz %{_mandir}/man3/gearman_worker_errno.3.gz %{_mandir}/man3/gearman_worker_error.3.gz @@ -156,16 +282,19 @@ %{_mandir}/man3/gearman_worker_remove_servers.3.gz %{_mandir}/man3/gearman_worker_set_context.3.gz %{_mandir}/man3/gearman_worker_set_log_fn.3.gz +%{_mandir}/man3/gearman_worker_set_memory_allocators.3.gz +%{_mandir}/man3/gearman_worker_set_namespace.3.gz %{_mandir}/man3/gearman_worker_set_options.3.gz %{_mandir}/man3/gearman_worker_set_timeout.3.gz %{_mandir}/man3/gearman_worker_set_workload_free_fn.3.gz %{_mandir}/man3/gearman_worker_set_workload_malloc_fn.3.gz +%{_mandir}/man3/gearman_worker_st.3.gz %{_mandir}/man3/gearman_worker_timeout.3.gz %{_mandir}/man3/gearman_worker_unregister.3.gz %{_mandir}/man3/gearman_worker_unregister_all.3.gz %{_mandir}/man3/gearman_worker_wait.3.gz %{_mandir}/man3/gearman_worker_work.3.gz -%{_mandir}/man8/gearmand.8.gz +%{_mandir}/man3/libgearman.3.gz %changelog diff -Nru gearmand-0.14/support/include.am gearmand-0.23/support/include.am --- gearmand-0.14/support/include.am 2010-06-30 03:31:05.000000000 +0200 +++ gearmand-0.23/support/include.am 2011-06-20 05:31:42.000000000 +0200 @@ -3,8 +3,9 @@ # All paths should be given relative to the root EXTRA_DIST += \ + support/gearmand.init \ + support/gearmand.pc \ support/gearmand.spec - support/gearmand.pc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = support/gearmand.pc diff -Nru gearmand-0.14/tests/basic.cc gearmand-0.23/tests/basic.cc --- gearmand-0.14/tests/basic.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/basic.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,272 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +#include + +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif +pthread_mutex_t counter_lock= PTHREAD_MUTEX_INITIALIZER; + +/* Counter test for worker */ +static void *counter_function(gearman_job_st *, + void *context, size_t *result_size, + gearman_return_t *) +{ + uint32_t *counter= (uint32_t *)context; + + *result_size= 0; + + pthread_mutex_lock(&counter_lock); + *counter= *counter + 1; + pthread_mutex_unlock(&counter_lock); + + return NULL; +} + +test_return_t client_echo_fail_test(void *object) +{ + Context *test= (Context *)object; + test_truth(test); + + gearman_client_st client, *client_ptr; + + client_ptr= gearman_client_create(&client); + test_truth(client_ptr); + + test_true_got(gearman_success(gearman_client_add_server(&client, NULL, 20)), gearman_client_error(client_ptr)); + + gearman_return_t rc= gearman_client_echo(&client, gearman_literal_param("This should never work")); + test_true_got(gearman_failed(rc), gearman_strerror(rc)); + + gearman_client_free(&client); + + return TEST_SUCCESS; +} + +test_return_t client_echo_test(void *object) +{ + Context *test= (Context *)object; + test_truth(test); + + gearman_client_st client, *client_ptr; + + client_ptr= gearman_client_create(&client); + test_truth(client_ptr); + + test_true_got(gearman_success(gearman_client_add_server(&client, NULL, test->port())), gearman_client_error(client_ptr)); + + gearman_return_t rc= gearman_client_echo(&client, gearman_literal_param("This is my echo test")); + test_true_got(rc == GEARMAN_SUCCESS, gearman_strerror(rc)); + + gearman_client_free(&client); + + return TEST_SUCCESS; +} + +test_return_t worker_echo_test(void *object) +{ + Context *test= (Context *)object; + test_truth(test); + + gearman_worker_st *worker= test->worker; + test_truth(worker); + + gearman_return_t rc= gearman_worker_echo(worker, gearman_literal_param("This is my echo test")); + test_true_got(rc == GEARMAN_SUCCESS, gearman_strerror(rc)); + + return TEST_SUCCESS; +} + +test_return_t queue_clean(void *object) +{ + Context *test= (Context *)object; + test_truth(test); + gearman_worker_st *worker= test->worker; + test_truth(worker); + + gearman_worker_set_timeout(worker, 1000); + + uint32_t counter= 0; + test_true_got(gearman_success(gearman_worker_add_function(worker, test->worker_function_name(), 5, counter_function, &counter)), gearman_worker_error(worker)); + + // Clean out any jobs that might still be in the queue from failed tests. + while (1) + { + gearman_return_t rc= gearman_worker_work(worker); + if (rc != GEARMAN_SUCCESS) + break; + } + + return TEST_SUCCESS; +} + +test_return_t queue_add(void *object) +{ + Context *test= (Context *)object; + gearman_client_st client, *client_ptr; + gearman_job_handle_t job_handle= {}; + test_truth(test); + + test->run_worker= false; + + client_ptr= gearman_client_create(&client); + test_truth(client_ptr); + + test_true_got(gearman_success(gearman_client_add_server(&client, NULL, test->port())), gearman_client_error(client_ptr)); + + gearman_return_t rc= gearman_client_echo(&client, gearman_literal_param("background_payload")); + test_true_got(rc == GEARMAN_SUCCESS, gearman_strerror(rc)); + + rc= gearman_client_do_background(&client, test->worker_function_name(), NULL, + gearman_literal_param("background_payload"), + job_handle); + test_compare(GEARMAN_SUCCESS, rc); + test_truth(job_handle[0]); + + do { + rc= gearman_client_job_status(client_ptr, job_handle, NULL, NULL, NULL, NULL); + test_true(rc != GEARMAN_IN_PROGRESS); + } while (gearman_continue(rc) and rc != GEARMAN_JOB_EXISTS); // We need to exit on these values since the job will never run + test_true(rc == GEARMAN_JOB_EXISTS or rc == GEARMAN_SUCCESS); + + gearman_client_free(&client); + + test->run_worker= true; + + return TEST_SUCCESS; +} + +test_return_t queue_worker(void *object) +{ + Context *test= (Context *)object; + test_truth(test); + + // Setup job + test_compare(TEST_SUCCESS, queue_add(object)); + + gearman_worker_st *worker= test->worker; + test_truth(worker); + + test_true_got(test->run_worker, "run_worker was not set"); + + uint32_t counter= 0; + test_compare_got(GEARMAN_SUCCESS, + gearman_worker_add_function(worker, test->worker_function_name(), 5, counter_function, &counter), + gearman_worker_error(worker)); + + gearman_worker_set_timeout(worker, 1000); + + gearman_return_t rc= gearman_worker_work(worker); + test_compare_got(GEARMAN_SUCCESS, rc, (rc == GEARMAN_TIMEOUT) ? "Worker was not able to connection to the server, is it running?": gearman_strerror(rc)); + + test_truth(counter); + + return TEST_SUCCESS; +} + +#define NUMBER_OF_WORKERS 10 +#define NUMBER_OF_JOBS 40 +#define JOB_SIZE 100 +test_return_t lp_734663(void *object) +{ + Context *test= (Context *)object; + test_truth(test); + + const char *worker_function_name= "drizzle_queue_test"; + + uint8_t value[JOB_SIZE]= { 'x' }; + memset(&value, 'x', sizeof(value)); + + gearman_client_st client, *client_ptr; + client_ptr= gearman_client_create(&client); + test_truth(client_ptr); + + test_true_got(gearman_success(gearman_client_add_server(&client, NULL, test->port())), gearman_client_error(client_ptr)); + + uint32_t echo_loop= 3; + do { + if (echo_loop != 3) + sleep(1); // Yes, rigging sleep() in order to make sue the server is there + + gearman_return_t rc= gearman_client_echo(&client, value, sizeof(JOB_SIZE)); + test_true_got(rc == GEARMAN_SUCCESS, gearman_strerror(rc)); + } while (--echo_loop); + + for (uint32_t x= 0; x < NUMBER_OF_JOBS; x++) + { + gearman_job_handle_t job_handle= {}; + gearman_return_t rc= gearman_client_do_background(&client, worker_function_name, NULL, value, sizeof(value), job_handle); + test_truth(rc == GEARMAN_SUCCESS); + test_truth(job_handle[0]); + } + + gearman_client_free(&client); + + struct worker_handle_st *worker_handle[NUMBER_OF_WORKERS]; + + uint32_t counter= 0; + gearman_function_t counter_function_fn= gearman_function_create_v1(counter_function); + for (uint32_t x= 0; x < NUMBER_OF_WORKERS; x++) + { + worker_handle[x]= test_worker_start(test->port(), NULL, worker_function_name, counter_function_fn, &counter, gearman_worker_options_t()); + } + + time_t end_time= time(NULL) +5; + time_t current_time= 0; + while (counter < NUMBER_OF_JOBS || current_time < end_time) + { + sleep(1); + current_time= time(NULL); + } + + for (uint32_t x= 0; x < NUMBER_OF_WORKERS; x++) + { + test_worker_stop(worker_handle[x]); + } + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/basic.h gearmand-0.23/tests/basic.h --- gearmand-0.14/tests/basic.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/basic.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,46 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t client_echo_test(void *); +test_return_t client_echo_fail_test(void *object); +test_return_t worker_echo_test(void *); +test_return_t queue_clean(void *object); +test_return_t queue_add(void *object); +test_return_t queue_worker(void *object); +test_return_t lp_734663(void *); diff -Nru gearmand-0.14/tests/burnin.cc gearmand-0.23/tests/burnin.cc --- gearmand-0.14/tests/burnin.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/burnin.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,276 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#define DEFAULT_WORKER_NAME "burnin" + +struct client_test_st { + gearman_client_st client; + pid_t gearmand_pid; + struct worker_handle_st *handle; + + client_test_st(): + gearmand_pid(-1), + handle(NULL) + { } +}; + +struct client_context_st { + int latch; + size_t min_size; + size_t max_size; + size_t num_tasks; + size_t count; + char *blob; + + client_context_st(): + latch(0), + min_size(1024), + max_size(1024 *2), + num_tasks(20), + count(2000), + blob(NULL) + { } +}; + +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static test_return_t burnin_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + struct client_context_st *context= (struct client_context_st *)gearman_client_context(client); + + // This sketchy, don't do this in your own code. + gearman_task_st *tasks= (gearman_task_st *)calloc(context->num_tasks, sizeof(gearman_task_st)); + test_true_got(tasks, strerror(errno)); + + test_true_got(gearman_success(gearman_client_echo(client, gearman_literal_param("echo_test"))), gearman_client_error(client)); + + do + { + for (uint32_t x= 0; x < context->num_tasks; x++) + { + size_t blob_size= 0; + + if (context->min_size == context->max_size) + { + blob_size= context->max_size; + } + else + { + blob_size= (size_t)rand(); + + if (context->max_size > RAND_MAX) + blob_size*= (size_t)(rand() + 1); + + blob_size= (blob_size % (context->max_size - context->min_size)) + context->min_size; + } + + gearman_task_st *task_ptr; + gearman_return_t ret; + if (context->latch) + { + task_ptr= gearman_client_add_task_background(client, &(tasks[x]), + NULL, DEFAULT_WORKER_NAME, NULL, + (void *)context->blob, blob_size, &ret); + } + else + { + task_ptr= gearman_client_add_task(client, &(tasks[x]), NULL, + DEFAULT_WORKER_NAME, NULL, (void *)context->blob, blob_size, + &ret); + } + + test_true_got(gearman_success(ret), gearman_client_error(client)); + test_truth(task_ptr); + } + + gearman_return_t ret= gearman_client_run_tasks(client); + for (uint32_t x= 0; x < context->num_tasks; x++) + { + test_compare(GEARMAN_TASK_STATE_FINISHED, tasks[x].state); + test_compare(GEARMAN_SUCCESS, tasks[x].result_rc); + } + test_compare(0, client->new_tasks); + + test_true_got(gearman_success(ret), gearman_client_error(client)); + + for (uint32_t x= 0; x < context->num_tasks; x++) + { + gearman_task_free(&(tasks[x])); + } + } while (context->count--); + + free(tasks); + + context->latch++; + + return TEST_SUCCESS; +} + +static test_return_t setup(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + struct client_context_st *context= new client_context_st; + test_true_got(context, strerror(errno)); + + context->blob= (char *)malloc(context->max_size); + test_true_got(context->blob, strerror(errno)); + memset(context->blob, 'x', context->max_size); + + gearman_client_set_context(client, context); + + return TEST_SUCCESS; +} + +static test_return_t cleanup(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + struct client_context_st *context= (struct client_context_st *)gearman_client_context(client); + + free(context->blob); + delete(context); + + return TEST_SUCCESS; +} + + +static void *worker_fn(gearman_job_st *, void *, + size_t *result_size, gearman_return_t *ret_ptr) +{ + result_size= 0; + *ret_ptr= GEARMAN_SUCCESS; + return NULL; +} + +void *world_create(test_return_t *error) +{ + pid_t gearmand_pid; + + /** + * @TODO We cast this to char ** below, which is evil. We need to do the + * right thing + */ + const char *argv[1]= { "client_gearmand" }; + + client_test_st *test= new client_test_st; + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + /** + We start up everything before we allocate so that we don't have to track memory in the forked process. + */ + test->gearmand_pid= gearmand_pid= test_gearmand_start(BURNIN_TEST_PORT, 1, argv); + if (test->gearmand_pid == -1) + { + *error= TEST_FAILURE; + return NULL; + } + + gearman_function_t func_arg= gearman_function_create_v1(worker_fn); + test->handle= test_worker_start(BURNIN_TEST_PORT, NULL, DEFAULT_WORKER_NAME, func_arg, NULL, gearman_worker_options_t()); + if (not test->handle) + { + *error= TEST_FAILURE; + return NULL; + } + + if (not gearman_client_create(&(test->client))) + { + *error= TEST_FAILURE; + return NULL; + } + + if (gearman_failed(gearman_client_add_server(&(test->client), NULL, BURNIN_TEST_PORT))) + { + *error= TEST_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return (void *)test; +} + +test_return_t world_destroy(void *object) +{ + client_test_st *test= (client_test_st *)object; + gearman_client_free(&(test->client)); + test_gearmand_stop(test->gearmand_pid); + test_worker_stop(test->handle); + delete test; + + return TEST_SUCCESS; +} + + +test_st tests[] ={ + {"burnin", 0, burnin_test }, +// {"burnin_background", 0, burnin_test }, + {0, 0, 0} +}; + + +collection_st collection[] ={ + {"burnin", setup, cleanup, tests}, + {0, 0, 0, 0} +}; + +typedef test_return_t (*libgearman_test_callback_fn)(gearman_client_st *); +static test_return_t _runner_default(libgearman_test_callback_fn func, client_test_st *container) +{ + if (func) + { + return func(&container->client); + } + else + { + return TEST_SUCCESS; + } +} + +static Runner runner= { + (test_callback_runner_fn*)_runner_default, + (test_callback_runner_fn*)_runner_default, + (test_callback_runner_fn*)_runner_default +}; + + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; + world->runner= &runner; +} diff -Nru gearmand-0.14/tests/client_test.c gearmand-0.23/tests/client_test.c --- gearmand-0.14/tests/client_test.c 2010-06-30 11:53:18.000000000 +0200 +++ gearmand-0.23/tests/client_test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,862 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include - -#include - -#include "test.h" -#include "test_gearmand.h" -#include "test_worker.h" - -#define CLIENT_TEST_PORT 32123 - -typedef struct -{ - gearman_client_st client; - pid_t gearmand_pid; - struct worker_handle_st *handle; -} client_test_st; - -/** - @note Just here until I fix libhashkit. -*/ -static uint32_t internal_generate_hash(const char *key, size_t key_length) -{ - const char *ptr= key; - uint32_t value= 0; - - while (key_length--) - { - uint32_t val= (uint32_t) *ptr++; - value += val; - value += (value << 10); - value ^= (value >> 6); - } - value += (value << 3); - value ^= (value >> 11); - value += (value << 15); - - return value == 0 ? 1 : (uint32_t) value; -} - -/* Prototypes */ -test_return_t init_test(void *object); -test_return_t allocation_test(void *object); -test_return_t clone_test(void *object); -test_return_t echo_test(void *object); -test_return_t submit_job_test(void *object); -test_return_t submit_null_job_test(void *object); -test_return_t submit_fail_job_test(void *object); -test_return_t background_test(void *object); -test_return_t background_failure_test(void *object); -test_return_t add_servers_test(void *object); - -void *client_test_worker(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr); -void *client_test_temp_worker(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr); -void *world_create(test_return_t *error); -test_return_t world_destroy(void *object); - - -static void *client_thread(void *object) -{ - (void)object; - gearman_return_t rc; - gearman_client_st client; - gearman_client_st *client_ptr; - size_t result_size; - - client_ptr= gearman_client_create(&client); - - if (client_ptr == NULL) - abort(); // This would be pretty bad. - - rc= gearman_client_add_server(&client, NULL, CLIENT_TEST_PORT); - if (rc != GEARMAN_SUCCESS) - pthread_exit(0); - - gearman_client_set_timeout(&client, 400); - for (size_t x= 0; x < 5; x++) - { - (void) gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, - &result_size, &rc); - - } - gearman_client_free(client_ptr); - - pthread_exit(0); -} - -test_return_t init_test(void *object __attribute__((unused))) -{ - gearman_client_st client; - - if (gearman_client_create(&client) == NULL) - return TEST_FAILURE; - - gearman_client_free(&client); - - return TEST_SUCCESS; -} - -test_return_t allocation_test(void *object __attribute__((unused))) -{ - gearman_client_st *client; - - client= gearman_client_create(NULL); - if (client == NULL) - return TEST_FAILURE; - - gearman_client_free(client); - - return TEST_SUCCESS; -} - -test_return_t clone_test(void *object) -{ - const gearman_client_st *from= (gearman_client_st *)object; - gearman_client_st *from_with_host; - gearman_client_st *client; - - client= gearman_client_clone(NULL, NULL); - - test_truth(client); - test_truth(client->options.allocated); - - gearman_client_free(client); - - client= gearman_client_clone(NULL, from); - test_truth(client); - gearman_client_free(client); - - from_with_host= gearman_client_create(NULL); - test_truth(from_with_host); - gearman_client_add_server(from_with_host, "127.0.0.1", 12345); - - client= gearman_client_clone(NULL, from_with_host); - test_truth(client); - - test_truth(client->universal.con_list); - test_truth(!strcmp(client->universal.con_list->host, from_with_host->universal.con_list->host)); - test_truth(client->universal.con_list->port == from_with_host->universal.con_list->port); - - gearman_client_free(client); - gearman_client_free(from_with_host); - - return TEST_SUCCESS; -} - -static test_return_t option_test(void *object __attribute__((unused))) -{ - gearman_client_st *gear; - gearman_client_options_t default_options; - - gear= gearman_client_create(NULL); - test_truth(gear); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - - /* Set up for default options */ - default_options= gearman_client_options(gear); - - /* - We take the basic options, and push - them back in. See if we change anything. - */ - gearman_client_set_options(gear, default_options); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - - /* - We will trying to modify non-mutable options (which should not be allowed) - */ - { - gearman_client_remove_options(gear, GEARMAN_CLIENT_ALLOCATED); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - gearman_client_remove_options(gear, GEARMAN_CLIENT_NO_NEW); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - } - - /* - We will test modifying GEARMAN_CLIENT_NON_BLOCKING in several manners. - */ - { - gearman_client_remove_options(gear, GEARMAN_CLIENT_NON_BLOCKING); - { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - gearman_client_add_options(gear, GEARMAN_CLIENT_NON_BLOCKING); - { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_truth(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - gearman_client_set_options(gear, GEARMAN_CLIENT_NON_BLOCKING); - { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_truth(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - gearman_client_set_options(gear, GEARMAN_CLIENT_UNBUFFERED_RESULT); - { // Everything is now set to false except GEARMAN_CLIENT_UNBUFFERED_RESULT, and non-mutable options - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_truth(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - /* - Reset options to default. Then add an option, and then add more options. Make sure - the options are all additive. - */ - { - gearman_client_set_options(gear, default_options); - { // See if we return to defaults - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - gearman_client_add_options(gear, GEARMAN_CLIENT_FREE_TASKS); - { // All defaults, except timeout_return - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_truth(gear->options.free_tasks); - } - gearman_client_add_options(gear, GEARMAN_CLIENT_NON_BLOCKING|GEARMAN_CLIENT_UNBUFFERED_RESULT); - { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_truth(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_truth(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_truth(gear->options.free_tasks); - } - } - /* - Add an option, and then replace with that option plus a new option. - */ - { - gearman_client_set_options(gear, default_options); - { // See if we return to defaults - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_false(gear->options.free_tasks); - } - gearman_client_add_options(gear, GEARMAN_CLIENT_FREE_TASKS); - { // All defaults, except timeout_return - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_false(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_truth(gear->options.free_tasks); - } - gearman_client_add_options(gear, GEARMAN_CLIENT_FREE_TASKS|GEARMAN_CLIENT_UNBUFFERED_RESULT); - { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_false(gear->options.task_in_use); - test_truth(gear->options.unbuffered_result); - test_false(gear->options.no_new); - test_truth(gear->options.free_tasks); - } - } - } - - gearman_client_free(gear); - - return TEST_SUCCESS; -} - -test_return_t echo_test(void *object __attribute__((unused))) -{ - gearman_client_st *client= (gearman_client_st *)object; - gearman_return_t rc; - size_t value_length; - const char *value= "This is my echo test"; - - value_length= strlen(value); - - rc= gearman_client_echo(client, (uint8_t *)value, value_length); - if (rc != GEARMAN_SUCCESS) - { - printf("echo_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - return TEST_SUCCESS; -} - -test_return_t submit_job_test(void *object) -{ - gearman_return_t rc; - gearman_client_st *client= (gearman_client_st *)object; - uint8_t *job_result; - size_t job_length; - uint8_t *value= (uint8_t *)"submit_job_test"; - size_t value_length= strlen("submit_job_test"); - - job_result= gearman_client_do(client, "client_test", NULL, value, - value_length, &job_length, &rc); - if (rc != GEARMAN_SUCCESS) - { - printf("submit_job_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - if (job_result == NULL) - return TEST_FAILURE; - - if (value_length != job_length || memcmp(value, job_result, value_length)) - return TEST_FAILURE; - - free(job_result); - - return TEST_SUCCESS; -} - -test_return_t submit_null_job_test(void *object) -{ - gearman_return_t rc; - gearman_client_st *client= (gearman_client_st *)object; - uint8_t *job_result; - size_t job_length; - - job_result= gearman_client_do(client, "client_test", NULL, NULL, 0, - &job_length, &rc); - if (rc != GEARMAN_SUCCESS) - { - printf("submit_null_job_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - if (job_result != NULL || job_length != 0) - return TEST_FAILURE; - - return TEST_SUCCESS; -} - -test_return_t submit_fail_job_test(void *object) -{ - gearman_return_t rc; - gearman_client_st *client= (gearman_client_st *)object; - uint8_t *job_result; - size_t job_length; - - job_result= gearman_client_do(client, "client_test", NULL, "fail", 4, - &job_length, &rc); - if (rc != GEARMAN_WORK_FAIL) - { - printf("submit_fail_job_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - return TEST_SUCCESS; -} - -test_return_t background_test(void *object) -{ - gearman_return_t rc; - gearman_client_st *client= (gearman_client_st *)object; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - bool is_known; - bool is_running; - uint32_t numerator; - uint32_t denominator; - uint8_t *value= (uint8_t *)"background_test"; - size_t value_length= strlen("background_test"); - - rc= gearman_client_do_background(client, "client_test", NULL, value, - value_length, job_handle); - if (rc != GEARMAN_SUCCESS) - { - printf("background_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - while (1) - { - rc= gearman_client_job_status(client, job_handle, &is_known, &is_running, - &numerator, &denominator); - if (rc != GEARMAN_SUCCESS) - { - printf("background_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - if (is_known == false) - break; - } - - return TEST_SUCCESS; -} - -test_return_t background_failure_test(void *object) -{ - gearman_return_t rc; - gearman_client_st *client= (gearman_client_st *)object; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - bool is_known; - bool is_running; - uint32_t numerator; - uint32_t denominator; - uint8_t *value= (uint8_t *)"background_failure_test"; - size_t value_length= strlen("background_failure_test"); - - rc= gearman_client_do_background(client, "does_not_exist", NULL, value, - value_length, job_handle); - if (rc != GEARMAN_SUCCESS) - return TEST_FAILURE; - - rc= gearman_client_job_status(client, job_handle, &is_known, &is_running, - &numerator, &denominator); - if (rc != GEARMAN_SUCCESS || is_known != true || is_running != false || - numerator != 0 || denominator != 0) - { - printf("background_failure_test:%s\n", gearman_client_error(client)); - return TEST_FAILURE; - } - - return TEST_SUCCESS; -} - -test_return_t add_servers_test(void *object __attribute__((unused))) -{ - gearman_client_st client; - - if (gearman_client_create(&client) == NULL) - return TEST_FAILURE; - - if (gearman_client_add_servers(&client, "127.0.0.1:4730,localhost") - != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_client_add_servers(&client, "old_jobserver:7003,broken:12345") - != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - gearman_client_free(&client); - - return TEST_SUCCESS; -} - -static test_return_t bug_518512_test(void *object) -{ - gearman_return_t rc; - gearman_client_st client; - size_t result_size; - (void) object; - - test_truth(gearman_client_create(&client)); - - if (gearman_client_add_server(&client, NULL, CLIENT_TEST_PORT) != GEARMAN_SUCCESS) - { - fprintf(stderr, "bug_518512_test: gearman_client_add_server: %s\n", gearman_client_error(&client)); - return TEST_FAILURE; - } - - gearman_client_set_timeout(&client, 100); - (void) gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, - &result_size, &rc); - if (rc != GEARMAN_TIMEOUT) - { - fprintf(stderr, "bug_518512_test: should have timed out\n"); - gearman_client_free(&client); - return TEST_FAILURE; - } - - struct worker_handle_st *handle= test_worker_start(CLIENT_TEST_PORT, "client_test_temp", - client_test_temp_worker, NULL); - - gearman_client_set_timeout(&client, -1); - (void) gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, - &result_size, &rc); - if (rc != GEARMAN_SUCCESS) - { - fprintf(stderr, "bug_518512_test: gearman_client_do: %s\n", gearman_client_error(&client)); - test_worker_stop(handle); - gearman_client_free(&client); - return TEST_FAILURE; - } - - test_worker_stop(handle); - gearman_client_free(&client); - - return TEST_SUCCESS; -} - -#define NUMBER_OF_WORKERS 2 - -static test_return_t loop_test(void *object) -{ - (void) object; - void *unused; - pthread_attr_t attr; - - pthread_t one; - pthread_t two; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - struct worker_handle_st *handles[NUMBER_OF_WORKERS]; - for (size_t x= 0; x < NUMBER_OF_WORKERS; x++) - { - handles[x]= test_worker_start(CLIENT_TEST_PORT, "client_test_temp", - client_test_temp_worker, NULL); - } - - pthread_create(&one, &attr, client_thread, NULL); - pthread_create(&two, &attr, client_thread, NULL); - - pthread_join(one, &unused); - pthread_join(two, &unused); - - for (size_t x= 0; x < NUMBER_OF_WORKERS; x++) - { - test_worker_stop(handles[x]); - } - - pthread_attr_destroy(&attr); - - return TEST_SUCCESS; -} - -static test_return_t submit_log_failure(void *object) -{ - gearman_return_t rc; - gearman_client_st *client= (gearman_client_st *)object; - uint8_t *job_result; - size_t job_length; - uint8_t *value= (uint8_t *)"submit_log_failure"; - size_t value_length= strlen("submit_log_failure"); - - job_result= gearman_client_do(client, "client_test", NULL, value, - value_length, &job_length, &rc); - if (rc != GEARMAN_SUCCESS) - return TEST_SUCCESS; - - return TEST_FAILURE; -} - -static void log_counter(const char *line, gearman_verbose_t verbose, - void *context) -{ - uint32_t *counter= (uint32_t *)context; - - (void)verbose; - (void)line; - - *counter= *counter + 1; -} - -static test_return_t strerror_count(void *object __attribute__((unused))) -{ - test_truth(GEARMAN_MAX_RETURN == 49); - - return TEST_SUCCESS; -} - -#undef MAKE_NEW_STRERROR - -static test_return_t strerror_strings(void *object __attribute__((unused))) -{ - gearman_return_t rc; - uint32_t values[] = { 324335284U, 1940666259U, 4156775927U, 18028287U, - 1834995715U, 1009419836U, 1038124396U, 3050095617U, - 4004269877U, 2913489720U, 1389266665U, 1374361090U, - 3775104989U, 1158738795U, 2490507301U, 426780991U, - 2421852085U, 426121997U, 3669711613U, 1027733609U, - 48094985U, 4052600452U, 2697110207U, 4260329382U, - 3706494438U, 1765339649U, 1176029865U, 2899482444U, - 2255507756U, 1844534215U, 1685626311U, 3134591697U, - 1469920452U, 2236059486U, 1693700353U, 1173962212U, - 2491943732U, 1864825729U, 523632457U, 1342225548U, - 245155833U, 3999913926U, 2789053153U, 2576033598U, - 463490826U, 1983660343U, 2268979717U, 1656388188U, - 1558344702U}; - -#ifdef MAKE_NEW_STRERROR - int flip_flop= 0; - printf("\n"); -#endif - for (rc= GEARMAN_SUCCESS; rc < GEARMAN_MAX_RETURN; rc++) - { - uint32_t hash_val; - const char *msg= gearman_strerror(rc); - hash_val= internal_generate_hash(msg, strlen(msg)); -#ifdef MAKE_NEW_STRERROR - (void)values; - printf("%uU,", hash_val); - if (flip_flop == 3) - { - printf("\n"); - flip_flop= 0; - } - else - { - printf(" "); - flip_flop++; - } -#else - test_truth(values[rc] == hash_val); -#endif - } - -#ifdef MAKE_NEW_STRERROR - fflush(stdout); -#endif - - return TEST_SUCCESS; -} - -static uint32_t global_counter; - -static test_return_t pre_logging(void *object) -{ - client_test_st *all= (client_test_st *)object; - gearman_log_fn *func= log_counter; - global_counter= 0; - - gearman_client_set_log_fn(&all->client, func, &global_counter, GEARMAN_VERBOSE_MAX); - gearman_client_remove_servers(&all->client); - - return TEST_SUCCESS; -} - -static test_return_t post_logging(void *object __attribute__((unused))) -{ - test_truth(global_counter); - - return TEST_SUCCESS; -} - - -void *client_test_worker(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr) -{ - const uint8_t *workload; - uint8_t *result; - (void)context; - - workload= gearman_job_workload(job); - *result_size= gearman_job_workload_size(job); - - if (workload == NULL || *result_size == 0) - { - assert(workload == NULL && *result_size == 0); - result= NULL; - } - else if (*result_size == 4 && !memcmp(workload, "fail", 4)) - { - *ret_ptr= GEARMAN_WORK_FAIL; - return NULL; - } - else - { - assert((result= malloc(*result_size)) != NULL); - memcpy(result, workload, *result_size); - } - - *ret_ptr= GEARMAN_SUCCESS; - return result; -} - -void *client_test_temp_worker(gearman_job_st *job, void *context, - size_t *result_size, gearman_return_t *ret_ptr) -{ - (void) job; - (void) context; - *result_size = 0; - *ret_ptr= GEARMAN_SUCCESS; - return NULL; -} - -void *world_create(test_return_t *error) -{ - client_test_st *test; - pid_t gearmand_pid; - - /** - * @TODO We cast this to char ** below, which is evil. We need to do the - * right thing - */ - const char *argv[1]= { "client_gearmand" }; - - test= calloc(1, sizeof(client_test_st)); - if (! test) - { - *error= TEST_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - /** - We start up everything before we allocate so that we don't have to track memory in the forked process. - */ - gearmand_pid= test_gearmand_start(CLIENT_TEST_PORT, NULL, - (char **)argv, 1); - test->handle= test_worker_start(CLIENT_TEST_PORT, "client_test", client_test_worker, NULL); - - test->gearmand_pid= gearmand_pid; - - if (gearman_client_create(&(test->client)) == NULL) - { - *error= TEST_FAILURE; - return NULL; - } - - if (gearman_client_add_server(&(test->client), NULL, CLIENT_TEST_PORT) != GEARMAN_SUCCESS) - { - *error= TEST_FAILURE; - return NULL; - } - - *error= TEST_SUCCESS; - - return (void *)test; -} - - -test_return_t world_destroy(void *object) -{ - client_test_st *test= (client_test_st *)object; - gearman_client_free(&(test->client)); - test_gearmand_stop(test->gearmand_pid); - test_worker_stop(test->handle); - free(test); - - return TEST_SUCCESS; -} - - -test_st tests[] ={ - {"init", 0, init_test }, - {"allocation", 0, allocation_test }, - {"clone_test", 0, clone_test }, - {"echo", 0, echo_test }, - {"options", 0, option_test }, - {"submit_job", 0, submit_job_test }, - {"submit_null_job", 0, submit_null_job_test }, - {"submit_fail_job", 0, submit_fail_job_test }, - {"background", 0, background_test }, - {"background_failure", 0, background_failure_test }, - {"add_servers", 0, add_servers_test }, - {"bug_518512_test", 0, bug_518512_test }, - {"loop_test", 0, loop_test }, - {0, 0, 0} -}; - - -test_st tests_log[] ={ - {"submit_log_failure", 0, submit_log_failure }, - {0, 0, 0} -}; - -test_st gearman_strerror_tests[] ={ - {"count", 0, strerror_count }, - {"strings", 0, strerror_strings }, - {0, 0, 0} -}; - - -collection_st collection[] ={ - {"gearman_client_st", 0, 0, tests}, - {"client-logging", pre_logging, post_logging, tests_log}, - {"gearman_strerror", 0, 0, gearman_strerror_tests}, - {0, 0, 0, 0} -}; - -typedef test_return_t (*libgearman_test_callback_fn)(gearman_client_st *); -static test_return_t _runner_default(libgearman_test_callback_fn func, client_test_st *container) -{ - if (func) - { - return func(&container->client); - } - else - { - return TEST_SUCCESS; - } -} - -static world_runner_st runner= { - (test_callback_runner_fn)_runner_default, - (test_callback_runner_fn)_runner_default, - (test_callback_runner_fn)_runner_default -}; - - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; - world->runner= &runner; -} diff -Nru gearmand-0.14/tests/client_test.cc gearmand-0.23/tests/client_test.cc --- gearmand-0.14/tests/client_test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/client_test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,1482 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define GEARMAN_CORE +#include + +#include +#include + +#define NAMESPACE_KEY "foo123" + +#define WORKER_FUNCTION_NAME "client_test" +#define WORKER_CHUNKED_FUNCTION_NAME "reverse_test" +#define WORKER_UNIQUE_FUNCTION_NAME "unique_test" +#define WORKER_SPLIT_FUNCTION_NAME "split_worker" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +struct client_test_st +{ + gearman_client_st *_client; + bool _clone; + pid_t gearmand_pid; + std::vector workers; + const char *_worker_name; + + client_test_st() : + _clone(true), + gearmand_pid(-1), + _worker_name(WORKER_FUNCTION_NAME) + { + if (not (_client= gearman_client_create(NULL))) + { + abort(); // This would only happen from a programming error + } + + } + + ~client_test_st() + { + test_gearmand_stop(gearmand_pid); + + BOOST_FOREACH(worker_handle_st *worker, workers) + { + test_worker_stop(worker); + } + gearman_client_free(_client); + } + + void push(worker_handle_st *arg) + { + workers.push_back(arg); + } + + const char *worker_name() const + { + return _worker_name; + } + + void set_worker_name(const char *arg) + { + _worker_name= arg; + } + + void set_clone(bool arg) + { + _clone= arg; + } + + bool clone() const + { + return _clone; + } + + gearman_client_st *client() + { + return _client; + } + + void reset_client() + { + gearman_client_free(_client); + _client= gearman_client_create(NULL); + } +}; + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/** + @note Just here until I fix libhashkit. +*/ +static uint32_t internal_generate_hash(const char *key, size_t key_length) +{ + const char *ptr= key; + uint32_t value= 0; + + while (key_length--) + { + uint32_t val= (uint32_t) *ptr++; + value += val; + value += (value << 10); + value ^= (value >> 6); + } + value += (value << 3); + value ^= (value >> 11); + value += (value << 15); + + return value == 0 ? 1 : (uint32_t) value; +} + +/* Prototypes */ +void *client_test_temp_worker(gearman_job_st *job, void *context, + size_t *result_size, gearman_return_t *ret_ptr); +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); + + +static void *client_thread(void *object) +{ + (void)object; + gearman_client_st client; + gearman_client_st *client_ptr; + size_t result_size; + + client_ptr= gearman_client_create(&client); + + if (client_ptr == NULL) + abort(); // This would be pretty bad. + + gearman_return_t rc= gearman_client_add_server(&client, NULL, CLIENT_TEST_PORT); + if (gearman_failed(rc)) + { + pthread_exit(0); + } + + gearman_client_set_timeout(&client, 400); + for (size_t x= 0; x < 5; x++) + { + (void) gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, + &result_size, &rc); + + } + gearman_client_free(client_ptr); + + pthread_exit(0); +} + +static test_return_t init_test(void *) +{ + gearman_client_st client; + + test_truth(gearman_client_create(&client)); + + gearman_client_free(&client); + + return TEST_SUCCESS; +} + +static test_return_t allocation_test(void *) +{ + gearman_client_st *client; + + test_truth(client= gearman_client_create(NULL)); + + gearman_client_free(client); + + return TEST_SUCCESS; +} + +static test_return_t clone_test(void *object) +{ + const gearman_client_st *from= (gearman_client_st *)object; + gearman_client_st *from_with_host; + gearman_client_st *client; + + client= gearman_client_clone(NULL, NULL); + + test_truth(client); + test_truth(client->options.allocated); + + gearman_client_free(client); + + client= gearman_client_clone(NULL, from); + test_truth(client); + gearman_client_free(client); + + from_with_host= gearman_client_create(NULL); + test_truth(from_with_host); + gearman_client_add_server(from_with_host, "127.0.0.1", 12345); + + client= gearman_client_clone(NULL, from_with_host); + test_truth(client); + + test_truth(client->universal.con_list); + test_truth(gearman_client_compare(client, from_with_host)); + + gearman_client_free(client); + gearman_client_free(from_with_host); + + return TEST_SUCCESS; +} + +static test_return_t option_test(void *) +{ + gearman_client_st *gear; + gearman_client_options_t default_options; + + gear= gearman_client_create(NULL); + test_truth(gear); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + + /* Set up for default options */ + default_options= gearman_client_options(gear); + + /* + We take the basic options, and push + them back in. See if we change anything. + */ + gearman_client_set_options(gear, default_options); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + + /* + We will trying to modify non-mutable options (which should not be allowed) + */ + { + gearman_client_remove_options(gear, GEARMAN_CLIENT_ALLOCATED); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + gearman_client_remove_options(gear, GEARMAN_CLIENT_NO_NEW); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + } + + /* + We will test modifying GEARMAN_CLIENT_NON_BLOCKING in several manners. + */ + { + gearman_client_remove_options(gear, GEARMAN_CLIENT_NON_BLOCKING); + { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + gearman_client_add_options(gear, GEARMAN_CLIENT_NON_BLOCKING); + { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_truth(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + gearman_client_set_options(gear, GEARMAN_CLIENT_NON_BLOCKING); + { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_truth(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + gearman_client_set_options(gear, GEARMAN_CLIENT_UNBUFFERED_RESULT); + { // Everything is now set to false except GEARMAN_CLIENT_UNBUFFERED_RESULT, and non-mutable options + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + /* + Reset options to default. Then add an option, and then add more options. Make sure + the options are all additive. + */ + { + gearman_client_set_options(gear, default_options); + { // See if we return to defaults + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + gearman_client_add_options(gear, GEARMAN_CLIENT_FREE_TASKS); + { // All defaults, except timeout_return + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_truth(gear->options.free_tasks); + } + gearman_client_add_options(gear, (gearman_client_options_t)(GEARMAN_CLIENT_NON_BLOCKING|GEARMAN_CLIENT_UNBUFFERED_RESULT)); + { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_truth(gear->options.non_blocking); + test_truth(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_truth(gear->options.free_tasks); + } + } + /* + Add an option, and then replace with that option plus a new option. + */ + { + gearman_client_set_options(gear, default_options); + { // See if we return to defaults + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_false(gear->options.free_tasks); + } + gearman_client_add_options(gear, GEARMAN_CLIENT_FREE_TASKS); + { // All defaults, except timeout_return + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_false(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_truth(gear->options.free_tasks); + } + gearman_client_add_options(gear, (gearman_client_options_t)(GEARMAN_CLIENT_FREE_TASKS|GEARMAN_CLIENT_UNBUFFERED_RESULT)); + { // GEARMAN_CLIENT_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.unbuffered_result); + test_false(gear->options.no_new); + test_truth(gear->options.free_tasks); + } + } + } + + gearman_client_free(gear); + + return TEST_SUCCESS; +} + +static test_return_t echo_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + gearman_string_t value= { gearman_literal_param("This is my echo test") }; + + test_compare(GEARMAN_SUCCESS, gearman_client_echo(client, gearman_string_param(value))); + + return TEST_SUCCESS; +} + +static test_return_t submit_job_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + gearman_string_t value= { gearman_literal_param("submit_job_test") }; + + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, gearman_string_param(value), &result_length, &rc); + + test_compare_got(GEARMAN_SUCCESS, + rc, gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + + test_truth(job_result); + test_compare(gearman_size(value), result_length); + + test_memcmp(gearman_c_str(value), job_result, gearman_size(value)); + + free(job_result); + + return TEST_SUCCESS; +} + +static test_return_t submit_null_job_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + test_truth(client); + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, NULL, 0, + &result_length, &rc); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_client_error(client)); + test_compare(0, result_length); + test_false(job_result); + + return TEST_SUCCESS; +} + +static test_return_t submit_exception_job_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, + gearman_literal_param("exception"), + &result_length, &rc); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + test_memcmp("exception", job_result, result_length); + free(job_result); + + return TEST_SUCCESS; +} + +static test_return_t submit_warning_job_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, + gearman_literal_param("warning"), + &result_length, &rc); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + test_memcmp("warning", job_result, result_length); + free(job_result); + + return TEST_SUCCESS; +} + +static test_return_t submit_fail_job_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, "fail", 4, + &result_length, &rc); + test_compare_got(GEARMAN_WORK_FAIL, rc, gearman_client_error(client)); + test_false(job_result); + test_false(result_length); + + return TEST_SUCCESS; +} + +static test_return_t submit_multiple_do(void *object) +{ + for (uint32_t x= 0; x < 100 /* arbitrary */; x++) + { + uint32_t option= random() %3; + + switch (option) + { + case 0: + test_compare(TEST_SUCCESS, submit_null_job_test(object)); + break; + case 1: + test_compare(TEST_SUCCESS, submit_job_test(object)); + break; + default: + case 2: + test_compare(TEST_SUCCESS, submit_fail_job_test(object)); + break; + } + } + + return TEST_SUCCESS; +} + +static test_return_t gearman_client_job_status_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + gearman_string_t value= { gearman_literal_param("background_test") }; + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + gearman_job_handle_t job_handle; + test_compare_got(GEARMAN_SUCCESS, + gearman_client_do_background(client, worker_function, NULL, gearman_string_param(value), job_handle), + gearman_client_error(client)); + + gearman_return_t ret; + bool is_known; + do + { + bool is_running; + uint32_t numerator; + uint32_t denominator; + + test_compare_got(GEARMAN_SUCCESS, + ret= gearman_client_job_status(client, job_handle, &is_known, &is_running, &numerator, &denominator), + gearman_client_error(client)); + } while (gearman_continue(ret) and is_known); + + return TEST_SUCCESS; +} + +static void* test_malloc_fn(size_t size, void *context) +{ + bool *malloc_check= (bool *)context; + *malloc_check= true; + return malloc(size); +} + +static void test_free_fn(void *ptr, void *context) +{ + bool *free_check= (bool *)context; + *free_check= true; + return free(ptr); +} + +static test_return_t gearman_client_set_workload_malloc_fn_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + bool malloc_check= false; + gearman_client_set_workload_malloc_fn(client, test_malloc_fn, &malloc_check); + + test_compare(TEST_SUCCESS, submit_job_test(object)); + test_compare(true, malloc_check); + + return TEST_SUCCESS; +} + +static test_return_t gearman_client_set_workload_free_fn_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + bool free_check= false; + gearman_client_set_workload_free_fn(client, test_free_fn, &free_check); + + test_compare(TEST_SUCCESS, submit_job_test(object)); + test_compare(true, free_check); + + return TEST_SUCCESS; +} + +struct _alloc_test_st { + int64_t count; + int64_t total; + + _alloc_test_st(): + count(0), + total(0) + { } + + void add() + { + count++; + total++; + } + + void subtract() + { + count--; + } + + bool success() // count is valid as 1 only with the current test + { + if (total and count == 1) + return true; + + std::cerr << __func__ << ":" << __LINE__ << " Total:" << total << " Count:" << count << std::endl; + + return false; + } +}; + +static void* test_malloc_count_fn(size_t size, void *context) +{ + _alloc_test_st *_foo= (_alloc_test_st *)context; + + _foo->add(); + + return malloc(size); +} + +static void test_free_count_fn(void *ptr, void *context) +{ + _alloc_test_st *_foo= (_alloc_test_st *)context; + + _foo->subtract(); + + return free(ptr); +} + + +static test_return_t gearman_client_set_workload_allocators_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + _alloc_test_st _foo; + + gearman_client_set_workload_malloc_fn(client, test_malloc_count_fn, &_foo); + gearman_client_set_workload_free_fn(client, test_free_count_fn, &_foo); + + test_compare(TEST_SUCCESS, submit_job_test(object)); + test_true(_foo.success()); + + return TEST_SUCCESS; +} + +static test_return_t gearman_client_job_status_with_return(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + + gearman_string_t value= { gearman_literal_param("background_test") }; + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + gearman_job_handle_t job_handle; + test_compare_got(GEARMAN_SUCCESS, + gearman_client_do_background(client, worker_function, NULL, gearman_string_param(value), job_handle), + gearman_client_error(client)); + + gearman_return_t ret; + do + { + uint32_t numerator; + uint32_t denominator; + + ret= gearman_client_job_status(client, job_handle, NULL, NULL, &numerator, &denominator); + } while (gearman_continue(ret)); + test_compare(GEARMAN_SUCCESS, ret); + + return TEST_SUCCESS; +} + +static test_return_t background_failure_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + gearman_job_handle_t job_handle; + bool is_known; + bool is_running; + uint32_t numerator; + uint32_t denominator; + + gearman_return_t rc= gearman_client_do_background(client, "does_not_exist", NULL, + gearman_literal_param("background_failure_test"), + job_handle); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_client_error(client)); + + do { + rc= gearman_client_job_status(client, job_handle, &is_known, &is_running, + &numerator, &denominator); + test_true(is_known == true and is_running == false and numerator == 0 and denominator == 0); + } while (gearman_continue(rc)); // We do not test for is_known since the server will keep the job around until a worker comes along + test_compare(GEARMAN_SUCCESS, rc); + + return TEST_SUCCESS; +} + +static test_return_t add_servers_test(void *) +{ + gearman_client_st client, *client_ptr; + + client_ptr= gearman_client_create(&client); + test_truth(client_ptr); + + gearman_return_t rc; + rc= gearman_client_add_servers(&client, "127.0.0.1:4730,localhost"); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_strerror(rc)); + + rc= gearman_client_add_servers(&client, "old_jobserver:7003,broken:12345"); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_strerror(rc)); + + gearman_client_free(&client); + + return TEST_SUCCESS; +} + +static test_return_t hostname_resolution(void *) +{ + gearman_client_st *client= gearman_client_create(NULL); + test_truth(client); + + test_compare(GEARMAN_SUCCESS, + gearman_client_add_servers(client, "exist.gearman.info")); + + test_compare(GEARMAN_GETADDRINFO, + gearman_client_echo(client, gearman_literal_param("foo"))); + + gearman_client_free(client); + + return TEST_SUCCESS; +} + +static test_return_t bug_518512_test(void *) +{ + gearman_client_st client; + size_t result_size; + + test_truth(gearman_client_create(&client)); + + gearman_return_t rc; + test_compare(GEARMAN_SUCCESS, + gearman_client_add_server(&client, NULL, CLIENT_TEST_PORT)); + + gearman_client_set_timeout(&client, 100); + void *result= gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, + &result_size, &rc); + test_compare_got(GEARMAN_TIMEOUT, rc, gearman_strerror(rc)); + test_false(result); + test_compare(0, result_size); + + gearman_function_t func_arg= gearman_function_create_v1(client_test_temp_worker); + struct worker_handle_st *completion_worker= test_worker_start(CLIENT_TEST_PORT, NULL, "client_test_temp", + func_arg, NULL, gearman_worker_options_t()); + + gearman_client_set_timeout(&client, -1); + result= gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, + &result_size, &rc); + test_true_got(rc != GEARMAN_TIMEOUT, gearman_strerror(rc)); + (void)result; + + test_worker_stop(completion_worker); + gearman_client_free(&client); + + return TEST_SUCCESS; +} + +#define NUMBER_OF_WORKERS 2 + +static test_return_t loop_test(void *) +{ + void *unused; + pthread_attr_t attr; + + pthread_t one; + pthread_t two; + + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); + + struct worker_handle_st *handles[NUMBER_OF_WORKERS]; + gearman_function_t func_arg= gearman_function_create_v1(client_test_temp_worker); + for (size_t x= 0; x < NUMBER_OF_WORKERS; x++) + { + handles[x]= test_worker_start(CLIENT_TEST_PORT, NULL, "client_test_temp", + func_arg, NULL, gearman_worker_options_t()); + } + + pthread_create(&one, &attr, client_thread, NULL); + pthread_create(&two, &attr, client_thread, NULL); + + pthread_join(one, &unused); + pthread_join(two, &unused); + + for (size_t x= 0; x < NUMBER_OF_WORKERS; x++) + { + test_worker_stop(handles[x]); + } + + pthread_attr_destroy(&attr); + + return TEST_SUCCESS; +} + +static test_return_t regression_785203_do_test(void *object) +{ + gearman_client_st *original_client= (gearman_client_st *)object; + test_true(original_client); + + const char *worker_function= (const char *)gearman_client_context(original_client); + test_truth(original_client); + + gearman_client_st *client; + test_truth(client= gearman_client_create(NULL)); + + test_compare(GEARMAN_SUCCESS, + gearman_client_add_server(client, NULL, CLIENT_TEST_PORT)); + + gearman_client_add_options(client, GEARMAN_CLIENT_FREE_TASKS); + { // All defaults, except timeout_return + test_truth(client->options.allocated); + test_false(client->options.non_blocking); + test_false(client->options.unbuffered_result); + test_false(client->options.no_new); + test_truth(client->options.free_tasks); + } + + gearman_return_t rc; + size_t result_length; + void *result= gearman_client_do(client, worker_function, NULL, + gearman_literal_param("keep it rocking and sing"), + &result_length, &rc); + test_true(result); + free(result); + + gearman_client_free(client); + + return TEST_SUCCESS; +} + +static test_return_t regression_785203_do_background_test(void *object) +{ + gearman_client_st *original_client= (gearman_client_st *)object; + test_true(original_client); + + const char *worker_function= (const char *)gearman_client_context(original_client); + test_truth(worker_function); + + gearman_client_st *client; + test_truth(client= gearman_client_create(NULL)); + + test_compare(GEARMAN_SUCCESS, + gearman_client_add_server(client, NULL, CLIENT_TEST_PORT)); + + gearman_client_add_options(client, GEARMAN_CLIENT_FREE_TASKS); + { // All defaults, except timeout_return + test_truth(client->options.allocated); + test_false(client->options.non_blocking); + test_false(client->options.unbuffered_result); + test_false(client->options.no_new); + test_truth(client->options.free_tasks); + } + + gearman_job_handle_t job_handle; + test_compare_got(GEARMAN_SUCCESS, + gearman_client_do_background(client, worker_function, + NULL, // No unique requested + gearman_literal_param("keep it rocking and sing"), + job_handle), + gearman_client_error(client)); + + gearman_return_t ret; + do + { + uint32_t numerator; + uint32_t denominator; + + ret= gearman_client_job_status(client, job_handle, NULL, NULL, &numerator, &denominator); + } while (gearman_continue(ret)); + test_compare(GEARMAN_SUCCESS, ret); + + gearman_client_free(client); + + return TEST_SUCCESS; +} + +static test_return_t regression_768317_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + test_true(client); + size_t result_length; + gearman_return_t rc; + char *job_result= (char*)gearman_client_do(client, "increment_reset_worker", + NULL, + gearman_literal_param("reset"), + &result_length, &rc); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_strerror(rc)); + test_false(job_result); + + // Check to see that the task ran just once + job_result= (char*)gearman_client_do(client, "increment_reset_worker", + NULL, + gearman_literal_param("10"), + &result_length, &rc); + test_compare_got(GEARMAN_SUCCESS, rc, gearman_client_error(client)); + test_truth(job_result); + long count= strtol(job_result, (char **)NULL, 10); + test_compare(10, count); + free(job_result); + + // Check to see that the task ran just once out of the bg queue + { + gearman_job_handle_t job_handle; + rc= gearman_client_do_background(client, + "increment_reset_worker", + NULL, + gearman_literal_param("14"), + job_handle); + test_compare(GEARMAN_SUCCESS, rc); + + bool is_known; + do { + rc= gearman_client_job_status(client, job_handle, &is_known, NULL, NULL, NULL); + } while (gearman_continue(rc) or is_known); + test_compare(GEARMAN_SUCCESS, rc); + + job_result= (char*)gearman_client_do(client, "increment_reset_worker", + NULL, + gearman_literal_param("10"), + &result_length, &rc); + test_compare(GEARMAN_SUCCESS, rc); + test_truth(job_result); + count= atol(job_result); + test_compare(34, count); + free(job_result); + } + + return TEST_SUCCESS; +} + +static test_return_t submit_log_failure(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_truth(client); + gearman_string_t value= { gearman_literal_param("submit_log_failure") }; + + const char *worker_function= (const char *)gearman_client_context(client); + test_truth(worker_function); + + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, + gearman_string_param(value), + &result_length, &rc); + test_compare(GEARMAN_NO_SERVERS, rc); + test_false(job_result); + test_compare(0, result_length); + + return TEST_SUCCESS; +} + +static void log_counter(const char *line, gearman_verbose_t verbose, + void *context) +{ + uint32_t *counter= (uint32_t *)context; + + (void)verbose; + (void)line; + + *counter= *counter + 1; +} + +static test_return_t strerror_count(void *) +{ + test_compare((int)GEARMAN_MAX_RETURN, 51); + + return TEST_SUCCESS; +} + +#undef MAKE_NEW_STRERROR + +static char * make_number(uint32_t expected, uint32_t got) +{ + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "Expected %uU, got %uU", expected, got); + + return strdup(buffer); +} + +static test_return_t strerror_strings(void *) +{ + uint32_t values[]= { + 2723107532U, 1294272985U, 949848612U, 646434617U, + 2273096667U, 3411376012U, 978198404U, 2644287234U, + 1762137345U, 1727436301U, 1103093142U, 2958899803U, + 3844590487U, 3520316764U, 3288532333U, 697573278U, + 2328987341U, 1321921098U, 1475770122U, 4011631587U, + 2468981698U, 2935753385U, 884320816U, 3006705975U, + 2840498210U, 2953034368U, 501858685U, 1635925784U, + 880765771U, 15612712U, 1489284002U, 2968621609U, + 79936336U, 3059874010U, 3562217099U, 13337402U, + 132823274U, 3950859856U, 237150774U, 290535510U, + 2101976744U, 2262698284U, 3182950564U, 2391595326U, + 1764731897U, 3485422815U, 99607280U, 2348849961U, + 607991020U, 1597605008U, 1377573125U }; + + for (int rc= GEARMAN_SUCCESS; rc < GEARMAN_MAX_RETURN; rc++) + { + uint32_t hash_val; + const char *msg= gearman_strerror((gearman_return_t)rc); + hash_val= internal_generate_hash(msg, strlen(msg)); + test_compare_got(values[rc], hash_val, make_number(values[rc], hash_val)); + } + + return TEST_SUCCESS; +} + +static uint32_t global_counter; + +static test_return_t pre_chunk(void *object) +{ + client_test_st *all= (client_test_st *)object; + + all->set_worker_name(WORKER_CHUNKED_FUNCTION_NAME); + + return TEST_SUCCESS; +} + +static test_return_t pre_v2(void *object) +{ + client_test_st *all= (client_test_st *)object; + + all->set_worker_name(WORKER_FUNCTION_NAME"_v2"); + + return TEST_SUCCESS; +} + +static test_return_t pre_chunk_v2(void *object) +{ + client_test_st *all= (client_test_st *)object; + + all->set_worker_name(WORKER_CHUNKED_FUNCTION_NAME"_v2"); + + return TEST_SUCCESS; +} + +static test_return_t pre_free_tasks(void *object) +{ + client_test_st *all= (client_test_st *)object; + + gearman_client_add_options(all->client(), GEARMAN_CLIENT_FREE_TASKS); + + return TEST_SUCCESS; +} + +static test_return_t post_free_tasks(void *object) +{ + client_test_st *all= (client_test_st *)object; + + gearman_client_remove_options(all->client(), GEARMAN_CLIENT_FREE_TASKS); + + return TEST_SUCCESS; +} + +static test_return_t pre_namespace(void *object) +{ + client_test_st *all= (client_test_st *)object; + + gearman_client_set_namespace(all->client(), NAMESPACE_KEY, strlen(NAMESPACE_KEY)); + assert(not gearman_client_has_option(all->client(), GEARMAN_CLIENT_FREE_TASKS)); + + return TEST_SUCCESS; +} + +static test_return_t pre_unique(void *object) +{ + client_test_st *all= (client_test_st *)object; + + all->set_worker_name(WORKER_UNIQUE_FUNCTION_NAME); + + return TEST_SUCCESS; +} + +static test_return_t post_function_reset(void *object) +{ + client_test_st *all= (client_test_st *)object; + + all->set_worker_name(WORKER_FUNCTION_NAME); + gearman_client_set_namespace(all->client(), 0, 0); + assert(not gearman_client_has_option(all->client(), GEARMAN_CLIENT_FREE_TASKS)); + + return TEST_SUCCESS; +} + +static test_return_t pre_logging(void *object) +{ + client_test_st *all= (client_test_st *)object; + gearman_log_fn *func= log_counter; + global_counter= 0; + all->reset_client(); + all->set_clone(false); + + gearman_client_set_log_fn(all->client(), func, &global_counter, GEARMAN_VERBOSE_MAX); + + return TEST_SUCCESS; +} + +static test_return_t post_logging(void *) +{ + test_truth(global_counter); + + return TEST_SUCCESS; +} + +void *client_test_temp_worker(gearman_job_st *, void *, + size_t *result_size, gearman_return_t *ret_ptr) +{ + *result_size= 0; + *ret_ptr= GEARMAN_SUCCESS; + return NULL; +} + +void *world_create(test_return_t *error) +{ + client_test_st *test= new client_test_st(); + pid_t gearmand_pid; + + /** + * @TODO We cast this to char ** below, which is evil. We need to do the + * right thing + */ + const char *argv[1]= { "client_gearmand" }; + + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + /** + We start up everything before we allocate so that we don't have to track memory in the forked process. + */ + gearmand_pid= test_gearmand_start(CLIENT_TEST_PORT, 1, argv); + + if (gearmand_pid == -1) + { + *error= TEST_FAILURE; + return NULL; + } + + // Version 1 functions + gearman_function_t echo_react_fn_v1= gearman_function_create_v1(echo_or_react_worker); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, WORKER_FUNCTION_NAME, echo_react_fn_v1, NULL, gearman_worker_options_t())); + gearman_function_t echo_react_chunk_fn_v1= gearman_function_create_v1(echo_or_react_chunk_worker); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, WORKER_CHUNKED_FUNCTION_NAME, echo_react_chunk_fn_v1, NULL, gearman_worker_options_t())); + + // Version 2 functsions + gearman_function_t echo_react_fn_v2= gearman_function_create(echo_or_react_worker_v2); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, WORKER_FUNCTION_NAME"_v2", echo_react_fn_v2, NULL, gearman_worker_options_t())); + gearman_function_t echo_react_chunk_fn_v2= gearman_function_create(echo_or_react_chunk_worker_v2); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, WORKER_CHUNKED_FUNCTION_NAME"_v2", echo_react_chunk_fn_v2, NULL, gearman_worker_options_t())); + + gearman_function_t unique_worker_arg= gearman_function_create_v1(unique_worker); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, WORKER_UNIQUE_FUNCTION_NAME, unique_worker_arg, NULL, GEARMAN_WORKER_GRAB_UNIQ)); + + gearman_function_t split_worker_fn= gearman_function_create_partition(split_worker, cat_aggregator_fn); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, WORKER_SPLIT_FUNCTION_NAME, split_worker_fn, NULL, GEARMAN_WORKER_GRAB_ALL)); + + // Namespace versions of the above + test->push(test_worker_start(CLIENT_TEST_PORT, NAMESPACE_KEY, WORKER_FUNCTION_NAME, echo_react_fn_v1, NULL, gearman_worker_options_t())); + test->push(test_worker_start(CLIENT_TEST_PORT, NAMESPACE_KEY, WORKER_CHUNKED_FUNCTION_NAME, echo_react_chunk_fn_v1, NULL, gearman_worker_options_t())); + test->push(test_worker_start(CLIENT_TEST_PORT, NAMESPACE_KEY, WORKER_SPLIT_FUNCTION_NAME, split_worker_fn, NULL, GEARMAN_WORKER_GRAB_ALL)); + + gearman_function_t increment_reset_worker_fn= gearman_function_create_v1(increment_reset_worker); + for (uint32_t x= 0; x < 10; x++) + { + test->push(test_worker_start(CLIENT_TEST_PORT, + NULL, + "increment_reset_worker", increment_reset_worker_fn, + NULL, gearman_worker_options_t())); + } + + // Count worker + gearman_function_t count_worker_fn= gearman_function_create(count_worker); + test->push(test_worker_start(CLIENT_TEST_PORT, NULL, "count", count_worker_fn, NULL, gearman_worker_options_t())); + + + test->gearmand_pid= gearmand_pid; + + if (gearman_failed(gearman_client_add_server(test->client(), NULL, CLIENT_TEST_PORT))) + { + *error= TEST_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return (void *)test; +} + + +test_return_t world_destroy(void *object) +{ + client_test_st *test= (client_test_st *)object; + delete test; + + return TEST_SUCCESS; +} + + +test_st tests[] ={ + {"init", 0, init_test }, + {"allocation", 0, allocation_test }, + {"clone_test", 0, clone_test }, + {"echo", 0, echo_test }, + {"options", 0, option_test }, + {"submit_job", 0, submit_job_test }, + {"submit_null_job", 0, submit_null_job_test }, + {"submit_fail_job", 0, submit_fail_job_test }, + {"exception", 0, submit_exception_job_test }, + {"warning", 0, submit_warning_job_test }, + {"submit_multiple_do", 0, submit_multiple_do }, + {"gearman_client_job_status()", 0, gearman_client_job_status_test }, + {"gearman_client_job_status() with gearman_return_t", 0, gearman_client_job_status_with_return }, + {"background_failure", 0, background_failure_test }, + {"add_servers", 0, add_servers_test }, + {"bug_518512_test", 0, bug_518512_test }, + {"gearman_client_add_servers(GEARMAN_GETADDRINFO)", 0, hostname_resolution }, + {"loop_test", 0, loop_test }, + {0, 0, 0} +}; + +test_st gearman_command_t_tests[] ={ + {"gearman_command_t", 0, check_gearman_command_t }, + {0, 0, 0} +}; + + +test_st tests_log[] ={ + {"submit_log_failure", 0, submit_log_failure }, + {0, 0, 0} +}; + +test_st gearman_strerror_tests[] ={ + {"count", 0, strerror_count }, + {"strings", 0, strerror_strings }, + {0, 0, 0} +}; + +test_st unique_tests[] ={ + {"compare sent unique", 0, unique_compare_test }, + {0, 0, 0} +}; + +test_st gearman_client_set_workload_malloc_fn_tests[] ={ + {"gearman_client_set_workload_malloc_fn()", 0, gearman_client_set_workload_malloc_fn_test }, + {"gearman_client_set_workload_free_fn()", 0, gearman_client_set_workload_free_fn_test }, + {"submit job and check for usage of both malloc/free", 0, gearman_client_set_workload_allocators_test }, + {0, 0, 0} +}; + +test_st regression_tests[] ={ + {"lp:768317", 0, regression_768317_test }, + {"lp:785203 gearman_client_do()", 0, regression_785203_do_test }, + {"lp:785203 gearman_client_do_background()", 0, regression_785203_do_background_test }, + {0, 0, 0} +}; + +test_st gearman_client_do_tests[] ={ + {"gearman_client_do() fail huge unique", 0, gearman_client_do_huge_unique }, + {"gearman_client_do() with active background task", 0, gearman_client_do_with_active_background_task }, + {0, 0, 0} +}; + +test_st gearman_execute_tests[] ={ + {"gearman_execute()", 0, gearman_execute_test }, + {"gearman_execute(GEARMAN_WORK_FAIL)", 0, gearman_execute_fail_test }, + {"gearman_execute() epoch", 0, gearman_execute_epoch_test }, + {"gearman_execute() epoch and test gearman_job_handle_t", 0, gearman_execute_epoch_check_job_handle_test }, + {"gearman_execute(GEARMAN_TIMEOUT)", 0, gearman_execute_timeout_test }, + {"gearman_execute() background", 0, gearman_execute_bg_test }, + {"gearman_execute() multiple background", 0, gearman_execute_multile_bg_test }, + {0, 0, 0} +}; + +test_st gearman_client_do_background_tests[] ={ + {"gearman_client_do_background()", 0, gearman_client_do_background_basic }, + {"gearman_client_do_high_background()", 0, gearman_client_do_high_background_basic }, + {"gearman_client_do_low_background()", 0, gearman_client_do_low_background_basic }, + {0, 0, 0} +}; + +test_st gearman_client_do_job_handle_tests[] ={ + {"gearman_client_do_job_handle() no active tasks", 0, gearman_client_do_job_handle_no_active_task }, + {"gearman_client_do_job_handle() follow do command", 0, gearman_client_do_job_handle_follow_do }, + {0, 0, 0} +}; + +test_st gearman_execute_partition_tests[] ={ + {"gearman_execute_by_partition() map reduce", 0, gearman_execute_partition_basic }, + {"gearman_execute_by_partition(GEARMAN_ARGUMENT_TOO_LARGE) map reduce", 0, gearman_execute_partition_check_parameters }, + {"gearman_execute_by_partition(GEARMAN_WORK_FAIL) map reduce", 0, gearman_execute_partition_workfail }, + {"gearman_execute_by_partition() fail in reduction", 0, gearman_execute_partition_fail_in_reduction }, + {"gearman_execute() with V2 Worker that has aggregate defined", 0, gearman_execute_partition_use_as_function }, + {"gearman_execute_by_partition() no aggregate function", 0, gearman_execute_partition_no_aggregate }, + {0, 0, 0} +}; + +test_st gearman_client_set_server_option_tests[] ={ + {"gearman_client_set_server_option(exceptions)", 0, gearman_client_set_server_option_exception}, + {"gearman_client_set_server_option(bad)", 0, gearman_client_set_server_option_bad}, + {0, 0, 0} +}; + +test_st gearman_task_tests[] ={ + {"gearman_client_add_task() ", 0, gearman_client_add_task_test}, + {"gearman_client_add_task() fail", 0, gearman_client_add_task_test_fail}, + {"gearman_client_add_task() bad workload", 0, gearman_client_add_task_test_bad_workload}, + {"gearman_client_add_task_background()", 0, gearman_client_add_task_background_test}, + {"gearman_client_add_task_low_background()", 0, gearman_client_add_task_low_background_test}, + {"gearman_client_add_task_high_background()", 0, gearman_client_add_task_high_background_test}, + {"gearman_client_add_task() exception", 0, gearman_client_add_task_exception}, + {"gearman_client_add_task() warning", 0, gearman_client_add_task_warning}, + {"gearman_client_add_task(GEARMAN_NO_SERVERS)", 0, gearman_client_add_task_no_servers}, + {"gearman_client_set_task_context_free_fn()", 0, gearman_client_set_task_context_free_fn_test}, + {0, 0, 0} +}; + +test_st gearman_task_pause_tests[] ={ + {"gearman_client_add_task(GEARMAN_PAUSE)", 0, gearman_client_add_task_pause_test}, + {0, 0, 0} +}; + + +collection_st collection[] ={ + {"gearman_client_st", 0, 0, tests}, + {"gearman_client_st chunky", pre_chunk, post_function_reset, tests}, // Test with a worker that will respond in part + {"gearman_strerror()", 0, 0, gearman_strerror_tests}, + {"gearman_task_add_task()", 0, 0, gearman_task_tests}, + {"gearman_task_add_task() v2 workers", pre_v2, post_function_reset, gearman_task_tests}, + {"gearman_task_add_task() chunky", pre_chunk, post_function_reset, gearman_task_tests}, + {"gearman_task_add_task() chunky v2 workers", pre_chunk_v2, post_function_reset, gearman_task_tests}, + {"gearman_task_add_task() namespace", pre_namespace, post_function_reset, gearman_task_tests}, + {"gearman_task_add_task(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, post_free_tasks, gearman_task_tests}, + {"gearman_task_add_task(GEARMAN_PAUSE)", pre_chunk, post_function_reset, gearman_task_pause_tests}, + {"gearman_task_add_task(GEARMAN_PAUSE)", pre_chunk_v2, post_function_reset, gearman_task_pause_tests}, + {"unique", pre_unique, post_function_reset, unique_tests}, + {"gearman_client_set_workload_malloc_fn()", 0, 0, gearman_client_set_workload_malloc_fn_tests}, + {"gearman_client_do()", 0, 0, gearman_client_do_tests}, + {"gearman_client_do() namespace", pre_namespace, post_function_reset, gearman_client_do_tests}, + {"gearman_client_do(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, post_free_tasks, gearman_client_do_tests}, + {"gearman_client_do_job_handle()", 0, 0, gearman_client_do_job_handle_tests}, + {"gearman_client_do_job_handle() namespace", pre_namespace, post_function_reset, gearman_client_do_job_handle_tests}, + {"gearman_client_do_job_handle(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, post_free_tasks, gearman_client_do_job_handle_tests}, + {"gearman_client_do_background()", 0, 0, gearman_client_do_background_tests}, + {"gearman_client_do_background(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, post_free_tasks, gearman_client_do_background_tests}, + {"gearman_client_set_server_option", 0, 0, gearman_client_set_server_option_tests}, + {"gearman_execute()", 0, 0, gearman_execute_tests}, + {"gearman_execute(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, post_free_tasks, gearman_execute_tests}, + {"gearman_execute() chunked return", pre_chunk, post_function_reset, gearman_execute_tests}, + {"gearman_execute() chunked return", pre_chunk_v2, post_function_reset, gearman_execute_tests}, + {"gearman_execute_partition()", 0, 0, gearman_execute_partition_tests}, + {"gearman_execute_partition(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, post_free_tasks, gearman_execute_partition_tests}, + {"gearman_command_t", 0, 0, gearman_command_t_tests}, + {"regression_tests", 0, 0, regression_tests}, + {"client-logging", pre_logging, post_logging, tests_log}, + {0, 0, 0, 0} +}; + +typedef test_return_t (*libgearman_test_prepost_callback_fn)(client_test_st *); +typedef test_return_t (*libgearman_test_callback_fn)(gearman_client_st *); +static test_return_t _runner_prepost_default(libgearman_test_prepost_callback_fn func, client_test_st *container) +{ + if (func) + { + return func(container); + } + + return TEST_SUCCESS; +} + +static test_return_t _runner_default(libgearman_test_callback_fn func, client_test_st *container) +{ + if (func) + { + test_return_t rc; + + if (container->clone()) + { + gearman_client_st *client= gearman_client_clone(NULL, container->client()); + test_truth(client); + gearman_client_set_context(client, (void *)container->worker_name()); + rc= func(client); + if (rc == TEST_SUCCESS) + { + test_true_got(not client->task_list, "Client still had tasks"); + } + + gearman_client_free(client); + } + else + { + gearman_client_set_context(container->client(), (void *)container->worker_name()); + rc= func(container->client()); + assert(not container->client()->task_list); + } + + return rc; + } + + return TEST_SUCCESS; +} + +static Runner runner= { + (test_callback_runner_fn*)_runner_prepost_default, + (test_callback_runner_fn*)_runner_default, + (test_callback_runner_fn*)_runner_prepost_default +}; + + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; + world->runner= &runner; +} diff -Nru gearmand-0.14/tests/context.h gearmand-0.23/tests/context.h --- gearmand-0.14/tests/context.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/context.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,99 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#pragma once + +#include +#include +#include + +class Context +{ +public: + pid_t gearmand_pid; + gearman_worker_st *worker; + in_port_t _port; + std::string _worker_function_name; + bool run_worker; + + Context(in_port_t port_arg): + gearmand_pid(-1), + worker(NULL), + _port(port_arg), + _worker_function_name("queue_test"), + run_worker(false) + { + } + + const char *worker_function_name() const + { + return _worker_function_name.c_str(); + } + + in_port_t port() const + { + return _port; + } + + bool initialize(int argc, const char *argv[]) + { + gearmand_pid= test_gearmand_start(_port, argc, argv); + if (gearmand_pid == -1) + return false; + + if ((worker= gearman_worker_create(NULL)) == NULL) + return false; + + if (gearman_worker_add_server(worker, NULL, _port) != GEARMAN_SUCCESS) + return false; + + return true; + } + + void reset() + { + test_gearmand_stop(gearmand_pid); + gearman_worker_free(worker); + + unlink("tests/gearman.sql"); + unlink("tests/gearman.sql-journal"); + + worker= NULL; + gearmand_pid= -1; + } +}; diff -Nru gearmand-0.14/tests/cpp_test.cc gearmand-0.23/tests/cpp_test.cc --- gearmand-0.14/tests/cpp_test.cc 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/cpp_test.cc 2011-06-25 01:37:00.000000000 +0200 @@ -6,19 +6,15 @@ * the COPYING file in the parent directory for full text. */ -/** - * @file +/* * @brief C++ dummy test, aka testing C++ linking, etc */ -#include -#include -#include -#include +#include // For EXIT_SUCCESS #include int main(void) { - return 0; + return EXIT_SUCCESS; } diff -Nru gearmand-0.14/tests/c_test.c gearmand-0.23/tests/c_test.c --- gearmand-0.14/tests/c_test.c 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/c_test.c 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,48 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearman C test app + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * @file @brief C dummy test, aka testing C linking, etc + */ + +#include + +#include + +int main(void) +{ + return EXIT_SUCCESS; +} diff -Nru gearmand-0.14/tests/do_background.cc gearmand-0.23/tests/do_background.cc --- gearmand-0.14/tests/do_background.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/do_background.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,99 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_client_do_background_basic(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + char job_handle[GEARMAN_JOB_HANDLE_SIZE]= {0}; + + gearman_return_t rc= gearman_client_do_background(client, + worker_function, + NULL, + gearman_literal_param("foobar"), + job_handle); + test_true_got(rc == GEARMAN_SUCCESS, gearman_client_error(client)); + test_truth(job_handle[0]); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_do_high_background_basic(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + char job_handle[GEARMAN_JOB_HANDLE_SIZE]= {0}; + + gearman_return_t rc= gearman_client_do_high_background(client, + worker_function, + NULL, + gearman_literal_param("foobar"), + job_handle); + test_true_got(rc == GEARMAN_SUCCESS, gearman_client_error(client)); + test_truth(job_handle[0]); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_do_low_background_basic(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + char job_handle[GEARMAN_JOB_HANDLE_SIZE]= {0}; + + gearman_return_t rc= gearman_client_do_low_background(client, + worker_function, + NULL, + gearman_literal_param("foobar"), + job_handle); + + test_true_got(rc == GEARMAN_SUCCESS, gearman_client_error(client)); + test_truth(job_handle[0]); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/do_background.h gearmand-0.23/tests/do_background.h --- gearmand-0.14/tests/do_background.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/do_background.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,42 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t gearman_client_do_background_basic(void *object); +test_return_t gearman_client_do_high_background_basic(void *object); +test_return_t gearman_client_do_low_background_basic(void *object); diff -Nru gearmand-0.14/tests/do.cc gearmand-0.23/tests/do.cc --- gearmand-0.14/tests/do.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/do.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,102 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_client_do_huge_unique(void *object) +{ + gearman_return_t rc; + gearman_client_st *client= (gearman_client_st *)object; + void *job_result; + size_t job_length; + char buffer[GEARMAN_UNIQUE_SIZE +10]; + memset(&buffer, 'x', sizeof(buffer)); + buffer[sizeof(buffer) -1]= 0; + + const char *worker_function= (const char *)gearman_client_context(client); + job_result= gearman_client_do(client, worker_function, + buffer, + gearman_literal_param("gearman_client_do_huge_unique"), + &job_length, + &rc); + test_true_got(rc == GEARMAN_SERVER_ERROR, gearman_strerror(rc)); + test_true_got(rc == GEARMAN_SERVER_ERROR, gearman_client_error(client)); + test_false(job_result); + test_false(job_length); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_do_with_active_background_task(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + gearman_task_st *epoch_task; + { // Start up epoch_task + gearman_task_attr_t work_description= gearman_task_attr_init_epoch(time(NULL) +5, GEARMAN_JOB_PRIORITY_NORMAL); + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + test_true_got(epoch_task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, &work_description, &value, 0), gearman_client_error(client)); + test_truth(epoch_task); + test_truth(gearman_task_job_handle(epoch_task)); + } + + gearman_string_t value= { gearman_literal_param("submit_job_test") }; + size_t result_length; + gearman_return_t rc; + void *job_result= gearman_client_do(client, worker_function, NULL, gearman_string_param(value), &result_length, &rc); + + test_true_got(rc == GEARMAN_SUCCESS, gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + test_truth(job_result); + test_compare(gearman_size(value), result_length); + + test_memcmp(gearman_c_str(value), job_result, gearman_size(value)); + + free(job_result); + gearman_task_free(epoch_task); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/do.h gearmand-0.23/tests/do.h --- gearmand-0.14/tests/do.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/do.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,42 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t gearman_client_do_huge_unique(void *); + +test_return_t gearman_client_do_with_active_background_task(void *); diff -Nru gearmand-0.14/tests/drizzle_test.cc gearmand-0.23/tests/drizzle_test.cc --- gearmand-0.14/tests/drizzle_test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/drizzle_test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,110 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#define WORKER_FUNCTION "drizzle_queue_test" + +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); +test_return_t collection_init(void *object); +test_return_t collection_cleanup(void *object); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t collection_init(void *object) +{ + const char *argv[2]= { "test_gearmand", "--queue-type=libdrizzle" }; + + Context *test= (Context *)object; + assert(test); + + test_true_got(test->initialize(2, argv), getenv("GEARMAN_SERVER_STARTUP")); + + return TEST_SUCCESS; +} + +test_return_t collection_cleanup(void *object) +{ + Context *test= (Context *)object; + test->reset(); + + return TEST_SUCCESS; +} + + +void *world_create(test_return_t *error) +{ + Context *test= new Context(DRIZZLE_TEST_PORT); + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return test; +} + +test_return_t world_destroy(void *object) +{ + Context *test= (Context *)object; + + delete test; + + return TEST_SUCCESS; +} + +test_st tests[] ={ + {"gearman_client_echo()", 0, client_echo_test }, + {"gearman_client_echo() fail", 0, client_echo_fail_test }, + {"gearman_worker_echo()", 0, worker_echo_test }, + {"clean", 0, queue_clean }, + {"add", 0, queue_add }, + {"worker", 0, queue_worker }, + {0, 0, 0} +}; + +test_st regressions[] ={ + {"lp:734663", 0, lp_734663 }, + {0, 0, 0} +}; + +collection_st collection[] ={ +#ifdef HAVE_LIBDRIZZLE + {"drizzle queue", collection_init, collection_cleanup, tests}, + {"regressions", collection_init, collection_cleanup, regressions}, +#endif + {0, 0, 0, 0} +}; + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; +} diff -Nru gearmand-0.14/tests/execute.cc gearmand-0.23/tests/execute.cc --- gearmand-0.14/tests/execute.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/execute.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,204 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_execute_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, NULL, &value, 0), gearman_client_error(client)); + test_compare(gearman_literal_param_size("test load"), gearman_result_size(gearman_task_result(task))); + test_false(gearman_task_is_known(task)); + test_false(gearman_task_is_running(task)); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_fail_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("fail")); + + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, NULL, &value, 0), gearman_client_error(client)); + test_compare_got(GEARMAN_WORK_FAIL, gearman_task_return(task), gearman_task_error(task)); + test_false(gearman_task_is_known(task)); + test_false(gearman_task_is_running(task)); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_timeout_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + test_truth(client); + + gearman_client_set_timeout(client, 4); + + // We should fail since the the timeout is small and the function should + // not exist. + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, NULL, &value, 0), gearman_client_error(client)); + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_epoch_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + gearman_task_attr_t workload= gearman_task_attr_init_epoch(time(NULL) +5, GEARMAN_JOB_PRIORITY_NORMAL); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, &workload, &value, 0), gearman_client_error(client)); + test_truth(task); + test_truth(gearman_task_job_handle(task)); + test_true(gearman_task_is_known(task)); + test_false(gearman_task_is_running(task)); + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_epoch_check_job_handle_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + gearman_task_attr_t workload= gearman_task_attr_init_epoch(time(NULL) +5, GEARMAN_JOB_PRIORITY_NORMAL); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, &workload, &value, 0), gearman_client_error(client)); + + test_truth(task); + test_truth(gearman_task_job_handle(task)); + + gearman_return_t rc; + bool is_known; + do { + rc= gearman_client_job_status(client, gearman_task_job_handle(task), &is_known, NULL, NULL, NULL); + } while (gearman_continue(rc) or is_known); + test_compare(GEARMAN_SUCCESS, rc); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_bg_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + gearman_task_attr_t workload= gearman_task_attr_init_background(GEARMAN_JOB_PRIORITY_NORMAL); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), gearman_literal_param("my id"), &workload, &value, 0), + gearman_client_error(client)); + + // Lets make sure we have a task + test_truth(task); + test_truth(gearman_task_job_handle(task)); + + test_true_got(gearman_success(gearman_client_run_tasks(client)), gearman_client_error(client)); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_multile_bg_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + for (uint32_t x= 0; x < 4; /* No reason for number */ x++) + { + gearman_task_attr_t workload= gearman_task_attr_init_background(GEARMAN_JOB_PRIORITY_NORMAL); + + gearman_task_st *task; + gearman_argument_t value= gearman_argument_make(0, 0, gearman_literal_param("test load")); + test_true_got(task= gearman_execute(client, gearman_c_str_param(worker_function), NULL, 0, &workload, &value, 0), + gearman_client_error(client)); + + // Lets make sure we have a task + test_truth(task); + test_truth(gearman_task_job_handle(task)); + } + + gearman_return_t rc; + test_true_got(gearman_success(rc= gearman_client_run_tasks(client)), gearman_strerror(rc)); + + gearman_client_task_free_all(client); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/execute.h gearmand-0.23/tests/execute.h --- gearmand-0.14/tests/execute.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/execute.h 2011-06-10 09:23:01.000000000 +0200 @@ -0,0 +1,46 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t gearman_execute_test(void *object); +test_return_t gearman_execute_fail_test(void *object); +test_return_t gearman_execute_timeout_test(void *object); +test_return_t gearman_execute_epoch_test(void *object); +test_return_t gearman_execute_epoch_check_job_handle_test(void *object); +test_return_t gearman_execute_bg_test(void *object); +test_return_t gearman_execute_multile_bg_test(void *object); diff -Nru gearmand-0.14/tests/gearman_client_do_job_handle.cc gearmand-0.23/tests/gearman_client_do_job_handle.cc --- gearmand-0.14/tests/gearman_client_do_job_handle.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/gearman_client_do_job_handle.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,84 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_client_do_job_handle_no_active_task(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + assert(client); + + const char *job_handle= gearman_client_do_job_handle(client); + test_true(job_handle); + test_compare(0, job_handle[0]); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_do_job_handle_follow_do(void *object) +{ + gearman_return_t rc; + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + size_t job_length; + uint8_t *value= (uint8_t *)"submit_job_test"; + size_t value_length= strlen("submit_job_test"); + + void *job_result; + job_result= gearman_client_do(client, worker_function, NULL, value, + value_length, &job_length, &rc); + + test_true_got(rc == GEARMAN_SUCCESS, gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + test_true(gearman_client_do_job_handle(client)); + test_truth(job_result); + test_compare(value_length, job_length); + + test_memcmp(value, job_result, value_length); + + free(job_result); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/gearman_client_do_job_handle.h gearmand-0.23/tests/gearman_client_do_job_handle.h --- gearmand-0.14/tests/gearman_client_do_job_handle.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/gearman_client_do_job_handle.h 2011-06-02 22:23:36.000000000 +0200 @@ -0,0 +1,41 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t gearman_client_do_job_handle_no_active_task(void *object); +test_return_t gearman_client_do_job_handle_follow_do(void *object); diff -Nru gearmand-0.14/tests/gearman_execute_partition.cc gearmand-0.23/tests/gearman_execute_partition.cc --- gearmand-0.14/tests/gearman_execute_partition.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/gearman_execute_partition.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,223 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_execute_partition_check_parameters(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + test_true_got(gearman_success(gearman_client_echo(client, gearman_literal_param("this is mine"))), gearman_client_error(client)); + + // This just hear to make it easier to trace when gearman_execute() is + // called (look in the log to see the failed option setting. + gearman_client_set_server_option(client, gearman_literal_param("should fail")); + gearman_argument_t workload= gearman_argument_make(0, 0, gearman_literal_param("this dog does not hunt")); + + gearman_task_st *task; + + // Test client as NULL + test_false(task= gearman_execute_by_partition(NULL, + gearman_literal_param("split_worker"), + gearman_literal_param("client_test"), + NULL, 0, // unique + NULL, + &workload, 0)); + + // Test no partition function + test_false(task= gearman_execute_by_partition(client, + NULL, 0, + NULL, 0, + NULL, 0, // unique + NULL, + &workload, 0)); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_partition_basic(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + test_true_got(gearman_success(gearman_client_echo(client, gearman_literal_param("this is mine"))), gearman_client_error(client)); + + // This just hear to make it easier to trace when + // gearman_execute_partition() is called (look in the log to see the + // failed option setting. + gearman_client_set_server_option(client, gearman_literal_param("should fail")); + gearman_argument_t workload= gearman_argument_make(0, 0, gearman_literal_param("this dog does not hunt")); + + gearman_task_st *task; + test_true_got(task= gearman_execute_by_partition(client, + gearman_literal_param("split_worker"), + gearman_literal_param("client_test"), + NULL, 0, // unique + NULL, + &workload, 0), gearman_client_error(client)); + + gearman_return_t rc; + test_true_got(gearman_success(rc= gearman_task_return(task)), gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + gearman_result_st *result= gearman_task_result(task); + test_truth(result); + const char *value= gearman_result_value(result); + test_truth(value); + test_compare(18, gearman_result_size(result)); + + gearman_task_free(task); + gearman_client_task_free_all(client); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_partition_workfail(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + test_true_got(gearman_success(gearman_client_echo(client, gearman_literal_param("this is mine"))), gearman_client_error(client)); + + gearman_argument_t workload= gearman_argument_make(0, 0, gearman_literal_param("this dog does not hunt mapper_fail")); + + gearman_task_st *task; + test_true_got(task= gearman_execute_by_partition(client, + gearman_literal_param("split_worker"), + gearman_string_param_cstr(worker_function), + NULL, 0, // unique + NULL, + &workload, 0), gearman_client_error(client)); + + test_compare_got(GEARMAN_WORK_FAIL, gearman_task_return(task), gearman_task_error(task)); + + gearman_task_free(task); + gearman_client_task_free_all(client); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_partition_fail_in_reduction(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + test_true_got(gearman_success(gearman_client_echo(client, gearman_literal_param("this is mine"))), gearman_client_error(client)); + + gearman_argument_t workload= gearman_argument_make(0, 0, gearman_literal_param("this dog does not hunt fail")); + + gearman_task_st *task; + test_true_got(task= gearman_execute_by_partition(client, + gearman_literal_param("split_worker"), + gearman_string_param_cstr(worker_function), + NULL, 0, // unique + NULL, + &workload, 0), gearman_client_error(client)); + + test_compare_got(GEARMAN_WORK_FAIL, gearman_task_return(task), gearman_task_error(task)); + + gearman_task_free(task); + gearman_client_task_free_all(client); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_partition_use_as_function(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + test_true_got(gearman_success(gearman_client_echo(client, gearman_literal_param("this is mine"))), gearman_client_error(client)); + + // This just hear to make it easier to trace when + // gearman_execute_partition() is called (look in the log to see the + // failed option setting. + gearman_client_set_server_option(client, gearman_literal_param("should fail")); + gearman_argument_t workload= gearman_argument_make(0, 0, gearman_literal_param("this dog does not hunt")); + + gearman_task_st *task; + test_true_got(task= gearman_execute(client, + gearman_literal_param("split_worker"), + NULL, 0, // unique + NULL, + &workload, 0), gearman_client_error(client)); + + gearman_return_t rc; + test_true_got(gearman_success(rc= gearman_task_return(task)), gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + gearman_result_st *result= gearman_task_result(task); + test_truth(result); + const char *value= gearman_result_value(result); + test_truth(value); + test_compare(18, gearman_result_size(result)); + + gearman_task_free(task); + gearman_client_task_free_all(client); + + return TEST_SUCCESS; +} + +test_return_t gearman_execute_partition_no_aggregate(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + + gearman_argument_t workload= gearman_argument_make(0, 0, gearman_literal_param("this dog does not hunt")); + + gearman_task_st *task; + test_true_got(task= gearman_execute_by_partition(client, + gearman_literal_param("client_test"), + gearman_literal_param("count"), + NULL, 0, // unique + NULL, + &workload, 0), gearman_client_error(client)); + + test_compare_got(GEARMAN_SUCCESS, + gearman_task_return(task), + gearman_client_error(client)); + + test_compare(GEARMAN_SUCCESS, gearman_task_return(task)); + test_false(gearman_task_result(task)); + + gearman_task_free(task); + gearman_client_task_free_all(client); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/gearman_execute_partition.h gearmand-0.23/tests/gearman_execute_partition.h --- gearmand-0.14/tests/gearman_execute_partition.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/gearman_execute_partition.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,45 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t gearman_execute_partition_check_parameters(void *); +test_return_t gearman_execute_partition_basic(void *); +test_return_t gearman_execute_partition_fail_in_reduction(void *); +test_return_t gearman_execute_partition_workfail(void *); +test_return_t gearman_execute_partition_use_as_function(void *); +test_return_t gearman_execute_partition_no_aggregate(void *); diff -Nru gearmand-0.14/tests/httpd.am gearmand-0.23/tests/httpd.am --- gearmand-0.14/tests/httpd.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/httpd.am 2011-03-24 02:19:49.000000000 +0100 @@ -0,0 +1,14 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +tests-httpd-args: gearmand/gearmand + @gearmand/gearmand --http-port=80 diff -Nru gearmand-0.14/tests/include.am gearmand-0.23/tests/include.am --- gearmand-0.14/tests/include.am 2010-06-30 20:30:58.000000000 +0200 +++ gearmand-0.23/tests/include.am 2011-06-29 22:18:02.000000000 +0200 @@ -1,185 +1,158 @@ # vim:ft=automake # Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in the parent directory for full text. -noinst_LTLIBRARIES+= tests/libtest.la -tests_libtest_la_SOURCES= tests/test.c tests/test_gearmand.c +VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --malloc-fill=A5 --free-fill=DE --track-fds=yes -VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes - -TEST_LDADD= \ - tests/libtest.la \ - libgearman/libgearman.la \ - libgearman-server/libgearman-server.la - - -if HAVE_LIBMEMCACHED -if HAVE_MEMCACHED -LIBMEMCACHED_PIDFILE = ${abs_top_builddir}/tests/Xumemc.pid -LIBMEMCACHED_TEST= tests/memcached_test -# Note, SETUP should do a test for existance and then kill if it exists. -LIBMEMCACHED_SETUP= @$(MEMCACHED_BINARY) -d -P ${LIBMEMCACHED_PIDFILE} -p 12555 -LIBMEMCACHED_TEARDOWN= @\ - cat ${LIBMEMCACHED_PIDFILE} | xargs kill; \ - rm ${LIBMEMCACHED_PIDFILE} - -noinst_PROGRAMS += tests/memcached_test -endif -endif - -tests_memcached_test_SOURCES= tests/memcached_test.c -tests_memcached_test_LDADD= ${TEST_LDADD} - -if HAVE_LIBSQLITE3 -SQLITE_TEST= tests/sqlite_test -SQLITE_RM= @rm -f tests/gearman.sql tests/gearman.sql-journal -CLEANFILES+= tests/gearman.sql tests/gearman.sql-journal -noinst_PROGRAMS += tests/sqlite_test -endif - -tests_sqlite_test_SOURCES= tests/sqlite_test.c -tests_sqlite_test_LDADD= ${TEST_LDADD} - -if HAVE_LIBTOKYOCABINET -TOKYOCABINET_TEST= tests/tokyocabinet_test -TOKYOCABINET_RM= @rm -f tests/gearman.tcb -CLEANFILES+= tests/gearman.tcb -noinst_PROGRAMS += tests/tokyocabinet_test -endif - -tests_tokyocabinet_test_SOURCES= tests/tokyocabinet_test.c -tests_tokyocabinet_test_LDADD= ${TEST_LDADD} +noinst_HEADERS+= \ + tests/basic.h \ + tests/context.h \ + tests/do.h \ + tests/do_background.h \ + tests/execute.h \ + tests/gearman_client_do_job_handle.h \ + tests/gearman_execute_partition.h \ + tests/ports.h \ + tests/protocol.h \ + tests/regression.h \ + tests/server_options.h \ + tests/task.h \ + tests/unique.h \ + tests/workers.h \ + tests/workers_v1.h + +CLIENT_LDADD= \ + libtest/libtest.la \ + libtest/libserver.la \ + libgearman/libgearman.la + +CLEANFILES+= \ + tests/var/log/* \ + tests/var/tmp/* noinst_PROGRAMS+= \ + tests/burnin_test \ tests/client_test \ + tests/c_test \ tests/cpp_test \ + tests/drizzle_test \ tests/internals_test \ - tests/regression_test \ tests/round_robin_test \ tests/worker_test -noinst_HEADERS+= \ - tests/test.h \ - tests/test_gearmand.h \ - tests/test_worker.h - -tests_client_test_SOURCES= tests/test_worker.c tests/client_test.c -tests_client_test_LDADD= ${TEST_LDADD} - -tests_internals_test_SOURCES= tests/internals.c -tests_internals_test_LDADD= ${TEST_LDADD} libgearman/libgearmancore.la - -tests_regression_test_SOURCES= tests/regression.c -tests_regression_test_LDADD= ${TEST_LDADD} libgearman/libgearmancore.la - -tests_round_robin_test_SOURCES= tests/round_robin.c -tests_round_robin_test_LDADD= ${TEST_LDADD} libgearman/libgearmancore.la - -tests_worker_test_SOURCES= tests/worker_test.c -tests_worker_test_LDADD= ${TEST_LDADD} +tests_client_test_SOURCES= \ + tests/client_test.cc \ + tests/do.cc \ + tests/do_background.cc \ + tests/execute.cc \ + tests/gearman_client_do_job_handle.cc \ + tests/gearman_execute_partition.cc \ + tests/protocol.cc \ + tests/server_options.cc \ + tests/task.cc \ + tests/unique.cc \ + tests/workers.cc \ + tests/workers_v1.cc +tests_client_test_LDADD= ${CLIENT_LDADD} +tests_client_test_DEPENDENCIES= ${CLIENT_LDADD} + +tests_burnin_test_SOURCES= tests/burnin.cc +tests_burnin_test_LDADD= ${CLIENT_LDADD} + +tests_internals_test_SOURCES= \ + tests/internals.cc \ + tests/regression.cc + +tests_internals_test_LDADD= ${CLIENT_LDADD} libgearman/libgearmancore.la +tests_internals_test_DEPENDENCIES= ${CLIENT_LDADD} libgearman/libgearmancore.la + +tests_round_robin_test_SOURCES= tests/round_robin.cc +tests_round_robin_test_LDADD= ${CLIENT_LDADD} libgearman/libgearmancore.la + +tests_worker_test_SOURCES= tests/worker_test.cc +tests_worker_test_LDADD= \ + ${CLIENT_LDADD} \ + libgearman/libgearmancore.la # Test linking with C++ application tests_cpp_test_SOURCES= tests/cpp_test.cc -tests_cpp_test_LDADD= ${TEST_LDADD} +tests_cpp_test_LDADD= ${CLIENT_LDADD} + +# Test linking with C application +tests_c_test_SOURCES= tests/c_test.c +tests_c_test_LDADD= ${CLIENT_LDADD} -test-client: +test-burnin: tests/burnin_test + @tests/burnin_test $(ARG1) $(ARG2) + +test-client: tests/client_test @tests/client_test $(ARG1) $(ARG2) -test-round-robin: - tests/round_robin_test $(ARG1) $(ARG2) +test-round-robin: tests/round_robin_test + @tests/round_robin_test $(ARG1) $(ARG2) -test-worker: +test-worker: tests/worker_test @tests/worker_test $(ARG1) $(ARG2) -test-internals: +test-internals: tests/internals_test @tests/internals_test $(ARG1) $(ARG2) -test-libmemcached: -if HAVE_LIBMEMCACHED -if HAVE_MEMCACHED - $(LIBMEMCACHED_SETUP) - $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) - $(LIBMEMCACHED_TEARDOWN) -endif -endif - -test-sqlite: -if HAVE_LIBSQLITE3 - $(SQLITE_TEST) $(ARG1) $(ARG2) - $(SQLITE_RM) -endif - -gdb-sqlite: -if HAVE_LIBSQLITE3 - $(LIBTOOL) --mode=execute gdb tests/sqlite_test - $(SQLITE_RM) -endif - -test-tokyocabinet: -if HAVE_LIBTOKYOCABINET - $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) - $(TOKYOCABINET_RM) -endif +check-local: tests/var gearmand-test-args client-test libtest-tests benchmark-test -check-local: test-client test-round-robin test-worker test-internals test-libmemcached test-sqlite test-tokyocabinet +libtest-tests: test-client test-round-robin test-worker test-internals test-libmemcached test-sqlite test-tokyocabinet test-burnin gdb-client: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/client_test + @$(LIBTOOL) --mode=execute gdb tests/client_test gdb-round-robin: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/round_robin_test + @$(LIBTOOL) --mode=execute gdb tests/round_robin_test gdb-worker: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/worker_test + @$(LIBTOOL) --mode=execute gdb tests/worker_test gdb-internals: ${noinst_PROGRAMS} - $(LIBTOOL) --mode=execute gdb tests/internals_test + @$(LIBTOOL) --mode=execute gdb tests/internals_test + +gdb-burnin: ${noinst_PROGRAMS} + @$(LIBTOOL) --mode=execute gdb tests/burnin_test valgrind-client: - $(VALGRIND_COMMAND) tests/client_test $(ARG1) $(ARG2) + @$(VALGRIND_COMMAND) tests/client_test $(ARG1) $(ARG2) valgrind-round-robin: - $(VALGRIND_COMMAND) tests/round_robin_test $(ARG1) $(ARG2) + @$(VALGRIND_COMMAND) tests/round_robin_test $(ARG1) $(ARG2) + +valgrind-worker: tests/worker_test + @$(VALGRIND_COMMAND) tests/worker_test $(ARG1) $(ARG2) + +valgrind-internals: tests/internals_test + @$(VALGRIND_COMMAND) tests/internals_test $(ARG1) $(ARG2) + +valgrind-burnin: tests/burnin_test + @$(VALGRIND_COMMAND) tests/burnin_test $(ARG1) $(ARG2) -valgrind-worker: - $(VALGRIND_COMMAND) tests/worker_test $(ARG1) $(ARG2) +tests/var: tests/var/log tests/var/tmp + $(mkdir_p) tests/var -valgrind-internals: - $(VALGRIND_COMMAND) tests/internals_test $(ARG1) $(ARG2) +tests/var/log: + $(mkdir_p) tests/var/log -valgrind-libmemcached: - $(LIBMEMCACHED_SETUP) - $(VALGRIND_COMMAND) $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) - $(LIBMEMCACHED_TEARDOWN) - -valgrind-sqlite: -if HAVE_LIBSQLITE3 - $(VALGRIND_COMMAND) $(SQLITE_TEST) $(ARG1) $(ARG2) - $(SQLITE_RM) -endif - -valgrind-tokyocabinet: -if HAVE_LIBTOKYOCABINET - $(VALGRIND_COMMAND) $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) - $(TOKYOCABINET_RM) -endif - -GEARMAN_CLIENT_TEST= bin/gearman -GEARMAN_PIDFILE = ${abs_top_builddir}/tests/Xugear.pid - -client-test: $(GEARMAN_CLIENT_TEST) - @$(GEARMAN_CLIENT_TEST) -H 2>&1 > /dev/null - @$(GEARMAN_CLIENT_TEST) -w -f true -d -i $(GEARMAN_PIDFILE) -- false - cat $(GEARMAN_PIDFILE) | xargs kill - @echo "gearman client success" +tests/var/tmp: + $(mkdir_p) tests/var/tmp -#valgrind: ${noinst_PROGRAMS} valgrind-client valgrind-worker valgrind-internals valgrind-sqlite valgrind-tokyocabinet +valgrind: ${noinst_PROGRAMS} valgrind-client valgrind-round-robin valgrind-worker valgrind-internals valgrind-sqlite valgrind-tokyocabinet valgrind-burnin -valgrind: ${noinst_PROGRAMS} valgrind-client valgrind-round-robin valgrind-worker valgrind-internals valgrind-sqlite valgrind-tokyocabinet +include tests/httpd.am +include tests/libdrizzle.am +include tests/libmemcached.am +include tests/postgres.am +include tests/sqlite.am +include tests/tokyocabinet.am bogus: diff -Nru gearmand-0.14/tests/internals.c gearmand-0.23/tests/internals.c --- gearmand-0.14/tests/internals.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/internals.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,431 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include - -#define GEARMAN_CORE -#include - -#include "test.h" -#include "test_gearmand.h" -#include "test_worker.h" - -#define CLIENT_TEST_PORT 32123 - -static test_return_t init_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st gear; - gearman_universal_st *gear_ptr; - - gear_ptr= gearman_universal_create(&gear, NULL); - test_false(gear.options.allocated); - test_false(gear_ptr->options.allocated); - test_false(gear.options.dont_track_packets); - test_false(gear.options.non_blocking); - test_false(gear.options.stored_non_blocking); - test_truth(gear_ptr == &gear); - - gearman_universal_free(&gear); - test_false(gear.options.allocated); - - return TEST_SUCCESS; -} - -static test_return_t clone_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st gear; - gearman_universal_st *gear_ptr; - - gear_ptr= gearman_universal_create(&gear, NULL); - test_truth(gear_ptr); - test_truth(gear_ptr == &gear); - -#if 0 - gearman_universal_st *gear_clone; - - /* For gearman_universal_st we don't allow NULL cloning creation */ - gear_clone= gearman_universal_clone(NULL, NULL); - test_truth(gear_clone); - gear_clone= gearman_universal_clone(NULL, &gear); - test_truth(gear_clone); - gear_clone= gearman_universal_clone(&gear, NULL); - test_truth(gear_clone); -#endif - - /* Can we init from null? */ - { - gearman_universal_st *gear_clone; - gearman_universal_st destination; - gear_clone= gearman_universal_clone(&destination, &gear); - test_truth(gear_clone); - test_false(gear_clone->options.allocated); - - { // Test all of the flags - test_truth(gear_clone->options.dont_track_packets == gear_ptr->options.dont_track_packets); - test_truth(gear_clone->options.non_blocking == gear_ptr->options.non_blocking); - test_truth(gear_clone->options.stored_non_blocking == gear_ptr->options.stored_non_blocking); - } - test_truth(gear_clone->verbose == gear_ptr->verbose); - test_truth(gear_clone->con_count == gear_ptr->con_count); - test_truth(gear_clone->packet_count == gear_ptr->packet_count); - test_truth(gear_clone->pfds_size == gear_ptr->pfds_size); - test_truth(gear_clone->last_errno == gear_ptr->last_errno); - test_truth(gear_clone->timeout == gear_ptr->timeout); - test_truth(gear_clone->con_list == gear_ptr->con_list); - test_truth(gear_clone->packet_list == gear_ptr->packet_list); - test_truth(gear_clone->pfds == gear_ptr->pfds); - test_truth(gear_clone->log_fn == gear_ptr->log_fn); - test_truth(gear_clone->log_context == gear_ptr->log_context); - test_truth(gear_clone->event_watch_fn == gear_ptr->event_watch_fn); - test_truth(gear_clone->event_watch_context == gear_ptr->event_watch_context); - test_truth(gear_clone->workload_malloc_fn == gear_ptr->workload_malloc_fn); - test_truth(gear_clone->workload_malloc_context == gear_ptr->workload_malloc_context); - test_truth(gear_clone->workload_free_fn == gear_ptr->workload_free_fn); - test_truth(gear_clone->workload_free_context == gear_ptr->workload_free_context); - - gearman_universal_free(gear_clone); - } - - gearman_universal_free(gear_ptr); - - return TEST_SUCCESS; -} - -static test_return_t set_timout_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st gear; - gearman_universal_st *gear_ptr; - int time_data; - - gear_ptr= gearman_universal_create(&gear, NULL); - test_truth(gear_ptr); - test_truth(gear_ptr == &gear); - test_false(gear_ptr->options.allocated); - - time_data= gearman_universal_timeout(gear_ptr); - test_truth (time_data == -1); // Current default - - gearman_universal_set_timeout(gear_ptr, 20); - time_data= gearman_universal_timeout(gear_ptr); - test_truth (time_data == 20); // Current default - - gearman_universal_set_timeout(gear_ptr, 10); - time_data= gearman_universal_timeout(gear_ptr); - test_truth (time_data == 10); // Current default - - test_truth(gear_ptr == &gear); // Make sure noting got slipped in :) - gearman_universal_free(gear_ptr); - - return TEST_SUCCESS; -} - -static test_return_t basic_error_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st gear; - gearman_universal_st *gear_ptr; - const char *error; - int error_number; - - gear_ptr= gearman_universal_create(&gear, NULL); - test_truth(gear_ptr); - test_truth(gear_ptr == &gear); - test_false(gear_ptr->options.allocated); - - error= gearman_universal_error(gear_ptr); - test_truth(error == NULL); - - error_number= gearman_universal_errno(gear_ptr); - test_truth(error_number == 0); - - test_truth(gear_ptr == &gear); // Make sure noting got slipped in :) - gearman_universal_free(gear_ptr); - - return TEST_SUCCESS; -} - - -static test_return_t state_option_test(void *object __attribute__((unused))) -{ - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - - universal_ptr= gearman_universal_create(&universal, NULL); - test_truth(universal_ptr); - { // Initial Allocated, no changes - test_false(universal_ptr->options.allocated); - test_false(universal_ptr->options.dont_track_packets); - test_false(universal_ptr->options.non_blocking); - test_false(universal_ptr->options.stored_non_blocking); - } - gearman_universal_free(universal_ptr); - - return TEST_SUCCESS; -} - -static test_return_t state_option_on_create_test(void *object __attribute__((unused))) -{ - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - gearman_universal_options_t options[]= { GEARMAN_NON_BLOCKING, GEARMAN_DONT_TRACK_PACKETS, GEARMAN_MAX}; - - universal_ptr= gearman_universal_create(&universal, options); - test_truth(universal_ptr); - { // Initial Allocated, no changes - test_false(universal_ptr->options.allocated); - test_truth(universal_ptr->options.dont_track_packets); - test_truth(universal_ptr->options.non_blocking); - test_false(universal_ptr->options.stored_non_blocking); - } - gearman_universal_free(universal_ptr); - - return TEST_SUCCESS; -} - - -static test_return_t state_option_set_test(void *object __attribute__((unused))) -{ - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - gearman_universal_options_t options[]= { GEARMAN_NON_BLOCKING, GEARMAN_DONT_TRACK_PACKETS, GEARMAN_MAX}; - - universal_ptr= gearman_universal_create(&universal, options); - test_truth(universal_ptr); - { // Initial Allocated, no changes - test_false(universal_ptr->options.allocated); - test_truth(universal_ptr->options.dont_track_packets); - test_truth(universal_ptr->options.non_blocking); - test_false(universal_ptr->options.stored_non_blocking); - } - - test_truth(gearman_universal_is_non_blocking(universal_ptr)); - - universal_ptr= gearman_universal_create(&universal, NULL); - { // Initial Allocated, no changes - test_false(universal_ptr->options.allocated); - test_false(universal_ptr->options.dont_track_packets); - test_false(universal_ptr->options.non_blocking); - test_false(universal_ptr->options.stored_non_blocking); - } - - gearman_universal_add_options(universal_ptr, GEARMAN_DONT_TRACK_PACKETS); - { // Initial Allocated, no changes - test_false(universal_ptr->options.allocated); - test_truth(universal_ptr->options.dont_track_packets); - test_false(universal_ptr->options.non_blocking); - test_false(universal_ptr->options.stored_non_blocking); - } - - gearman_universal_remove_options(universal_ptr, GEARMAN_DONT_TRACK_PACKETS); - { // Initial Allocated, no changes - test_false(universal_ptr->options.allocated); - test_false(universal_ptr->options.dont_track_packets); - test_false(universal_ptr->options.non_blocking); - test_false(universal_ptr->options.stored_non_blocking); - } - - gearman_universal_free(universal_ptr); - - return TEST_SUCCESS; -} - -test_st universal_st_test[] ={ - {"init", 0, init_test }, - {"clone_test", 0, clone_test }, - {"set_timeout", 0, set_timout_test }, - {"basic_error", 0, basic_error_test }, - {"state_options", 0, state_option_test }, - {"state_options_on_create", 0, state_option_on_create_test}, - {"state_options_set", 0, state_option_set_test }, - {0, 0, 0} -}; - - -static test_return_t connection_init_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - - gearman_connection_st connection; - gearman_connection_st *connection_ptr; - - universal_ptr= gearman_universal_create(&universal, NULL); - test_false(universal.options.allocated); - test_false(universal_ptr->options.allocated); - - connection_ptr= gearman_connection_create(universal_ptr, &connection, NULL); - test_false(connection.options.allocated); - test_false(connection_ptr->options.allocated); - - test_false(connection.options.ready); - test_false(connection.options.packet_in_use); - test_false(connection.options.external_fd); - test_false(connection.options.ignore_lost_connection); - test_false(connection.options.close_after_flush); - - test_truth(connection_ptr == &connection); - - gearman_connection_free(connection_ptr); - test_false(connection.options.allocated); - - return TEST_SUCCESS; -} - -static test_return_t connection_alloc_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - - gearman_connection_st *connection_ptr; - - universal_ptr= gearman_universal_create(&universal, NULL); - test_false(universal.options.allocated); - test_false(universal_ptr->options.allocated); - - connection_ptr= gearman_connection_create(universal_ptr, NULL, NULL); - test_truth(connection_ptr->options.allocated); - - test_false(connection_ptr->options.ready); - test_false(connection_ptr->options.packet_in_use); - test_false(connection_ptr->options.external_fd); - test_false(connection_ptr->options.ignore_lost_connection); - test_false(connection_ptr->options.close_after_flush); - - gearman_connection_free(connection_ptr); - - return TEST_SUCCESS; -} - -test_st connection_st_test[] ={ - {"init", 0, connection_init_test }, - {"alloc", 0, connection_alloc_test }, - {0, 0, 0} -}; - -static test_return_t packet_init_test(void *not_used __attribute__((unused))) -{ - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - - gearman_packet_st packet; - gearman_packet_st *packet_ptr; - - universal_ptr= gearman_universal_create(&universal, NULL); - test_false(universal.options.allocated); - test_false(universal_ptr->options.allocated); - - packet_ptr= gearman_packet_create(universal_ptr, &packet); - test_false(packet.options.allocated); - test_false(packet_ptr->options.allocated); - - test_false(packet.options.complete); - test_false(packet.options.free_data); - - test_truth(packet_ptr == &packet); - - gearman_packet_free(packet_ptr); - test_false(packet.options.allocated); - - return TEST_SUCCESS; -} - -static test_return_t gearman_packet_give_data_test(void *not_used __attribute__((unused))) -{ - char *data = strdup("Mine!"); - size_t data_size= strlen(data); - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - - gearman_packet_st packet; - gearman_packet_st *packet_ptr; - - universal_ptr= gearman_universal_create(&universal, NULL); - test_truth(universal_ptr); - - packet_ptr= gearman_packet_create(universal_ptr, &packet); - test_truth(packet_ptr); - - gearman_packet_give_data(packet_ptr, data, data_size); - - test_truth(packet_ptr->data == data); - test_truth(packet_ptr->data_size == data_size); - test_truth(packet_ptr->options.free_data); - - gearman_packet_free(packet_ptr); - gearman_universal_free(universal_ptr); - - return TEST_SUCCESS; -} - -static test_return_t gearman_packet_take_data_test(void *not_used __attribute__((unused))) -{ - char *data = strdup("Mine!"); - char *catch; - size_t data_size= strlen(data); - size_t catch_size; - gearman_universal_st universal; - gearman_universal_st *universal_ptr; - - gearman_packet_st packet; - gearman_packet_st *packet_ptr; - - universal_ptr= gearman_universal_create(&universal, NULL); - test_truth(universal_ptr); - - packet_ptr= gearman_packet_create(universal_ptr, &packet); - test_truth(packet_ptr); - - gearman_packet_give_data(packet_ptr, data, data_size); - - test_truth(packet_ptr->data == data); - test_truth(packet_ptr->data_size == data_size); - test_truth(packet_ptr->options.free_data); - - catch= gearman_packet_take_data(packet_ptr, &catch_size); - - test_false(packet_ptr->data); - test_false(packet_ptr->data_size); - test_false(packet_ptr->options.free_data); - - test_truth(catch == data); - test_truth(data_size == catch_size); - - gearman_packet_free(packet_ptr); - gearman_universal_free(universal_ptr); - free(data); - - return TEST_SUCCESS; -} - -test_st packet_st_test[] ={ - {"init", 0, packet_init_test }, - {"gearman_packet_give_data", 0, gearman_packet_give_data_test }, - {"gearman_packet_take_data", 0, gearman_packet_take_data_test }, - {0, 0, 0} -}; - - -collection_st collection[] ={ - {"gearman_universal_st", 0, 0, universal_st_test}, - {"gearman_connection_st", 0, 0, connection_st_test}, - {"gearman_packet_st", 0, 0, packet_st_test}, - {0, 0, 0, 0} -}; - -void get_world(world_st *world) -{ - world->collections= collection; -} diff -Nru gearmand-0.14/tests/internals.cc gearmand-0.23/tests/internals.cc --- gearmand-0.14/tests/internals.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/internals.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,483 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include + +#include +#include +#include +#include + +#define GEARMAN_CORE +#include +#include + +#include +#include + +#include + +#include + +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +struct internal_test_st +{ + pid_t gearmand_pid; + + internal_test_st() : + gearmand_pid(-1) + { + } + + ~internal_test_st() + { + test_gearmand_stop(gearmand_pid); + } +}; + +static test_return_t init_test(void *) +{ + gearman_universal_st gear; + + gearman_universal_initialize(gear); + test_false(gear.options.dont_track_packets); + test_false(gear.options.non_blocking); + test_false(gear.options.stored_non_blocking); + test_false(gear._namespace); + + gearman_universal_free(gear); + + return TEST_SUCCESS; +} + +static test_return_t clone_test(void *) +{ + gearman_universal_st gear; + + gearman_universal_initialize(gear); + + /* Can we init from null? */ + { + gearman_universal_st destination; + gearman_universal_clone(destination, gear); + + { // Test all of the flags + test_truth(destination.options.dont_track_packets == gear.options.dont_track_packets); + test_truth(destination.options.non_blocking == gear.options.non_blocking); + test_truth(destination.options.stored_non_blocking == gear.options.stored_non_blocking); + } + test_truth(destination._namespace == gear._namespace); + test_truth(destination.verbose == gear.verbose); + test_truth(destination.con_count == gear.con_count); + test_truth(destination.packet_count == gear.packet_count); + test_truth(destination.pfds_size == gear.pfds_size); + test_truth(destination.error.last_errno == gear.error.last_errno); + test_truth(destination.timeout == gear.timeout); + test_truth(destination.con_list == gear.con_list); + test_truth(destination.packet_list == gear.packet_list); + test_truth(destination.pfds == gear.pfds); + test_truth(destination.log_fn == gear.log_fn); + test_truth(destination.log_context == gear.log_context); + test_truth(destination.allocator.malloc == gear.allocator.malloc); + test_truth(destination.allocator.context == gear.allocator.context); + test_truth(destination.allocator.free == gear.allocator.free); + + gearman_universal_free(gear); + } + + gearman_universal_free(gear); + + return TEST_SUCCESS; +} + +static test_return_t set_timout_test(void *) +{ + gearman_universal_st universal; + + gearman_universal_initialize(universal); + + test_compare(-1, gearman_universal_timeout(universal)); // Current default + + gearman_universal_set_timeout(universal, 20); + test_compare(20, gearman_universal_timeout(universal)); // New value of 20 + + gearman_universal_set_timeout(universal, 10); + test_compare(10, gearman_universal_timeout(universal)); // New value of 10 + + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + +static test_return_t basic_error_test(void *) +{ + gearman_universal_st universal; + + gearman_universal_initialize(universal); + + const char *error= gearman_universal_error(universal); + test_false(error); + + test_compare(0, gearman_universal_errno(universal)); + + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + + +static test_return_t state_option_test(void *) +{ + gearman_universal_st universal; + + gearman_universal_initialize(universal); + { // Initial Allocated, no changes + test_false(universal.options.dont_track_packets); + test_false(universal.options.non_blocking); + test_false(universal.options.stored_non_blocking); + } + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + +static test_return_t state_option_on_create_test(void *) +{ + gearman_universal_st universal; + gearman_universal_options_t options[]= { GEARMAN_NON_BLOCKING, GEARMAN_DONT_TRACK_PACKETS, GEARMAN_MAX}; + + gearman_universal_initialize(universal, options); + { // Initial Allocated, no changes + test_truth(universal.options.dont_track_packets); + test_truth(universal.options.non_blocking); + test_false(universal.options.stored_non_blocking); + } + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + + +static test_return_t gearman_universal_set_namespace_test(void *) +{ + gearman_universal_st universal; + gearman_universal_initialize(universal); + + test_false(universal._namespace); + + gearman_universal_set_namespace(universal, gearman_literal_param("foo23")); + test_truth(universal._namespace); + + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + +static test_return_t clone_gearman_universal_set_namespace_test(void *) +{ + gearman_universal_st universal; + gearman_universal_initialize(universal); + + test_false(universal._namespace); + + gearman_universal_set_namespace(universal, gearman_literal_param("my_dog")); + test_truth(universal._namespace); + + gearman_universal_st clone; + gearman_universal_clone(clone, universal); + test_truth(clone._namespace); + + gearman_universal_free(universal); + gearman_universal_free(clone); + + return TEST_SUCCESS; +} + +static test_return_t state_option_set_test(void *) +{ + gearman_universal_st universal; + gearman_universal_options_t options[]= { GEARMAN_NON_BLOCKING, GEARMAN_DONT_TRACK_PACKETS, GEARMAN_MAX}; + + gearman_universal_initialize(universal, options); + { // Initial Allocated, no changes + test_truth(universal.options.dont_track_packets); + test_truth(universal.options.non_blocking); + test_false(universal.options.stored_non_blocking); + } + + test_truth(gearman_universal_is_non_blocking(universal)); + + gearman_universal_initialize(universal); + { // Initial Allocated, no changes + test_false(universal.options.dont_track_packets); + test_false(universal.options.non_blocking); + test_false(universal.options.stored_non_blocking); + } + + gearman_universal_add_options(universal, GEARMAN_DONT_TRACK_PACKETS); + { // Initial Allocated, no changes + test_truth(universal.options.dont_track_packets); + test_false(universal.options.non_blocking); + test_false(universal.options.stored_non_blocking); + } + + gearman_universal_remove_options(universal, GEARMAN_DONT_TRACK_PACKETS); + { // Initial Allocated, no changes + test_false(universal.options.dont_track_packets); + test_false(universal.options.non_blocking); + test_false(universal.options.stored_non_blocking); + } + + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + +test_st universal_st_test[] ={ + {"init", 0, init_test }, + {"clone_test", 0, clone_test }, + {"set_timeout", 0, set_timout_test }, + {"basic_error", 0, basic_error_test }, + {"state_options", 0, state_option_test }, + {"state_options_on_create", 0, state_option_on_create_test}, + {"state_options_set", 0, state_option_set_test }, + {"gearman_universal_set_namespace()", 0, gearman_universal_set_namespace_test }, + {"gearman_universal_clone() with gearman_universal_set_namespace()", 0, clone_gearman_universal_set_namespace_test }, + {0, 0, 0} +}; + + +static test_return_t connection_init_test(void *) +{ + gearman_universal_st universal; + + gearman_universal_initialize(universal); + + gearman_connection_st *connection_ptr= gearman_connection_create(universal, NULL); + test_truth(connection_ptr); + + test_false(connection_ptr->options.ready); + test_false(connection_ptr->options.packet_in_use); + + delete connection_ptr; + + return TEST_SUCCESS; +} + +static test_return_t connection_alloc_test(void *) +{ + gearman_universal_st universal; + + gearman_universal_initialize(universal); + + gearman_connection_st *connection_ptr= gearman_connection_create(universal, NULL); + test_truth(connection_ptr); + + test_false(connection_ptr->options.ready); + test_false(connection_ptr->options.packet_in_use); + + delete connection_ptr; + + return TEST_SUCCESS; +} + +test_st connection_st_test[] ={ + {"init", 0, connection_init_test }, + {"alloc", 0, connection_alloc_test }, + {0, 0, 0} +}; + +static test_return_t packet_init_test(void *) +{ + gearman_universal_st universal; + + gearman_packet_st packet; + gearman_packet_st *packet_ptr; + + gearman_universal_initialize(universal); + + packet_ptr= gearman_packet_create(universal, &packet); + test_false(packet.options.allocated); + test_false(packet_ptr->options.allocated); + + test_false(packet.options.complete); + test_false(packet.options.free_data); + + test_truth(packet_ptr == &packet); + + gearman_packet_free(packet_ptr); + test_false(packet.options.allocated); + + return TEST_SUCCESS; +} + +static test_return_t gearman_packet_give_data_test(void *) +{ + char *data = strdup("Mine!"); + size_t data_size= strlen(data); + gearman_universal_st universal; + + gearman_packet_st packet; + + gearman_universal_initialize(universal); + + test_truth(gearman_packet_create(universal, &packet)); + + gearman_packet_give_data(packet, data, data_size); + + test_truth(packet.data == data); + test_truth(packet.data_size == data_size); + test_truth(packet.options.free_data); + + gearman_packet_free(&packet); + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + +static test_return_t gearman_packet_take_data_test(void *) +{ + char *data = strdup("Mine!"); + size_t data_size= strlen(data); + gearman_universal_st universal; + + gearman_packet_st packet; + + gearman_universal_initialize(universal); + + gearman_packet_st *packet_ptr= gearman_packet_create(universal, &packet); + test_truth(packet_ptr); + + gearman_packet_give_data(packet, data, data_size); + + test_truth(packet_ptr->data == data); + test_compare(data_size, packet_ptr->data_size); + test_truth(packet_ptr->options.free_data); + + size_t mine_size; + char *mine= (char *)gearman_packet_take_data(packet, &mine_size); + + test_false(packet_ptr->data); + test_compare(0, packet_ptr->data_size); + test_false(packet_ptr->options.free_data); + + test_compare(mine, data); + test_compare(data_size, mine_size); + + gearman_packet_free(packet_ptr); + gearman_universal_free(universal); + free(data); + + return TEST_SUCCESS; +} + +test_st packet_st_test[] ={ + {"init", 0, packet_init_test }, + {"gearman_packet_give_data", 0, gearman_packet_give_data_test }, + {"gearman_packet_take_data", 0, gearman_packet_take_data_test }, + {0, 0, 0} +}; + +test_st regression_tests[] ={ + {"lp:783141, multiple calls for bad host", 0, regression_bug_783141_test }, + {"lp:372074", 0, regression_bug_372074_test }, + {0, 0, 0} +}; + +collection_st collection[] ={ + {"gearman_universal_st", 0, 0, universal_st_test}, + {"gearman_connection_st", 0, 0, connection_st_test}, + {"gearman_packet_st", 0, 0, packet_st_test}, + {"regression", 0, 0, regression_tests}, + {0, 0, 0, 0} +}; + +static void *world_create(test_return_t *error) +{ + internal_test_st *test= new internal_test_st(); + + /** + * @TODO We cast this to char ** below, which is evil. We need to do the + * right thing + */ + const char *argv[1]= { "client_gearmand" }; + + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + /** + We start up everything before we allocate so that we don't have to track memory in the forked process. + */ + test->gearmand_pid= test_gearmand_start(INTERNAL_TEST_PORT, 1, argv); + + if (test->gearmand_pid == -1) + { + *error= TEST_FAILURE; + return NULL; + } + set_default_port(INTERNAL_TEST_PORT); + + *error= TEST_SUCCESS; + + return (void *)test; +} + +static test_return_t world_destroy(void *object) +{ + internal_test_st *test= (internal_test_st *)object; + delete test; + + return TEST_SUCCESS; +} + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; +} diff -Nru gearmand-0.14/tests/libdrizzle.am gearmand-0.23/tests/libdrizzle.am --- gearmand-0.14/tests/libdrizzle.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/libdrizzle.am 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,33 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +test-drizzle: test-libdrizzle-args test-drizzle-queue + +tests-libdrizzle-args: gearmand/gearmand +if HAVE_LIBDRIZZLE + @gearmand/gearmand --check-args --libdrizzle-host=localhost --libdrizzle-port=90 --libdrizzle-uds=tmp/foo.socket --libdrizzle-user=root --libdrizzle-password=test --libdrizzle-db=gearman --libdrizzle-table=gearman --libdrizzle-mysql +endif + +test-drizzle-queue: gearmand/gearmand +if HAVE_LIBDRIZZLE + $(DRIZZLE_TEST) $(ARG1) $(ARG2) +endif + +if HAVE_LIBDRIZZLE +DRIZZLE_TEST= tests/drizzle_test +noinst_PROGRAMS += tests/drizzle_test +endif + +tests_drizzle_test_SOURCES= \ + tests/basic.cc \ + tests/drizzle_test.cc +tests_drizzle_test_LDADD= ${CLIENT_LDADD} diff -Nru gearmand-0.14/tests/libmemcached.am gearmand-0.23/tests/libmemcached.am --- gearmand-0.14/tests/libmemcached.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/libmemcached.am 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,57 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +test-libmemcached: tests-libmemcached-args test-libmemcached-queue + +tests-libmemcached-args: gearmand/gearmand +if HAVE_LIBMEMCACHED + @gearmand/gearmand --check-args --queue=libmemcached --libmemcached-servers=localhost:12555 +endif + +tests_memcached_test_SOURCES= \ + tests/basic.cc \ + tests/memcached_test.cc +tests_memcached_test_LDADD= ${CLIENT_LDADD} + + +if HAVE_LIBMEMCACHED +if HAVE_MEMCACHED +LIBMEMCACHED_PIDFILE = ${abs_top_builddir}/tests/Xumemc.pid +LIBMEMCACHED_TEST= tests/memcached_test +# Note, SETUP should do a test for existance and then kill if it exists. +LIBMEMCACHED_SETUP= @$(MEMCACHED_BINARY) -d -u root -P ${LIBMEMCACHED_PIDFILE} -p 12555 +LIBMEMCACHED_TEARDOWN= @\ + cat ${LIBMEMCACHED_PIDFILE} | xargs kill; \ + rm ${LIBMEMCACHED_PIDFILE} + +noinst_PROGRAMS += tests/memcached_test +endif +endif + + +test-libmemcached-queue: +if HAVE_LIBMEMCACHED +if HAVE_MEMCACHED + $(LIBMEMCACHED_SETUP) + $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) + $(LIBMEMCACHED_TEARDOWN) +endif +endif + +valgrind-libmemcached: +if HAVE_LIBMEMCACHED +if HAVE_MEMCACHED + $(LIBMEMCACHED_SETUP) + $(VALGRIND_COMMAND) $(LIBMEMCACHED_TEST) $(ARG1) $(ARG2) + $(LIBMEMCACHED_TEARDOWN) +endif +endif diff -Nru gearmand-0.14/tests/memcached_test.c gearmand-0.23/tests/memcached_test.c --- gearmand-0.14/tests/memcached_test.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/memcached_test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,179 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include -#include - -#include - -#include "test.h" -#include "test_gearmand.h" - -#define WORKER_TEST_PORT 32123 - -typedef struct -{ - pid_t gearmand_pid; - gearman_worker_st worker; - bool run_worker; -} worker_test_st; - -/* Prototypes */ -test_return_t queue_add(void *object); -test_return_t queue_worker(void *object); - -test_return_t pre(void *object); -test_return_t post(void *object); -test_return_t flush(void *object); - -void *world_create(test_return_t *error); -test_return_t world_destroy(void *object); - -/* Counter test for worker */ -static void *counter_function(gearman_job_st *job __attribute__((unused)), - void *context, size_t *result_size, - gearman_return_t *ret_ptr __attribute__((unused))) -{ - uint32_t *counter= (uint32_t *)context; - - *result_size= 0; - - *counter= *counter + 1; - - return NULL; -} - -test_return_t queue_add(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_client_st client; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - uint8_t *value= (uint8_t *)"background_test"; - size_t value_length= strlen("background_test"); - - test->run_worker= false; - - if (gearman_client_create(&client) == NULL) - return TEST_FAILURE; - - if (gearman_client_add_server(&client, NULL, - WORKER_TEST_PORT) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_client_do_background(&client, "queue_test", NULL, value, - value_length, job_handle) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - gearman_client_free(&client); - - test->run_worker= true; - return TEST_SUCCESS; -} - -test_return_t queue_worker(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_st *worker= &(test->worker); - uint32_t counter= 0; - - if (!test->run_worker) - return TEST_FAILURE; - - if (gearman_worker_add_function(worker, "queue_test", 5, counter_function, - &counter) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_worker_work(worker) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - if (counter == 0) - return TEST_FAILURE; - - return TEST_SUCCESS; -} - - -void *world_create(test_return_t *error) -{ - worker_test_st *test; - pid_t gearmand_pid; - const char *argv[2]= { "test_gearmand", "--libmemcached-servers=localhost:12555" }; - - gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, "libmemcached", (char **)argv, 2); - - test= malloc(sizeof(worker_test_st)); - if (! test) - { - *error= TEST_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - memset(test, 0, sizeof(worker_test_st)); - if (gearman_worker_create(&(test->worker)) == NULL) - { - *error= TEST_FAILURE; - return NULL; - } - - if (gearman_worker_add_server(&(test->worker), NULL, WORKER_TEST_PORT) != GEARMAN_SUCCESS) - { - *error= TEST_FAILURE; - return NULL; - } - - test->gearmand_pid= gearmand_pid; - - *error= TEST_SUCCESS; - - return (void *)test; -} - -test_return_t world_destroy(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_free(&(test->worker)); - test_gearmand_stop(test->gearmand_pid); - free(test); - - return TEST_SUCCESS; -} - -test_st tests[] ={ - {"add", 0, queue_add }, - {"worker", 0, queue_worker }, - {0, 0, 0} -}; - -collection_st collection[] ={ -#ifdef HAVE_LIBMEMCACHED - {"memcached queue", 0, 0, tests}, -#endif - {0, 0, 0, 0} -}; - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; -} diff -Nru gearmand-0.14/tests/memcached_test.cc gearmand-0.23/tests/memcached_test.cc --- gearmand-0.14/tests/memcached_test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/memcached_test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,103 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +// prototype +test_return_t collection_init(void *object); +test_return_t collection_cleanup(void *object); + +test_return_t collection_init(void *object) +{ + const char *argv[3]= { "test_gearmand", "--libmemcached-servers=localhost:12555", "--queue-type=libmemcached" }; + + Context *test= (Context *)object; + assert(test); + + test_truth(test->initialize(3, argv)); + + return TEST_SUCCESS; +} + +test_return_t collection_cleanup(void *object) +{ + Context *test= (Context *)object; + test->reset(); + + return TEST_SUCCESS; +} + + +void *world_create(test_return_t *error) +{ + Context *test= new Context(MEMCACHED_TEST_PORT); + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return test; +} + +test_return_t world_destroy(void *object) +{ + Context *test= (Context *)object; + + delete test; + + return TEST_SUCCESS; +} + +test_st tests[] ={ + {"gearman_client_echo()", 0, client_echo_test }, + {"gearman_client_echo() fail", 0, client_echo_fail_test }, + {"gearman_worker_echo()", 0, worker_echo_test }, + {"clean", 0, queue_clean }, + {"add", 0, queue_add }, + {"worker", 0, queue_worker }, + {0, 0, 0} +}; + +collection_st collection[] ={ +#ifdef HAVE_LIBMEMCACHED + {"memcached queue", collection_init, collection_cleanup, tests}, +#endif + {0, 0, 0, 0} +}; + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; +} diff -Nru gearmand-0.14/tests/ports.h gearmand-0.23/tests/ports.h --- gearmand-0.14/tests/ports.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/ports.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,52 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#pragma once + +#define GEARMAN_BASE_TEST_PORT 32143 +#define BURNIN_TEST_PORT GEARMAN_BASE_TEST_PORT +1 +#define CLIENT_TEST_PORT GEARMAN_BASE_TEST_PORT +2 +#define DRIZZLE_TEST_PORT GEARMAN_BASE_TEST_PORT +3 +#define INTERNAL_TEST_PORT GEARMAN_BASE_TEST_PORT +4 +#define MEMCACHED_TEST_PORT GEARMAN_BASE_TEST_PORT +5 +#define ROUND_ROBIN_WORKER_TEST_PORT GEARMAN_BASE_TEST_PORT +6 +#define SQLITE_TEST_PORT GEARMAN_BASE_TEST_PORT +7 +#define TOKYOCABINET_TEST_PORT GEARMAN_BASE_TEST_PORT +8 +#define WORKER_TEST_PORT GEARMAN_BASE_TEST_PORT +9 + + diff -Nru gearmand-0.14/tests/postgres.am gearmand-0.23/tests/postgres.am --- gearmand-0.14/tests/postgres.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/postgres.am 2011-03-24 02:19:49.000000000 +0100 @@ -0,0 +1,18 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +test-postgres: tests-postgres-args + +tests-postgres-args: gearmand/gearmand +if HAVE_LIBPQ + @gearmand/gearmand --libpq-conninfo="foo" --libpq-table="gearmand" +endif diff -Nru gearmand-0.14/tests/protocol.cc gearmand-0.23/tests/protocol.cc --- gearmand-0.14/tests/protocol.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/protocol.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,94 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t check_gearman_command_t(void *) +{ + test_compare(0, int(GEARMAN_COMMAND_TEXT)); + test_compare(1, int(GEARMAN_COMMAND_CAN_DO)); + test_compare(2, int(GEARMAN_COMMAND_CANT_DO)); + test_compare(3, int(GEARMAN_COMMAND_RESET_ABILITIES)); + test_compare(4, int(GEARMAN_COMMAND_PRE_SLEEP)); + test_compare(5, int(GEARMAN_COMMAND_UNUSED)); + test_compare(6, int(GEARMAN_COMMAND_NOOP)); + test_compare(7, int(GEARMAN_COMMAND_SUBMIT_JOB)); + test_compare(8, int(GEARMAN_COMMAND_JOB_CREATED)); + test_compare(9, int(GEARMAN_COMMAND_GRAB_JOB)); + test_compare(10, int(GEARMAN_COMMAND_NO_JOB)); + test_compare(11, int(GEARMAN_COMMAND_JOB_ASSIGN)); + test_compare(12, int(GEARMAN_COMMAND_WORK_STATUS)); + test_compare(13, int(GEARMAN_COMMAND_WORK_COMPLETE)); + test_compare(14, int(GEARMAN_COMMAND_WORK_FAIL)); + test_compare(15, int(GEARMAN_COMMAND_GET_STATUS)); + test_compare(16, int(GEARMAN_COMMAND_ECHO_REQ)); + test_compare(17, int(GEARMAN_COMMAND_ECHO_RES)); + test_compare(18, int(GEARMAN_COMMAND_SUBMIT_JOB_BG)); + test_compare(19, int(GEARMAN_COMMAND_ERROR)); + test_compare(20, int(GEARMAN_COMMAND_STATUS_RES)); + test_compare(21, int(GEARMAN_COMMAND_SUBMIT_JOB_HIGH)); + test_compare(22, int(GEARMAN_COMMAND_SET_CLIENT_ID)); + test_compare(23, int(GEARMAN_COMMAND_CAN_DO_TIMEOUT)); + test_compare(24, int(GEARMAN_COMMAND_ALL_YOURS)); + test_compare(25, int(GEARMAN_COMMAND_WORK_EXCEPTION)); + test_compare(26, int(GEARMAN_COMMAND_OPTION_REQ)); + test_compare(27, int(GEARMAN_COMMAND_OPTION_RES)); + test_compare(28, int(GEARMAN_COMMAND_WORK_DATA)); + test_compare(29, int(GEARMAN_COMMAND_WORK_WARNING)); + test_compare(30, int(GEARMAN_COMMAND_GRAB_JOB_UNIQ)); + test_compare(31, int(GEARMAN_COMMAND_JOB_ASSIGN_UNIQ)); + test_compare(32, int(GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG)); + test_compare(33, int(GEARMAN_COMMAND_SUBMIT_JOB_LOW)); + test_compare(34, int(GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG)); + test_compare(35, int(GEARMAN_COMMAND_SUBMIT_JOB_SCHED)); + test_compare(36, int(GEARMAN_COMMAND_SUBMIT_JOB_EPOCH)); + test_compare(37, int(GEARMAN_COMMAND_SUBMIT_REDUCE_JOB)); + test_compare(38, int(GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND)); + test_compare(39, int(GEARMAN_COMMAND_GRAB_JOB_ALL)); + test_compare(40, int(GEARMAN_COMMAND_JOB_ASSIGN_ALL)); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/protocol.h gearmand-0.23/tests/protocol.h --- gearmand-0.14/tests/protocol.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/protocol.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,40 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t check_gearman_command_t(void *); diff -Nru gearmand-0.14/tests/regression.c gearmand-0.23/tests/regression.c --- gearmand-0.14/tests/regression.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/regression.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,212 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include - -#define GEARMAN_CORE - -#include - -#include "test.h" -#include "test_gearmand.h" -#include "test_worker.h" - -#define WORKER_TEST_PORT 32123 - -typedef struct -{ - pid_t gearmand_pid; -} regression_st; - -void *create(void *object); -void destroy(void *object); -test_return_t pre(void *object); -test_return_t post(void *object); -test_return_t flush(void); - - -static test_return_t bug372074_test(void *object __attribute__((unused))) -{ - gearman_universal_st gearman; - gearman_connection_st con; - gearman_packet_st packet; - uint32_t x; - const void *args[1]; - size_t args_size[1]; - - if (gearman_universal_create(&gearman, NULL) == NULL) - return TEST_FAILURE; - - for (x= 0; x < 2; x++) - { - if (gearman_connection_create(&gearman, &con, NULL) == NULL) - return TEST_FAILURE; - - gearman_connection_set_host(&con, NULL, WORKER_TEST_PORT); - - args[0]= "testUnregisterFunction"; - args_size[0]= strlen("testUnregisterFunction"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_SET_CLIENT_ID, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - args[0]= "reverse"; - args_size[0]= strlen("reverse"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CAN_DO, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CANT_DO, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - gearman_connection_free(&con); - - if (gearman_connection_create(&gearman, &con, NULL) == NULL) - return TEST_FAILURE; - - gearman_connection_set_host(&con, NULL, WORKER_TEST_PORT); - - args[0]= "testUnregisterFunction"; - args_size[0]= strlen("testUnregisterFunction"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_SET_CLIENT_ID, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - args[0]= "digest"; - args_size[0]= strlen("digest"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CAN_DO, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - args[0]= "reverse"; - args_size[0]= strlen("reverse"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CAN_DO, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_RESET_ABILITIES, - NULL, NULL, 0) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&con, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - gearman_connection_free(&con); - } - - gearman_universal_free(&gearman); - - return TEST_SUCCESS; -} - - -test_st worker_tests[] ={ - {"bug372074", 0, bug372074_test }, - {0, 0, 0} -}; - - -collection_st collection[] ={ - {"worker_tests", 0, 0, worker_tests }, - {0, 0, 0, 0} -}; - - -static void *world_create(test_return_t *error) -{ - regression_st *test; - - test= malloc(sizeof(regression_st)); - - test->gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, NULL, NULL, 0); - - *error= TEST_SUCCESS; - - return (void *)test; -} - - -static test_return_t world_destroy(void *object) -{ - regression_st *test= (regression_st *)object; - test_gearmand_stop(test->gearmand_pid); - free(test); - - return TEST_SUCCESS; -} - - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; -} diff -Nru gearmand-0.14/tests/regression.cc gearmand-0.23/tests/regression.cc --- gearmand-0.14/tests/regression.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/regression.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,208 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t regression_bug_783141_test(void *) +{ + test_skip(true, test_is_local()); + +#ifdef __APPLE__ + return TEST_SKIPPED; +#endif + + { // Try with one bad host + gearman_client_st *client= gearman_client_create(NULL); + test_truth(client); + + test_truth(gearman_success(gearman_client_add_server(client, "10.0.2.253", 0))); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + "does not exist", NULL, + gearman_literal_param("dog"), + &ret); + test_true_got(gearman_success(ret), gearman_strerror(ret)); + test_truth(task); + + gearman_return_t local_ret= gearman_client_run_tasks(client); + test_compare_got(GEARMAN_COULD_NOT_CONNECT, local_ret, gearman_client_error(client)); + + local_ret= gearman_client_run_tasks(client); + test_compare_got(GEARMAN_COULD_NOT_CONNECT, local_ret, gearman_strerror(local_ret)); + + gearman_client_free(client); + } + + { // Try with three bad hosts + gearman_client_st *client= gearman_client_create(NULL); + test_truth(client); + + test_truth(gearman_success(gearman_client_add_server(client, "10.0.2.253", 0))); + test_truth(gearman_success(gearman_client_add_server(client, "10.0.2.252", 0))); + test_truth(gearman_success(gearman_client_add_server(client, "10.0.2.251", 0))); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + "does not exist", NULL, + gearman_literal_param("dog"), + &ret); + test_true_got(gearman_success(ret), gearman_strerror(ret)); + test_truth(task); + + gearman_return_t local_ret= gearman_client_run_tasks(client); + test_compare_got(GEARMAN_COULD_NOT_CONNECT, local_ret, gearman_client_error(client)); + + local_ret= gearman_client_run_tasks(client); + test_compare_got(GEARMAN_COULD_NOT_CONNECT, local_ret, gearman_strerror(local_ret)); + + gearman_client_free(client); + } + + return TEST_SUCCESS; +} + +test_return_t regression_bug_372074_test(void *) +{ + gearman_universal_st universal; + const void *args[1]; + size_t args_size[1]; + + gearman_universal_initialize(universal); + + for (uint32_t x= 0; x < 2; x++) + { + gearman_packet_st packet; + gearman_connection_st *con_ptr; + test_truth(con_ptr= gearman_connection_create(universal, NULL)); + + con_ptr->set_host(NULL, default_port()); + + args[0]= "testUnregisterFunction"; + args_size[0]= strlen("testUnregisterFunction"); + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_SET_CLIENT_ID, + args, args_size, 1))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + args[0]= "reverse"; + args_size[0]= strlen("reverse"); + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CAN_DO, + args, args_size, 1))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_CANT_DO, + args, args_size, 1))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + delete con_ptr; + + test_truth(con_ptr= gearman_connection_create(universal, NULL)); + + con_ptr->set_host(NULL, default_port()); + + args[0]= "testUnregisterFunction"; + args_size[0]= strlen("testUnregisterFunction"); + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_SET_CLIENT_ID, + args, args_size, 1))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + args[0]= "digest"; + args_size[0]= strlen("digest"); + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_CAN_DO, + args, args_size, 1))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + args[0]= "reverse"; + args_size[0]= strlen("reverse"); + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_CAN_DO, + args, args_size, 1))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_RESET_ABILITIES, + NULL, NULL, 0))); + + test_truth(gearman_success(con_ptr->send(packet, true))); + + gearman_packet_free(&packet); + + delete con_ptr; + } + + gearman_universal_free(universal); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/regression.h gearmand-0.23/tests/regression.h --- gearmand-0.14/tests/regression.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/regression.h 2011-06-22 17:48:39.000000000 +0200 @@ -0,0 +1,41 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t regression_bug_783141_test(void *); +test_return_t regression_bug_372074_test(void *); diff -Nru gearmand-0.14/tests/round_robin.c gearmand-0.23/tests/round_robin.c --- gearmand-0.14/tests/round_robin.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/round_robin.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,197 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include -#include - -#include -#include "test.h" -#include "test_gearmand.h" - -#define WORKER_TEST_PORT 32123 - -typedef struct -{ - pid_t gearmand_pid; - gearman_worker_st worker; - bool run_worker; -} worker_test_st; - -/* Prototypes */ -test_return_t queue_add(void *object); -test_return_t queue_worker(void *object); - -test_return_t pre(void *object); -test_return_t post(void *object); - -void *world_create(test_return_t *error); -test_return_t world_destroy(void *object); - -/* append test for worker */ -static void *append_function(gearman_job_st *job __attribute__((unused)), - void *context, size_t *result_size, - gearman_return_t *ret_ptr __attribute__((unused))) -{ - /* this will will set the last char in the context (buffer) to the */ - /* first char of the work */ - char * buf = (char *)context; - char * work = (char *)gearman_job_workload(job); - buf += strlen(buf); - *buf = *work; - *result_size= 0; - return NULL; -} - -test_return_t queue_add(void *object) -{ - gearman_return_t rc; - worker_test_st *test= (worker_test_st *)object; - gearman_client_st client; - gearman_client_st *client_ptr; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - - uint8_t *value= (uint8_t *)strdup("0"); - size_t value_length= 1; - - test->run_worker= false; - - client_ptr= gearman_client_create(&client); - test_truth(client_ptr); - - rc= gearman_client_add_server(&client, NULL, WORKER_TEST_PORT); - test_truth(GEARMAN_SUCCESS == rc); - - /* send strings "0", "1" ... "9" to alternating between 2 queues */ - /* queue1 = 1,3,5,7,9 */ - /* queue2 = 0,2,4,6,8 */ - for (uint32_t x= 0; x < 10; x++) - { - rc= gearman_client_do_background(&client, x % 2 ? "queue1" : "queue2", NULL, - value, value_length, job_handle); - - test_truth(GEARMAN_SUCCESS == rc); - *value = (uint8_t)(*value + 1); - } - - gearman_client_free(&client); - free(value); - - test->run_worker= true; - return TEST_SUCCESS; -} - -test_return_t queue_worker(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_st *worker= &(test->worker); - char buffer[11]; - memset(buffer, 0, sizeof(buffer)); - - if (! test->run_worker) - return TEST_FAILURE; - - if (gearman_worker_add_function(worker, "queue1", 5, append_function, - buffer) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_worker_add_function(worker, "queue2", 5, append_function, - buffer) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - for (uint32_t x= 0; x < 10; x++) - { - if (gearman_worker_work(worker) != GEARMAN_SUCCESS) - return TEST_FAILURE; - } - - // expect buffer to be reassembled in a predictable round robin order - if( strcmp(buffer, "1032547698") ) - { - fprintf(stderr, "\n\nexpecting 0123456789, got %s\n\n", buffer); - return TEST_FAILURE; - } - - return TEST_SUCCESS; -} - - -void *world_create(test_return_t *error) -{ - worker_test_st *test; - const char *argv[2]= { "test_gearmand", "--round-robin"}; - pid_t gearmand_pid; - - gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, NULL, (char **)argv, 2); - - test= malloc(sizeof(worker_test_st)); - if (! test) - { - *error= TEST_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - memset(test, 0, sizeof(worker_test_st)); - if (gearman_worker_create(&(test->worker)) == NULL) - { - *error= TEST_FAILURE; - return NULL; - } - - if (gearman_worker_add_server(&(test->worker), NULL, WORKER_TEST_PORT) != GEARMAN_SUCCESS) - { - *error= TEST_FAILURE; - return NULL; - } - - test->gearmand_pid= gearmand_pid; - - *error= TEST_SUCCESS; - - return (void *)test; -} - -test_return_t world_destroy(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_free(&(test->worker)); - test_gearmand_stop(test->gearmand_pid); - free(test); - - return TEST_SUCCESS; -} - -test_st tests[] ={ - {"add", 0, queue_add }, - {"worker", 0, queue_worker }, - {0, 0, 0} -}; - -collection_st collection[] ={ - {"round_robin", 0, 0, tests}, - {0, 0, 0, 0} -}; - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; -} diff -Nru gearmand-0.14/tests/round_robin.cc gearmand-0.23/tests/round_robin.cc --- gearmand-0.14/tests/round_robin.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/round_robin.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,203 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +struct worker_test_st +{ + pid_t gearmand_pid; + gearman_worker_st worker; + bool run_worker; + + worker_test_st() : + gearmand_pid(-1), + worker(), + run_worker(false) + { } +}; + +/* Prototypes */ +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +/* append test for worker */ +static void *append_function(gearman_job_st *job, + void *context, size_t *result_size, + gearman_return_t *ret_ptr) +{ + /* this will will set the last char in the context (buffer) to the */ + /* first char of the work */ + char *buf = (char *)context; + assert(buf); + + char *work = (char *)gearman_job_workload(job); + buf += strlen(buf); + *buf= *work; + *result_size= 0; + *ret_ptr= GEARMAN_SUCCESS; + + return NULL; +} + +static test_return_t queue_add(void *object) +{ + gearman_return_t rc; + worker_test_st *test= (worker_test_st *)object; + gearman_client_st client; + gearman_client_st *client_ptr; + char job_handle[GEARMAN_JOB_HANDLE_SIZE]; + + uint8_t *value= (uint8_t *)strdup("0"); + size_t value_length= 1; + + test->run_worker= false; + + client_ptr= gearman_client_create(&client); + test_truth(client_ptr); + + test_compare(GEARMAN_SUCCESS, + gearman_client_add_server(&client, NULL, ROUND_ROBIN_WORKER_TEST_PORT)); + + /* send strings "0", "1" ... "9" to alternating between 2 queues */ + /* queue1 = 1,3,5,7,9 */ + /* queue2 = 0,2,4,6,8 */ + for (uint32_t x= 0; x < 10; x++) + { + rc= gearman_client_do_background(&client, x % 2 ? "queue1" : "queue2", NULL, + value, value_length, job_handle); + + test_truth(GEARMAN_SUCCESS == rc); + *value = (uint8_t)(*value + 1); + } + + gearman_client_free(&client); + free(value); + + test->run_worker= true; + return TEST_SUCCESS; +} + +static test_return_t queue_worker(void *object) +{ + worker_test_st *test= (worker_test_st *)object; + test_truth(test); + + gearman_worker_st *worker= &(test->worker); + test_truth(worker); + + char buffer[11]; + memset(buffer, 0, sizeof(buffer)); + + test_truth(test->run_worker); + + test_compare_got(GEARMAN_SUCCESS, + gearman_worker_add_function(worker, "queue1", 5, append_function, buffer), + gearman_worker_error(worker)); + + test_compare_got(GEARMAN_SUCCESS, + gearman_worker_add_function(worker, "queue2", 5, append_function, buffer), + gearman_worker_error(worker)); + + for (uint32_t x= 0; x < 10; x++) + { + gearman_return_t rc; + test_compare_got(GEARMAN_SUCCESS, + rc= gearman_worker_work(worker), + gearman_worker_error(worker) ? gearman_worker_error(worker) : gearman_strerror(rc)); + } + + // expect buffer to be reassembled in a predictable round robin order + test_strcmp("1032547698", buffer); + + return TEST_SUCCESS; +} + + +void *world_create(test_return_t *error) +{ + const char *argv[2]= { "test_gearmand", "--round-robin"}; + pid_t gearmand_pid; + + gearmand_pid= test_gearmand_start(ROUND_ROBIN_WORKER_TEST_PORT, 2, argv); + + if (gearmand_pid == -1) + { + *error= TEST_FAILURE; + return NULL; + } + + worker_test_st *test= new (std::nothrow) worker_test_st;; + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + if (gearman_worker_create(&(test->worker)) == NULL) + { + *error= TEST_FAILURE; + return NULL; + } + + if (gearman_worker_add_server(&(test->worker), NULL, ROUND_ROBIN_WORKER_TEST_PORT) != GEARMAN_SUCCESS) + { + *error= TEST_FAILURE; + return NULL; + } + + test->gearmand_pid= gearmand_pid; + + *error= TEST_SUCCESS; + + return test; +} + +test_return_t world_destroy(void *object) +{ + worker_test_st *test= (worker_test_st *)object; + gearman_worker_free(&(test->worker)); + test_gearmand_stop(test->gearmand_pid); + delete test; + + return TEST_SUCCESS; +} + +test_st tests[] ={ + {"add", 0, queue_add }, + {"worker", 0, queue_worker }, + {0, 0, 0} +}; + +collection_st collection[] ={ + {"round_robin", 0, 0, tests}, + {0, 0, 0, 0} +}; + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; +} diff -Nru gearmand-0.14/tests/server_options.cc gearmand-0.23/tests/server_options.cc --- gearmand-0.14/tests/server_options.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/server_options.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,62 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_client_set_server_option_exception(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_true_got(gearman_client_set_server_option(client, gearman_literal_param("exceptions")), gearman_client_error(client)); + return TEST_SUCCESS; +} + +test_return_t gearman_client_set_server_option_bad(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + test_false(gearman_client_set_server_option(client, gearman_literal_param("bad"))); + return TEST_SUCCESS; +} + diff -Nru gearmand-0.14/tests/server_options.h gearmand-0.23/tests/server_options.h --- gearmand-0.14/tests/server_options.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/server_options.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,43 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +test_return_t gearman_client_set_server_option_exception(void *); +test_return_t gearman_client_set_server_option_bad(void *object); diff -Nru gearmand-0.14/tests/sqlite.am gearmand-0.23/tests/sqlite.am --- gearmand-0.14/tests/sqlite.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/sqlite.am 2011-06-10 09:23:01.000000000 +0200 @@ -0,0 +1,50 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +test-sqlite: tests-sqlite-args test-sqlite-queue + +tests-sqlite-args: gearmand/gearmand +if HAVE_LIBSQLITE3 + @gearmand/gearmand --check-args --libsqlite3-db=tmp/schema --libsqlite3-table=tmp/table + +endif + +if HAVE_LIBSQLITE3 +SQLITE_TEST= tests/sqlite_test +CLEANFILES+= tests/gearman.sql tests/gearman.sql-journal tests/gearmand.log* +noinst_PROGRAMS += tests/sqlite_test +endif + +tests_sqlite_test_SOURCES= \ + tests/basic.cc \ + tests/sqlite_test.cc +tests_sqlite_test_LDADD= ${CLIENT_LDADD} + +sqlite-nuke: + @rm -f tests/gearman.sql + @rm -f tests/gearman.sql-journal + @rm -f tests/gearmand.log* + +test-sqlite-queue: sqlite-nuke +if HAVE_LIBSQLITE3 + $(SQLITE_TEST) $(ARG1) $(ARG2) +endif + +gdb-sqlite: sqlite-nuke +if HAVE_LIBSQLITE3 + $(LIBTOOL) --mode=execute gdb tests/sqlite_test +endif + +valgrind-sqlite: sqlite-nuke +if HAVE_LIBSQLITE3 + $(VALGRIND_COMMAND) $(SQLITE_TEST) $(ARG1) $(ARG2) +endif diff -Nru gearmand-0.14/tests/sqlite_test.c gearmand-0.23/tests/sqlite_test.c --- gearmand-0.14/tests/sqlite_test.c 2010-06-30 01:42:09.000000000 +0200 +++ gearmand-0.23/tests/sqlite_test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,223 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include -#include - -#include - -#include "test.h" -#include "test_gearmand.h" - -#define WORKER_TEST_PORT 32123 - -typedef struct -{ - pid_t gearmand_pid; - gearman_worker_st worker; - bool run_worker; -} worker_test_st; - -/* Prototypes */ -test_return_t echo_test(void *object); -test_return_t queue_add(void *object); -test_return_t queue_worker(void *object); - -test_return_t pre(void *object); -test_return_t post(void *object); - -void *world_create(test_return_t *error); -test_return_t world_destroy(void *object); - -/* Counter test for worker */ -static void *counter_function(gearman_job_st *job __attribute__((unused)), - void *context, size_t *result_size, - gearman_return_t *ret_ptr __attribute__((unused))) -{ - uint32_t *counter= (uint32_t *)context; - - *result_size= 0; - - *counter= *counter + 1; - - return NULL; -} - -test_return_t echo_test(void *object) -{ - gearman_client_st client, *client_ptr; - gearman_return_t rc; - size_t value_length; - const char *value= "This is my echo test"; - - (void)object; - - value_length= strlen(value); - - client_ptr= gearman_client_create(&client); - test_truth(client_ptr); - - rc= gearman_client_echo(&client, (uint8_t *)value, value_length); - - test_truth(rc == GEARMAN_SUCCESS); - - gearman_client_free(&client); - - return TEST_SUCCESS; -} - -static test_return_t queue_clean(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_st *worker= &(test->worker); - uint32_t counter= 0; - gearman_return_t rc; - - gearman_worker_set_timeout(worker, 200); - rc= gearman_worker_add_function(worker, "queue_test", 5, counter_function, &counter); - test_truth(rc == GEARMAN_SUCCESS); - - // Clean out any jobs that might still be in the queue from failed tests. - while (1) - { - rc= gearman_worker_work(worker); - if (rc != GEARMAN_SUCCESS) - break; - } - - return TEST_SUCCESS; -} - -test_return_t queue_add(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_client_st client, *client_ptr; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - uint8_t *value= (uint8_t *)"background_test"; - size_t value_length= strlen("background_test"); - gearman_return_t rc; - - test->run_worker= false; - - client_ptr= gearman_client_create(&client); - test_truth(client_ptr); - - rc= gearman_client_add_server(&client, NULL, WORKER_TEST_PORT); - test_truth(rc == GEARMAN_SUCCESS); - - rc= gearman_client_echo(&client, (uint8_t *)value, value_length); - test_truth(rc == GEARMAN_SUCCESS); - - rc= gearman_client_do_background(&client, "queue_test", NULL, value, - value_length, job_handle); - test_truth(rc == GEARMAN_SUCCESS); - - gearman_client_free(&client); - - test->run_worker= true; - - return TEST_SUCCESS; -} - -test_return_t queue_worker(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_st *worker= &(test->worker); - uint32_t counter= 0; - gearman_return_t rc; - - if (! test->run_worker) - return TEST_FAILURE; - - rc= gearman_worker_add_function(worker, "queue_test", 5, counter_function, &counter); - test_truth(rc == GEARMAN_SUCCESS); - - rc= gearman_worker_work(worker); - test_truth(rc == GEARMAN_SUCCESS); - - test_truth (counter != 0); - - return TEST_SUCCESS; -} - - -void *world_create(test_return_t *error) -{ - worker_test_st *test; - const char *argv[2]= { "test_gearmand", "--libsqlite3-db=tests/gearman.sql"}; - pid_t gearmand_pid; - - gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, "libsqlite3", (char **)argv, 2); - - test= malloc(sizeof(worker_test_st)); - if (! test) - { - *error= TEST_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - memset(test, 0, sizeof(worker_test_st)); - if (gearman_worker_create(&(test->worker)) == NULL) - { - *error= TEST_FAILURE; - return NULL; - } - - if (gearman_worker_add_server(&(test->worker), NULL, WORKER_TEST_PORT) != GEARMAN_SUCCESS) - { - *error= TEST_FAILURE; - return NULL; - } - - test->gearmand_pid= gearmand_pid; - - *error= TEST_SUCCESS; - - return (void *)test; -} - -test_return_t world_destroy(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - test_gearmand_stop(test->gearmand_pid); - gearman_worker_free(&(test->worker)); - free(test); - - return TEST_SUCCESS; -} - -test_st tests[] ={ - {"echo", 0, echo_test }, - {"clean", 0, queue_clean }, - {"add", 0, queue_add }, - {"worker", 0, queue_worker }, - {0, 0, 0} -}; - -collection_st collection[] ={ -#ifdef HAVE_LIBSQLITE3 - {"sqlite queue", 0, 0, tests}, -#endif - {0, 0, 0, 0} -}; - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; -} diff -Nru gearmand-0.14/tests/sqlite_test.cc gearmand-0.23/tests/sqlite_test.cc --- gearmand-0.14/tests/sqlite_test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/sqlite_test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,111 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +// Prototypes +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static test_return_t collection_init(void *object) +{ + const char *argv[3]= { "test_gearmand", "--libsqlite3-db=tests/gearman.sql", "--queue-type=libsqlite3"}; + + // Delete whatever might have been sitting around for the sql files + unlink("tests/gearman.sql"); + unlink("tests/gearman.sql-journal"); + + Context *test= (Context *)object; + assert(test); + + test_truth(test->initialize(3, argv)); + + return TEST_SUCCESS; +} + +static test_return_t collection_cleanup(void *object) +{ + Context *test= (Context *)object; + test->reset(); + + return TEST_SUCCESS; +} + + +void *world_create(test_return_t *error) +{ + Context *test= new Context(SQLITE_TEST_PORT); + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return test; +} + +test_return_t world_destroy(void *object) +{ + Context *test= (Context *)object; + + delete test; + + return TEST_SUCCESS; +} + +test_st tests[] ={ + {"gearman_client_echo()", 0, client_echo_test }, + {"gearman_client_echo() fail", 0, client_echo_fail_test }, + {"gearman_worker_echo()", 0, worker_echo_test }, + {"clean", 0, queue_clean }, + {"add", 0, queue_add }, + {"worker", 0, queue_worker }, + {0, 0, 0} +}; + +test_st regressions[] ={ + {"lp:734663", 0, lp_734663 }, + {0, 0, 0} +}; + +collection_st collection[] ={ + {"sqlite queue", collection_init, collection_cleanup, tests}, + {"queue regression", collection_init, collection_cleanup, regressions}, +#if 0 + {"sqlite queue change table", collection_init, collection_cleanup, tests}, +#endif + {0, 0, 0, 0} +}; + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; +} diff -Nru gearmand-0.14/tests/task.cc gearmand-0.23/tests/task.cc --- gearmand-0.14/tests/task.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/task.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,516 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +test_return_t gearman_client_add_task_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + worker_function, NULL, "dog", 3, + &ret); + test_true_got(gearman_success(ret), gearman_strerror(ret)); + test_truth(task); + + do + { + + // just for async IO + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + // If the task has been built to be freed, we won't have it to test + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + + } while (gearman_task_is_running(task)); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + + +test_return_t gearman_client_add_task_test_fail(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + worker_function, NULL, + gearman_literal_param("fail"), + &ret); + test_compare(GEARMAN_SUCCESS,ret); + test_truth(task); + test_truth(task->client); + + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + // If the task has been free() then we can't check anything about it + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + + test_truth(task->client); + + test_compare_got(GEARMAN_WORK_FAIL, gearman_task_return(task), gearman_task_error(task)); + + test_truth(task->client); + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_add_task_test_bad_workload(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + + // We test for pointer with zero size + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + worker_function, NULL, "fail", 0, + &ret); + test_true_got(ret == GEARMAN_INVALID_ARGUMENT, gearman_strerror(ret)); + test_false(task); + + // We test for NULL with size + task= gearman_client_add_task(client, NULL, NULL, + worker_function, NULL, NULL, 5, + &ret); + test_true_got(ret == GEARMAN_INVALID_ARGUMENT, gearman_strerror(ret)); + test_false(task); + + return TEST_SUCCESS; +} + +static gearman_return_t gearman_exception_test_function(gearman_task_st *task) +{ + bool *success= (bool *)gearman_task_context(task); + if (not success) + return GEARMAN_WORK_FAIL; + + *success= true; + return GEARMAN_SUCCESS; +} + +test_return_t gearman_client_add_task_exception(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SKIPPED; + } + + gearman_return_t ret; + + test_truth(gearman_client_set_server_option(client, gearman_literal_param("exceptions"))); + + gearman_client_set_exception_fn(client, gearman_exception_test_function); + + bool exception_success= false; + gearman_task_st *task= gearman_client_add_task(client, NULL, &exception_success, + worker_function, NULL, + gearman_literal_param("exception"), + &ret); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + test_truth(exception_success); + + gearman_client_set_exception_fn(client, NULL); + + // If the task has been free() then we can't check anything about it + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + + assert(client->task_list); + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_add_task_background_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task_background(client, NULL, NULL, + worker_function, NULL, "dog", 3, + &ret); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + do + { + + // just for async IO + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + // If the task has been built to be freed, we won't have it to test + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + + } while (gearman_task_is_running(task)); + + assert(client->task_list); + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_add_task_high_background_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task_high_background(client, NULL, NULL, + worker_function, NULL, "dog", 3, + &ret); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + do + { + + // just for async IO + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + // If the task has been built to be freed, we won't have it to test + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + } while (gearman_task_is_running(task)); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_add_task_low_background_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task_high_background(client, NULL, NULL, + worker_function, NULL, "dog", 3, + &ret); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + do + { + + // just for async IO + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + // If the task has been built to be freed, we won't have it to test + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + + } while (gearman_task_is_running(task)); + + if (not gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + gearman_task_free(task); + + return TEST_SUCCESS; +} + +static gearman_return_t gearman_warning_test_function(gearman_task_st *task) +{ + bool *success= (bool *)gearman_task_context(task); + if (not success) + return GEARMAN_WORK_FAIL; + + *success= true; + return GEARMAN_SUCCESS; +} + +test_return_t gearman_client_add_task_warning(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + + gearman_return_t ret; + + gearman_client_set_warning_fn(client, gearman_warning_test_function); + + bool warning_success= false; + gearman_task_st *task= gearman_client_add_task(client, NULL, &warning_success, + worker_function, NULL, + gearman_literal_param("warning"), + &ret); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + test_compare(GEARMAN_SUCCESS, + gearman_client_run_tasks(client)); + test_truth(warning_success); + + gearman_client_set_warning_fn(client, NULL); + if (not gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + gearman_task_free(task); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_add_task_no_servers(void *) +{ + gearman_client_st *client= gearman_client_create(NULL); + test_truth(client); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + "does not exist", NULL, + gearman_literal_param("dog"), + &ret); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + test_compare(GEARMAN_NO_SERVERS, + gearman_client_run_tasks(client)); + + test_compare(GEARMAN_NO_SERVERS, + gearman_client_run_tasks(client)); + + gearman_client_free(client); + + return TEST_SUCCESS; +} + +test_return_t gearman_client_add_task_pause_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + assert(client); + const char *worker_function= (const char *)gearman_client_context(client); + + assert(worker_function); + // Don't do this. + gearman_actions_t pause_actions= gearman_actions_pause(); + client->actions= pause_actions; + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + worker_function, NULL, "dog", 3, + &ret); + test_compare(client->actions.data_fn, pause_actions.data_fn); + test_compare_got(GEARMAN_SUCCESS, ret, gearman_strerror(ret)); + test_truth(task); + + do + { + // just for async IO + uint32_t count= 0; + do { + count++; + test_compare(client->actions.data_fn, pause_actions.data_fn); + ret= gearman_client_run_tasks(client); + test_compare(client->actions.data_fn, pause_actions.data_fn); + } while (gearman_continue(ret)); + + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + test_true(count > 1); + + // If the task has been built to be freed, we won't have it to test + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + return TEST_SUCCESS; + } + + } while (gearman_task_is_running(task)); + + gearman_task_free(task); + + return TEST_SUCCESS; +} + +struct _task_free_st { + int64_t count; + + _task_free_st() : + count(0) + { } + + void add() + { + count++; + } + + bool test() + { + return true; + } + + void reset() + { + count= 0; + } + + bool success() + { + if (count) + return true; + + return false; + } +}; + +static void test_task_free_fn(gearman_task_st *task, void *context) +{ + assert(task); + + _task_free_st *foo= (_task_free_st *)context; + assert(foo->test()); + + foo->add(); +} + +test_return_t gearman_client_set_task_context_free_fn_test(void *object) +{ + gearman_client_st *client= (gearman_client_st *)object; + assert(client); + + const char *worker_function= (const char *)gearman_client_context(client); + assert(worker_function); + + struct _task_free_st task_free_foo; + + + gearman_client_set_task_context_free_fn(client, test_task_free_fn); + + gearman_return_t ret; + gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, + worker_function, NULL, "dog", 3, + &ret); + test_true_got(gearman_success(ret), gearman_strerror(ret)); + test_truth(task); + gearman_task_set_context(task, &task_free_foo); + + do + { + + // just for async IO + do { + ret= gearman_client_run_tasks(client); + } while (gearman_continue(ret)); + + test_compare_got(GEARMAN_SUCCESS, ret, gearman_client_error(client)); + + // If the task has been built to be freed, we won't have it to test + if (gearman_client_has_option(client, GEARMAN_CLIENT_FREE_TASKS)) + { + test_true(task_free_foo.success()); + return TEST_SUCCESS; + } + + } while (gearman_task_is_running(task)); + + gearman_task_free(task); + + test_true(task_free_foo.success()); + + return TEST_SUCCESS; +} diff -Nru gearmand-0.14/tests/task.h gearmand-0.23/tests/task.h --- gearmand-0.14/tests/task.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/task.h 2011-06-20 05:31:42.000000000 +0200 @@ -0,0 +1,50 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +test_return_t gearman_client_add_task_test(void *); +test_return_t gearman_client_add_task_test_fail(void *); +test_return_t gearman_client_add_task_test_bad_workload(void *); +test_return_t gearman_client_add_task_background_test(void *); +test_return_t gearman_client_add_task_high_background_test(void *); +test_return_t gearman_client_add_task_low_background_test(void *); +test_return_t gearman_client_add_task_exception(void *); +test_return_t gearman_client_add_task_warning(void *); +test_return_t gearman_client_add_task_no_servers(void *); +test_return_t gearman_client_add_task_pause_test(void *); +test_return_t gearman_client_set_task_context_free_fn_test(void *); diff -Nru gearmand-0.14/tests/test.c gearmand-0.23/tests/test.c --- gearmand-0.14/tests/test.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,258 +0,0 @@ -/* uTest - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/* - Sample test application. -*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" - -static void world_stats_print(world_stats_st *stats) -{ - fprintf(stderr, "Total\t\t\t\t%u\n", stats->total); - fprintf(stderr, "\tFailed\t\t\t%u\n", stats->failed); - fprintf(stderr, "\tSkipped\t\t\t%u\n", stats->skipped); - fprintf(stderr, "\tSucceeded\t\t%u\n", stats->success); -} - -static long int timedif(struct timeval a, struct timeval b) -{ - register int us, s; - - us = (int)(a.tv_usec - b.tv_usec); - us /= 1000; - s = (int)(a.tv_sec - b.tv_sec); - s *= 1000; - return s + us; -} - -const char *test_strerror(test_return_t code) -{ - switch (code) { - case TEST_SUCCESS: - return "ok"; - case TEST_FAILURE: - return "failed"; - case TEST_MEMORY_ALLOCATION_FAILURE: - return "memory allocation"; - case TEST_SKIPPED: - return "skipped"; - case TEST_MAXIMUM_RETURN: - default: - fprintf(stderr, "Unknown return value\n"); - abort(); - } -} - -void create_core(void) -{ - if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL) - { - pid_t pid= fork(); - - if (pid == 0) - { - abort(); - } - else - { - while (waitpid(pid, NULL, 0) != pid) - { - ; - } - } - } -} - - -static test_return_t _runner_default(test_callback_fn func, void *p) -{ - if (func) - { - return func(p); - } - else - { - return TEST_SUCCESS; - } -} - -static world_runner_st defualt_runners= { - _runner_default, - _runner_default, - _runner_default -}; - - -int main(int argc, char *argv[]) -{ - test_return_t return_code; - unsigned int x; - char *collection_to_run= NULL; - char *wildcard= NULL; - world_st world; - collection_st *collection; - collection_st *next; - void *world_ptr; - - world_stats_st stats; - - memset(&stats, 0, sizeof(stats)); - memset(&world, 0, sizeof(world)); - get_world(&world); - - if (! world.runner) - { - world.runner= &defualt_runners; - } - - collection= world.collections; - - if (world.create) - { - test_return_t error; - world_ptr= world.create(&error); - if (error != TEST_SUCCESS) - exit(1); - } - else - { - world_ptr= NULL; - } - - if (argc > 1) - collection_to_run= argv[1]; - - if (argc == 3) - wildcard= argv[2]; - - for (next= collection; next->name; next++) - { - test_st *run; - - run= next->tests; - if (collection_to_run && fnmatch(collection_to_run, next->name, 0)) - continue; - - fprintf(stderr, "\n%s\n\n", next->name); - - for (x= 0; run->name; run++) - { - struct timeval start_time, end_time; - long int load_time= 0; - - if (wildcard && fnmatch(wildcard, run->name, 0)) - continue; - - fprintf(stderr, "\tTesting %s", run->name); - - if (world.collection_startup) - { - world.collection_startup(world_ptr); - } - - if (run->requires_flush && world.flush) - { - world.flush(world_ptr); - } - - if (world.pre_run) - { - world.pre_run(world_ptr); - } - - - if (next->pre && world.runner->pre) - { - return_code= world.runner->pre(next->pre, world_ptr); - - if (return_code != TEST_SUCCESS) - { - goto error; - } - } - - gettimeofday(&start_time, NULL); - return_code= world.runner->run(run->test_fn, world_ptr); - gettimeofday(&end_time, NULL); - load_time= timedif(end_time, start_time); - - if (next->post && world.runner->post) - { - (void) world.runner->post(next->post, world_ptr); - } - - if (world.post_run) - { - world.post_run(world_ptr); - } - -error: - stats.total++; - - fprintf(stderr, "\t\t\t\t\t"); - - switch (return_code) - { - case TEST_SUCCESS: - fprintf(stderr, "%ld.%03ld ", load_time / 1000, load_time % 1000); - stats.success++; - break; - case TEST_FAILURE: - stats.failed++; - break; - case TEST_SKIPPED: - stats.skipped++; - break; - case TEST_MEMORY_ALLOCATION_FAILURE: - case TEST_MAXIMUM_RETURN: - default: - break; - } - - fprintf(stderr, "[ %s ]\n", test_strerror(return_code)); - - if (world.on_error) - { - test_return_t rc; - rc= world.on_error(return_code, world_ptr); - - if (rc != TEST_SUCCESS) - break; - } - } - } - - fprintf(stderr, "\n\nAll tests completed successfully\n\n"); - - if (world.destroy) - { - test_return_t error; - error= world.destroy(world_ptr); - - if (error != TEST_SUCCESS) - { - fprintf(stderr, "Failure during shutdown.\n"); - stats.failed++; // We do this to make our exit code return 1 - } - } - - world_stats_print(&stats); - - return stats.failed == 0 ? 0 : 1; -} diff -Nru gearmand-0.14/tests/test_gearmand.c gearmand-0.23/tests/test_gearmand.c --- gearmand-0.14/tests/test_gearmand.c 2010-06-30 10:01:43.000000000 +0200 +++ gearmand-0.23/tests/test_gearmand.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,167 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "test_gearmand.h" - - -pid_t test_gearmand_start(in_port_t port, const char *queue_type, - char *argv[], int argc) -{ - pid_t gearmand_pid= -1; - - char file_buffer[1024]; - char log_buffer[1024]; - char buffer[8196]; - char *buffer_ptr= buffer; - - log_buffer[0]= 0; - file_buffer[0]= 0; - - if (getenv("GEARMAN_MANUAL_GDB")) - { - snprintf(buffer_ptr, sizeof(buffer), "libtool --mode=execute gdb gearmand/gearmand"); - buffer_ptr+= strlen(buffer_ptr); - } - else if (getenv("GEARMAN_VALGRIND")) - { - snprintf(buffer_ptr, sizeof(buffer), "libtool --mode=execute valgrind --log-file=tests/valgrind.out --leak-check=full --show-reachable=yes "); - buffer_ptr+= strlen(buffer_ptr); - } - - if (getenv("GEARMAN_MANUAL_GDB")) - { - snprintf(file_buffer, sizeof(file_buffer), "tests/gearman.pidXXXXXX"); - if (mkstemp(file_buffer) == -1) - { - perror("mkstemp"); - abort(); - } - snprintf(buffer_ptr, sizeof(buffer), "\nrun --pid-file=%s -vvvvvv --port=%u", file_buffer, port); - buffer_ptr+= strlen(buffer_ptr); - } - else if (getenv("GEARMAN_LOG")) - { - snprintf(file_buffer, sizeof(file_buffer), "tests/gearman.pidXXXXXX"); - if (mkstemp(file_buffer) == -1) - { - perror("mkstemp"); - abort(); - } - snprintf(log_buffer, sizeof(log_buffer), "tests/gearmand.logXXXXXX"); - if (mkstemp(log_buffer) == -1) - { - perror("mkstemp"); - abort(); - } - snprintf(buffer_ptr, sizeof(buffer), "./gearmand/gearmand --pid-file=%s --daemon --port=%u -vvvvvv --log-file=%s", file_buffer, port, log_buffer); - buffer_ptr+= strlen(buffer_ptr); - } - else - { - snprintf(file_buffer, sizeof(file_buffer), "tests/gearman.pidXXXXXX"); - if (mkstemp(file_buffer) == -1) - { - perror("mkstemp"); - abort(); - } - snprintf(buffer_ptr, sizeof(buffer), "./gearmand/gearmand --pid-file=%s --daemon --port=%u", file_buffer, port); - buffer_ptr+= strlen(buffer_ptr); - } - - if (queue_type) - { - snprintf(buffer_ptr, sizeof(buffer), " --queue-type=%s ", queue_type); - buffer_ptr+= strlen(buffer_ptr); - } - - for (int x= 1 ; x < argc ; x++) - { - snprintf(buffer_ptr, sizeof(buffer), " %s ", argv[x]); - } - - fprintf(stderr, "%s\n", buffer); - if (getenv("GEARMAN_MANUAL_GDB")) - { - fprintf(stderr, "Pausing for startup, hit return when ready.\n"); - getchar(); - } - else - { - int err= system(buffer); - assert(err != -1); - } - - // Sleep to make sure the server is up and running (or we could poll....) - uint32_t counter= 3; - while (--counter) - { - sleep(1); - - FILE *file; - file= fopen(file_buffer, "r"); - if (file == NULL) - { - continue; - } - char *found= fgets(buffer, 8196, file); - if (!found) - { - abort(); - } - gearmand_pid= atoi(buffer); - fclose(file); - } - - if (gearmand_pid == -1) - { - fprintf(stderr, "Could not attach to gearman server, could server already be running on port %u\n", port); - abort(); - } - unlink(file_buffer); - - - return gearmand_pid; -} - -void test_gearmand_stop(pid_t gearmand_pid) -{ - int ret; - pid_t pid; - - ret= kill(gearmand_pid, SIGKILL); - - if (ret != 0) - { - if (ret == -1) - { - perror(strerror(errno)); - } - - return; - } - - pid= waitpid(gearmand_pid, NULL, 0); - - sleep(3); -} diff -Nru gearmand-0.14/tests/test_gearmand.h gearmand-0.23/tests/test_gearmand.h --- gearmand-0.14/tests/test_gearmand.h 2010-06-30 00:17:58.000000000 +0200 +++ gearmand-0.23/tests/test_gearmand.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#include -#include - -pid_t test_gearmand_start(in_port_t port, const char *queue_type, - char *argv[], int argc); -void test_gearmand_stop(pid_t gearmand_pid); diff -Nru gearmand-0.14/tests/test.h gearmand-0.23/tests/test.h --- gearmand-0.14/tests/test.h 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/test.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,165 +0,0 @@ -/* uTest - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -/* - Structures for generic tests. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -typedef struct world_st world_st; -typedef struct collection_st collection_st; -typedef struct test_st test_st; - -typedef enum { - TEST_SUCCESS= 0, /* Backwards compatibility */ - TEST_FAILURE, - TEST_MEMORY_ALLOCATION_FAILURE, - TEST_SKIPPED, - TEST_MAXIMUM_RETURN /* Always add new error code before */ -} test_return_t; - -typedef void *(*test_callback_create_fn)(test_return_t *error); -typedef test_return_t (*test_callback_fn)(void *); -typedef test_return_t (*test_callback_runner_fn)(test_callback_fn, void *); -typedef test_return_t (*test_callback_error_fn)(test_return_t, void *); - - -/** - A structure describing the test case. -*/ -struct test_st { - const char *name; - bool requires_flush; - test_callback_fn test_fn; -}; - - -/** - A structure which describes a collection of test cases. -*/ -struct collection_st { - const char *name; - test_callback_fn pre; - test_callback_fn post; - test_st *tests; -}; - - -/** - Structure which houses the actual callers for the test cases contained in - the collections. -*/ -typedef struct { - test_callback_runner_fn pre; - test_callback_runner_fn run; - test_callback_runner_fn post; -} world_runner_st; - - -/** - world_st is the structure which is passed to the test implementation to be filled. - This must be implemented in order for the test framework to load the tests. We call - get_world() in order to fill this structure. -*/ - -struct world_st { - collection_st *collections; - - /* These methods are called outside of any collection call. */ - test_callback_create_fn create; - test_callback_fn destroy; - - /* This is called a the beginning of any collection run. */ - test_callback_fn collection_startup; - - /* This called on a test if the test requires a flush call (the bool is from test_st) */ - test_callback_fn flush; - - /** - These are run before/after the test. If implemented. Their execution is not controlled - by the test. - */ - test_callback_fn pre_run; - test_callback_fn post_run; - - /** - If an error occurs during the test, this is called. - */ - test_callback_error_fn on_error; - - /** - Runner represents the callers for the tests. If not implemented we will use - a set of default implementations. - */ - world_runner_st *runner; -}; - - - -/** - @note world_stats_st is a simple structure for tracking test successes. -*/ -typedef struct { - uint32_t success; - uint32_t skipped; - uint32_t failed; - uint32_t total; -} world_stats_st; - -/* How we make all of this work :) */ -void get_world(world_st *world); - -void create_core(void); - -/** - @note Friendly print function for errors. -*/ -const char *test_strerror(test_return_t code); - -#define test_truth(A) \ -do \ -{ \ - if (! (A)) { \ - fprintf(stderr, "\nAssertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\ - create_core(); \ - return TEST_FAILURE; \ - } \ -} while (0) - -#define test_false(A) \ -do \ -{ \ - if ((A)) { \ - fprintf(stderr, "\nAssertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\ - create_core(); \ - return TEST_FAILURE; \ - } \ -} while (0) - -#define test_strcmp(A,B) \ -do \ -{ \ - if (strcmp((A), (B))) \ - { \ - fprintf(stderr, "\n%s:%d: %s -> %s\n", __FILE__, __LINE__, (A), (B)); \ - create_core(); \ - return TEST_FAILURE; \ - } \ -} while (0) - -#ifdef __cplusplus -} -#endif diff -Nru gearmand-0.14/tests/test_worker.c gearmand-0.23/tests/test_worker.c --- gearmand-0.14/tests/test_worker.c 2010-06-30 02:15:26.000000000 +0200 +++ gearmand-0.23/tests/test_worker.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,100 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include "test_worker.h" - - -struct context_st { - in_port_t port; - const char *function_name; - gearman_worker_fn *function; - void *function_arg; - struct worker_handle_st *handle; -}; - -static void *thread_runner(void *con) -{ - struct context_st *context= (struct context_st *)con; - gearman_worker_st worker; - - assert(gearman_worker_create(&worker) != NULL); - assert(gearman_worker_add_server(&worker, NULL, context->port) == GEARMAN_SUCCESS); - assert(gearman_worker_add_function(&worker, context->function_name, 0, context->function, - context->function_arg) == GEARMAN_SUCCESS); - - gearman_worker_set_timeout(&worker, 100); - - assert(context->handle); - - while (context->handle->shutdown == false) - { - gearman_return_t ret= gearman_worker_work(&worker); - (void)ret; - } - - gearman_worker_free(&worker); - - free(context); - - pthread_exit(0); -} - -struct worker_handle_st *test_worker_start(in_port_t port, const char *function_name, - gearman_worker_fn *function, void *function_arg) -{ - pthread_attr_t attr; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - struct worker_handle_st *handle= (struct worker_handle_st *)calloc(1, sizeof(struct worker_handle_st)); - assert(handle); - - struct context_st *foo= (struct context_st *)calloc(1, sizeof(struct context_st)); - - foo->port= port; - foo->function_name= function_name; - foo->function= function; - foo->function_arg= function_arg; - foo->handle= handle; - - int rc= pthread_create(&handle->thread, &attr, thread_runner, foo); - assert(rc == 0); - - pthread_attr_destroy(&attr); - - /* Wait for the server to start and bind the port. */ - struct timespec dream, rem; - - dream.tv_nsec= 0; - dream.tv_sec= 1; - - nanosleep(&dream, &rem); - - return handle; -} - -void test_worker_stop(struct worker_handle_st *handle) -{ - void *unused; - fflush(stderr); - handle->shutdown= true; - pthread_join(handle->thread, &unused); - free(handle); -} diff -Nru gearmand-0.14/tests/test_worker.h gearmand-0.23/tests/test_worker.h --- gearmand-0.14/tests/test_worker.h 2010-06-30 02:15:26.000000000 +0200 +++ gearmand-0.23/tests/test_worker.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#include -#include - -#include - -struct worker_handle_st -{ - pthread_t thread; - volatile bool shutdown; -}; - -struct worker_handle_st *test_worker_start(in_port_t port, const char *function_name, - gearman_worker_fn *function, void *function_arg); -void test_worker_stop(struct worker_handle_st *); diff -Nru gearmand-0.14/tests/tokyocabinet.am gearmand-0.23/tests/tokyocabinet.am --- gearmand-0.14/tests/tokyocabinet.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/tokyocabinet.am 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,40 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential, http://datadifferential.com/ +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root +# + +test-tokyocabinet: test-tokyocabinet-args test-tokyocabinet-queue + +if HAVE_LIBTOKYOCABINET +TOKYOCABINET_TEST= tests/tokyocabinet_test +TOKYOCABINET_RM= @rm -f tests/gearman.tcb +CLEANFILES+= tests/gearman.tcb +noinst_PROGRAMS += tests/tokyocabinet_test +endif + +tests_tokyocabinet_test_SOURCES= tests/tokyocabinet_test.cc tests/basic.cc +tests_tokyocabinet_test_LDADD= ${CLIENT_LDADD} + +test-tokyocabinet-args: gearmand/gearmand +if HAVE_LIBTOKYOCABINET + @gearmand/gearmand --check-args --libtokyocabinet-file=tmp/file --libtokyocabinet-optimize +endif + +test-tokyocabinet-queue: +if HAVE_LIBTOKYOCABINET + $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) + $(TOKYOCABINET_RM) +endif + +valgrind-tokyocabinet: +if HAVE_LIBTOKYOCABINET + $(VALGRIND_COMMAND) $(TOKYOCABINET_TEST) $(ARG1) $(ARG2) + $(TOKYOCABINET_RM) +endif diff -Nru gearmand-0.14/tests/tokyocabinet_test.c gearmand-0.23/tests/tokyocabinet_test.c --- gearmand-0.14/tests/tokyocabinet_test.c 2010-06-15 03:12:11.000000000 +0200 +++ gearmand-0.23/tests/tokyocabinet_test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,175 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include -#include - -#include - -#include "test.h" -#include "test_gearmand.h" - -#define WORKER_TEST_PORT 32123 - -typedef struct -{ - pid_t gearmand_pid; - gearman_worker_st worker; - bool run_worker; -} worker_test_st; - -/* Prototypes */ -test_return_t queue_add(void *object); -test_return_t queue_worker(void *object); - -test_return_t pre(void *object); -test_return_t post(void *object); -test_return_t flush(void *object); - -void *world_create(test_return_t *error); -test_return_t world_destroy(void *object); - -/* Counter test for worker */ -static void *counter_function(gearman_job_st *job __attribute__((unused)), - void *context, size_t *result_size, - gearman_return_t *ret_ptr __attribute__((unused))) -{ - uint32_t *counter= (uint32_t *)context; - - *result_size= 0; - - *counter= *counter + 1; - - return NULL; -} - -test_return_t queue_add(void *object) -{ - gearman_return_t rc; - worker_test_st *test= (worker_test_st *)object; - gearman_client_st client; - gearman_client_st *check; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - uint8_t *value= (uint8_t *)"background_test"; - size_t value_length= strlen("background_test"); - - test->run_worker= false; - - check= gearman_client_create(&client); - test_truth(check); - - rc= gearman_client_add_server(&client, NULL, WORKER_TEST_PORT); - test_truth(rc == GEARMAN_SUCCESS); - - rc= gearman_client_do_background(&client, "queue_test", NULL, value, value_length, job_handle); - test_truth(rc == GEARMAN_SUCCESS); - - gearman_client_free(&client); - - test->run_worker= true; - return TEST_SUCCESS; -} - -test_return_t queue_worker(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_st *worker= &(test->worker); - uint32_t counter= 0; - - if (!test->run_worker) - return TEST_FAILURE; - - if (gearman_worker_add_function(worker, "queue_test", 5, counter_function, - &counter) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_worker_work(worker) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - if (counter == 0) - return TEST_FAILURE; - - return TEST_SUCCESS; -} - - -void *world_create(test_return_t *error) -{ - worker_test_st *test; - pid_t gearmand_pid; - const char *argv[2]= { "test_gearmand", "--libtokyocabinet-file=tests/gearman.tcb" }; - - gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, "libtokyocabinet", (char **)argv, 2); - - test= malloc(sizeof(worker_test_st)); - if (! test) - { - *error= TEST_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - memset(test, 0, sizeof(worker_test_st)); - if (gearman_worker_create(&(test->worker)) == NULL) - { - *error= TEST_FAILURE; - return NULL; - } - - if (gearman_worker_add_server(&(test->worker), NULL, WORKER_TEST_PORT) != GEARMAN_SUCCESS) - { - *error= TEST_FAILURE; - return NULL; - } - - test->gearmand_pid= gearmand_pid; - - *error= TEST_SUCCESS; - - return (void *)test; -} - -test_return_t world_destroy(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - gearman_worker_free(&(test->worker)); - test_gearmand_stop(test->gearmand_pid); - free(test); - - return TEST_SUCCESS; -} - -test_st tests[] ={ - {"add", 0, queue_add }, - {"worker", 0, queue_worker }, - {0, 0, 0} -}; - -collection_st collection[] ={ -#ifdef HAVE_LIBTOKYOCABINET - {"tokyocabinet queue", 0, 0, tests}, -#endif - {0, 0, 0, 0} -}; - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; -} diff -Nru gearmand-0.14/tests/tokyocabinet_test.cc gearmand-0.23/tests/tokyocabinet_test.cc --- gearmand-0.14/tests/tokyocabinet_test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/tokyocabinet_test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,101 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +void *world_create(test_return_t *error); +test_return_t world_destroy(void *object); + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static test_return_t collection_init(void *object) +{ + const char *argv[3]= { "test_gearmand", "--libtokyocabinet-file=tests/gearman.tcb", "--queue-type=libtokyocabinet" }; + + unlink("tests/gearman.tcb"); + + Context *test= (Context *)object; + assert(test); + + test_truth(test->initialize(3, argv)); + + return TEST_SUCCESS; +} + +static test_return_t collection_cleanup(void *object) +{ + Context *test= (Context *)object; + test->reset(); + + return TEST_SUCCESS; +} + + +void *world_create(test_return_t *error) +{ + Context *test= new Context(TOKYOCABINET_TEST_PORT); + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return test; +} + +test_return_t world_destroy(void *object) +{ + Context *test= (Context *)object; + + delete test; + + return TEST_SUCCESS; +} + +test_st tests[] ={ + {"gearman_client_echo()", 0, client_echo_test }, + {"gearman_client_echo() fail", 0, client_echo_fail_test }, + {"gearman_worker_echo()", 0, worker_echo_test }, + {"clean", 0, queue_clean }, + {"add", 0, queue_add }, + {"worker", 0, queue_worker }, + {0, 0, 0} +}; + +collection_st collection[] ={ +#ifdef HAVE_LIBTOKYOCABINET + {"tokyocabinet queue", collection_init, collection_cleanup, tests}, +#endif + {0, 0, 0, 0} +}; + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; +} diff -Nru gearmand-0.14/tests/unique.cc gearmand-0.23/tests/unique.cc --- gearmand-0.14/tests/unique.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/unique.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,71 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + + +test_return_t unique_compare_test(void *object) +{ + gearman_return_t rc; + gearman_client_st *client= (gearman_client_st *)object; + const char *worker_function= (const char *)gearman_client_context(client); + size_t job_length; + + gearman_string_t unique= { gearman_literal_param("my little unique") }; + + void *job_result= gearman_client_do(client, worker_function, gearman_c_str(unique), + gearman_string_param(unique), + &job_length, &rc); + + test_true_got(rc == GEARMAN_SUCCESS, gearman_client_error(client) ? gearman_client_error(client) : gearman_strerror(rc)); + test_compare(gearman_size(unique), job_length); + test_memcmp(gearman_c_str(unique), job_result, job_length); + + free(job_result); + + return TEST_SUCCESS; +} + diff -Nru gearmand-0.14/tests/unique.h gearmand-0.23/tests/unique.h --- gearmand-0.14/tests/unique.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/unique.h 2011-06-03 04:13:30.000000000 +0200 @@ -0,0 +1,43 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include + +test_return_t unique_compare_test(void *); + diff -Nru gearmand-0.14/tests/workers.cc gearmand-0.23/tests/workers.cc --- gearmand-0.14/tests/workers.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/workers.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,236 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +gearman_return_t echo_or_react_worker_v2(gearman_job_st *job, void *) +{ + const void *workload= gearman_job_workload(job); + size_t result_size= gearman_job_workload_size(job); + + if (workload == NULL or result_size == 0) + { + assert(workload == NULL and result_size == 0); + return GEARMAN_SUCCESS; + } + else if (result_size == gearman_literal_param_size("fail") and (not memcmp(workload, gearman_literal_param("fail")))) + { + return GEARMAN_FATAL; + } + else if (result_size == gearman_literal_param_size("exception") and (not memcmp(workload, gearman_literal_param("exception")))) + { + gearman_return_t rc= gearman_job_send_exception(job, gearman_literal_param("test exception")); + if (gearman_failed(rc)) + { + return GEARMAN_ERROR; + } + } + else if (result_size == gearman_literal_param_size("warning") and (not memcmp(workload, gearman_literal_param("warning")))) + { + gearman_return_t rc= gearman_job_send_warning(job, gearman_literal_param("test warning")); + if (gearman_failed(rc)) + { + return GEARMAN_ERROR; + } + } + + if (gearman_failed(gearman_job_send_data(job, workload, result_size))) + { + return GEARMAN_ERROR; + } + + return GEARMAN_SUCCESS; +} + +gearman_return_t echo_or_react_chunk_worker_v2(gearman_job_st *job, void *) +{ + const char *workload= (const char *)gearman_job_workload(job); + size_t workload_size= gearman_job_workload_size(job); + + bool fail= false; + if (workload_size == gearman_literal_param_size("fail") and (not memcmp(workload, gearman_literal_param("fail")))) + { + fail= true; + } + else if (workload_size == gearman_literal_param_size("exception") and (not memcmp(workload, gearman_literal_param("exception")))) + { + if (gearman_failed(gearman_job_send_exception(job, gearman_literal_param("test exception")))) + { + return GEARMAN_ERROR; + } + } + else if (workload_size == gearman_literal_param_size("warning") and (not memcmp(workload, gearman_literal_param("warning")))) + { + if (gearman_failed(gearman_job_send_warning(job, gearman_literal_param("test warning")))) + { + return GEARMAN_ERROR; + } + } + + for (size_t x= 0; x < workload_size; x++) + { + // Chunk + { + if (gearman_failed(gearman_job_send_data(job, &workload[x], 1))) + { + return GEARMAN_ERROR; + } + } + + // report status + { + if (gearman_failed(gearman_job_send_status(job, (uint32_t)x, (uint32_t)workload_size))) + { + return GEARMAN_ERROR; + } + + if (fail) + { + return GEARMAN_FATAL; + } + } + } + + return GEARMAN_SUCCESS; +} + +// payload is unique value +gearman_return_t unique_worker_v2(gearman_job_st *job, void *) +{ + const char *workload= static_cast(gearman_job_workload(job)); + + assert(job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_UNIQ); + assert(gearman_job_unique(job)); + assert(strlen(gearman_job_unique(job))); + assert(gearman_job_workload_size(job)); + assert(strlen(gearman_job_unique(job)) == gearman_job_workload_size(job)); + assert(not memcmp(workload, gearman_job_unique(job), gearman_job_workload_size(job))); + if (gearman_job_workload_size(job) == strlen(gearman_job_unique(job))) + { + if (not memcmp(workload, gearman_job_unique(job), gearman_job_workload_size(job))) + { + if (gearman_failed(gearman_job_send_data(job, workload, gearman_job_workload_size(job)))) + { + return GEARMAN_ERROR; + } + + return GEARMAN_SUCCESS; + } + } + + return GEARMAN_FATAL; +} + +gearman_return_t count_worker(gearman_job_st *job, void *) +{ + char buffer[GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; + + int length= snprintf(buffer, sizeof(buffer), "%lu", static_cast(gearman_job_workload_size(job))); + + if (size_t(length) > sizeof(buffer) or length < 0) + { + return GEARMAN_FATAL; + } + + return GEARMAN_SUCCESS; +} + +static pthread_mutex_t increment_reset_worker_mutex= PTHREAD_MUTEX_INITIALIZER; + +gearman_return_t increment_reset_worker_v2(gearman_job_st *job, void *) +{ + static long counter= 0; + long change= 0; + const char *workload= (const char*)gearman_job_workload(job); + + if (gearman_job_workload_size(job) == gearman_literal_param_size("reset") and (not memcmp(workload, gearman_literal_param("reset")))) + { + pthread_mutex_lock(&increment_reset_worker_mutex); + counter= 0; + pthread_mutex_unlock(&increment_reset_worker_mutex); + + return GEARMAN_SUCCESS; + } + else if (workload and gearman_job_workload_size(job)) + { + if (gearman_job_workload_size(job) > GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH) + { + return GEARMAN_FATAL; + } + + char temp[GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; + memcpy(temp, workload, gearman_job_workload_size(job)); + temp[gearman_job_workload_size(job)]= 0; + change= strtol(temp, (char **)NULL, 10); + if (change == LONG_MIN or change == LONG_MAX or ( change == 0 and errno < 0)) + { + gearman_job_send_warning(job, gearman_literal_param("strtol() failed")); + return GEARMAN_FATAL; + } + } + + { + pthread_mutex_lock(&increment_reset_worker_mutex); + counter= counter +change; + + char result[GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; + size_t result_size= size_t(snprintf(result, sizeof(result), "%ld", counter)); + if (gearman_failed(gearman_job_send_data(job, result, result_size))) + { + return GEARMAN_FATAL; + } + + pthread_mutex_unlock(&increment_reset_worker_mutex); + } + + return GEARMAN_SUCCESS; +} diff -Nru gearmand-0.14/tests/workers.h gearmand-0.23/tests/workers.h --- gearmand-0.14/tests/workers.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/workers.h 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,48 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +gearman_return_t echo_or_react_worker_v2(gearman_job_st *job, void *context); + +gearman_return_t echo_or_react_chunk_worker_v2(gearman_job_st *job, void *context); + +gearman_return_t unique_worker_v2(gearman_job_st *job, void *context); + +gearman_return_t increment_reset_worker_v2(gearman_job_st *job, void *context); + +gearman_return_t count_worker(gearman_job_st *job, void *context); diff -Nru gearmand-0.14/tests/workers_v1.cc gearmand-0.23/tests/workers_v1.cc --- gearmand-0.14/tests/workers_v1.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/workers_v1.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,319 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +void *echo_or_react_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr) +{ + const void *workload= gearman_job_workload(job); + *result_size= gearman_job_workload_size(job); + + if (workload == NULL or *result_size == 0) + { + assert(workload == NULL and *result_size == 0); + *ret_ptr= GEARMAN_SUCCESS; + return NULL; + } + else if (*result_size == gearman_literal_param_size("fail") and (not memcmp(workload, gearman_literal_param("fail")))) + { + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + else if (*result_size == gearman_literal_param_size("exception") and (not memcmp(workload, gearman_literal_param("exception")))) + { + gearman_return_t rc= gearman_job_send_exception(job, gearman_literal_param("test exception")); + if (gearman_failed(rc)) + { + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + else if (*result_size == gearman_literal_param_size("warning") and (not memcmp(workload, gearman_literal_param("warning")))) + { + gearman_return_t rc= gearman_job_send_warning(job, gearman_literal_param("test warning")); + if (gearman_failed(rc)) + { + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + + void *result= malloc(*result_size); + assert(result); + memcpy(result, workload, *result_size); + + *ret_ptr= GEARMAN_SUCCESS; + return result; +} + +void *echo_or_react_chunk_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr) +{ + const char *workload; + workload= (const char *)gearman_job_workload(job); + size_t workload_size= gearman_job_workload_size(job); + + bool fail= false; + if (workload_size == gearman_literal_param_size("fail") and (not memcmp(workload, gearman_literal_param("fail")))) + { + fail= true; + } + else if (workload_size == gearman_literal_param_size("exception") and (not memcmp(workload, gearman_literal_param("exception")))) + { + gearman_return_t rc= gearman_job_send_exception(job, gearman_literal_param("test exception")); + if (gearman_failed(rc)) + { + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + else if (workload_size == gearman_literal_param_size("warning") and (not memcmp(workload, gearman_literal_param("warning")))) + { + gearman_return_t rc= gearman_job_send_warning(job, gearman_literal_param("test warning")); + if (gearman_failed(rc)) + { + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + + for (size_t x= 0; x < workload_size; x++) + { + // Chunk + { + *ret_ptr= gearman_job_send_data(job, &workload[x], 1); + if (*ret_ptr != GEARMAN_SUCCESS) + { + return NULL; + } + } + + // report status + { + *ret_ptr= gearman_job_send_status(job, (uint32_t)x, + (uint32_t)workload_size); + assert(gearman_success(*ret_ptr)); + if (gearman_failed(*ret_ptr)) + { + return NULL; + } + + if (fail) + { + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + } + + *ret_ptr= GEARMAN_SUCCESS; + *result_size= 0; + + return NULL; +} + +// payload is unique value +void *unique_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr) +{ + const char *workload= static_cast(gearman_job_workload(job)); + + assert(job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_UNIQ); + assert(gearman_job_unique(job)); + assert(strlen(gearman_job_unique(job))); + assert(gearman_job_workload_size(job)); + assert(strlen(gearman_job_unique(job)) == gearman_job_workload_size(job)); + assert(not memcmp(workload, gearman_job_unique(job), gearman_job_workload_size(job))); + if (gearman_job_workload_size(job) == strlen(gearman_job_unique(job))) + { + if (not memcmp(workload, gearman_job_unique(job), gearman_job_workload_size(job))) + { + void *result= malloc(gearman_job_workload_size(job)); + assert(result); + memcpy(result, workload, gearman_job_workload_size(job)); + *result_size= gearman_job_workload_size(job); + *ret_ptr= GEARMAN_SUCCESS; + + return result; + } + } + + *result_size= 0; + *ret_ptr= GEARMAN_WORK_FAIL; + + return NULL; +} + +gearman_return_t cat_aggregator_fn(gearman_aggregator_st *, gearman_task_st *task, gearman_result_st *result) +{ + std::string string_value; + + do + { + assert(task); + gearman_result_st *result_ptr= gearman_task_result(task); + + if (result_ptr) + { + if (not gearman_result_size(result_ptr)) + return GEARMAN_WORK_EXCEPTION; + + string_value.append(gearman_result_value(result_ptr), gearman_result_size(result_ptr)); + } + } while ((task= gearman_next(task))); + + gearman_result_store_value(result, string_value.c_str(), string_value.size()); + + return GEARMAN_SUCCESS; +} + +gearman_return_t split_worker(gearman_job_st *job, void* /* context */) +{ + const char *workload= static_cast(gearman_job_workload(job)); + size_t workload_size= gearman_job_workload_size(job); + + assert(job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL); + + const char *chunk_begin= workload; + for (size_t x= 0; x < workload_size; x++) + { + if (int(workload[x]) == 0 or int(workload[x]) == int(' ')) + { + if ((workload +x -chunk_begin) == 11 and not memcmp(chunk_begin, gearman_literal_param("mapper_fail"))) + { + return GEARMAN_FATAL; + } + + // NULL Chunk + gearman_return_t rc= gearman_job_send_data(job, chunk_begin, workload +x -chunk_begin); + if (gearman_failed(rc)) + { + return GEARMAN_FATAL; + } + + chunk_begin= workload +x +1; + } + } + + if (chunk_begin < workload +workload_size) + { + if ((size_t(workload +workload_size) -size_t(chunk_begin) ) == 11 and not memcmp(chunk_begin, gearman_literal_param("mapper_fail"))) + { + return GEARMAN_FATAL; + } + + gearman_return_t rc= gearman_job_send_data(job, chunk_begin, size_t(workload +workload_size) -size_t(chunk_begin)); + if (gearman_failed(rc)) + { + return GEARMAN_FATAL; + } + } + + return GEARMAN_SUCCESS; +} + +static pthread_mutex_t increment_reset_worker_mutex= PTHREAD_MUTEX_INITIALIZER; + +void *increment_reset_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr) +{ + static long counter= 0; + long change= 0; + const char *workload= (const char*)gearman_job_workload(job); + + if (gearman_job_workload_size(job) == gearman_literal_param_size("reset") and (not memcmp(workload, gearman_literal_param("reset")))) + { + pthread_mutex_lock(&increment_reset_worker_mutex); + counter= 0; + pthread_mutex_unlock(&increment_reset_worker_mutex); + *ret_ptr= GEARMAN_SUCCESS; + return NULL; + } + else if (workload and gearman_job_workload_size(job)) + { + char *temp= static_cast(malloc(gearman_job_workload_size(job) +1)); + assert(temp); + memcpy(temp, workload, gearman_job_workload_size(job)); + temp[gearman_job_workload_size(job)]= 0; + change= strtol(temp, (char **)NULL, 10); + free(temp); + if (change == LONG_MIN or change == LONG_MAX or ( change == 0 and errno < 0)) + { + gearman_job_send_warning(job, gearman_literal_param("strtol() failed")); + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + } + + char *result; + { + pthread_mutex_lock(&increment_reset_worker_mutex); + counter= counter +change; + + result= (char *)malloc(40); + if (not result) + { + gearman_job_send_warning(job, gearman_literal_param("malloc() failed")); + *ret_ptr= GEARMAN_WORK_FAIL; + return NULL; + } + *result_size= size_t(snprintf(result, 40, "%ld", counter)); + + pthread_mutex_unlock(&increment_reset_worker_mutex); + } + + + *ret_ptr= GEARMAN_SUCCESS; + + return result; +} diff -Nru gearmand-0.14/tests/workers_v1.h gearmand-0.23/tests/workers_v1.h --- gearmand-0.14/tests/workers_v1.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/workers_v1.h 2011-06-16 06:00:25.000000000 +0200 @@ -0,0 +1,53 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +void *echo_or_react_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr); + +void *echo_or_react_chunk_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr); + +void *unique_worker(gearman_job_st *job, void *, + size_t *result_size, gearman_return_t *ret_ptr); + +gearman_return_t split_worker(gearman_job_st *job, void *); + +gearman_return_t cat_aggregator_fn(gearman_aggregator_st *aggregator, gearman_task_st *task, gearman_result_st *result); + +void *increment_reset_worker(gearman_job_st *job, void *, size_t *result_size, gearman_return_t *ret_ptr); diff -Nru gearmand-0.14/tests/worker_test.c gearmand-0.23/tests/worker_test.c --- gearmand-0.14/tests/worker_test.c 2010-06-30 12:41:46.000000000 +0200 +++ gearmand-0.23/tests/worker_test.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,738 +0,0 @@ -/* Gearman server and library - * Copyright (C) 2008 Brian Aker, Eric Day - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#if defined(NDEBUG) -# undef NDEBUG -#endif - -#include -#include -#include -#include -#include - -#define GEARMAN_CORE - -#include - -#include "test.h" -#include "test_gearmand.h" - -#define WORKER_TEST_PORT 32123 - -typedef struct -{ - pid_t gearmand_pid; - gearman_worker_st worker; -} worker_test_st; - -/* Prototypes */ -test_return_t init_test(void *object); -test_return_t allocation_test(void *object); -test_return_t clone_test(void *object); -test_return_t option_test(void *object); - -void *create(void *object); -void destroy(void *object); -test_return_t pre(void *object); -test_return_t post(void *object); -test_return_t flush(void); - -void *world_create(test_return_t *error); -test_return_t world_destroy(void *object); - -test_return_t init_test(void *object __attribute__((unused))) -{ - gearman_worker_st worker; - - if (gearman_worker_create(&worker) == NULL) - return TEST_FAILURE; - - gearman_worker_free(&worker); - - return TEST_SUCCESS; -} - -test_return_t allocation_test(void *object __attribute__((unused))) -{ - gearman_worker_st *worker; - - worker= gearman_worker_create(NULL); - if (worker == NULL) - return TEST_FAILURE; - - gearman_worker_free(worker); - - return TEST_SUCCESS; -} - -test_return_t clone_test(void *object) -{ - gearman_worker_st *from= (gearman_worker_st *)object; - gearman_worker_st *worker; - - worker= gearman_worker_clone(NULL, NULL); - - test_truth(worker); - test_truth(worker->options.allocated); - - gearman_worker_free(worker); - - worker= gearman_worker_clone(NULL, from); - if (worker == NULL) - return TEST_FAILURE; - - gearman_worker_free(worker); - - return TEST_SUCCESS; -} - -test_return_t option_test(void *object __attribute__((unused))) -{ - gearman_worker_st *gear; - gearman_worker_options_t default_options; - - gear= gearman_worker_create(NULL); - test_truth(gear); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - - /* Set up for default options */ - default_options= gearman_worker_options(gear); - - /* - We take the basic options, and push - them back in. See if we change anything. - */ - gearman_worker_set_options(gear, default_options); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - - /* - We will trying to modify non-mutable options (which should not be allowed) - */ - { - gearman_worker_remove_options(gear, GEARMAN_WORKER_ALLOCATED); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - gearman_worker_remove_options(gear, GEARMAN_WORKER_PACKET_INIT); - { // Initial Allocated, no changes - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - } - - /* - We will test modifying GEARMAN_WORKER_NON_BLOCKING in several manners. - */ - { - gearman_worker_remove_options(gear, GEARMAN_WORKER_NON_BLOCKING); - { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - gearman_worker_add_options(gear, GEARMAN_WORKER_NON_BLOCKING); - { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_truth(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - gearman_worker_set_options(gear, GEARMAN_WORKER_NON_BLOCKING); - { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_truth(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - gearman_worker_set_options(gear, GEARMAN_WORKER_GRAB_UNIQ); - { // Everything is now set to false except GEARMAN_WORKER_GRAB_UNIQ, and non-mutable options - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_truth(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - /* - Reset options to default. Then add an option, and then add more options. Make sure - the options are all additive. - */ - { - gearman_worker_set_options(gear, default_options); - { // See if we return to defaults - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - gearman_worker_add_options(gear, GEARMAN_WORKER_TIMEOUT_RETURN); - { // All defaults, except timeout_return - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_truth(gear->options.timeout_return); - } - gearman_worker_add_options(gear, GEARMAN_WORKER_NON_BLOCKING|GEARMAN_WORKER_GRAB_UNIQ); - { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_truth(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_truth(gear->options.grab_uniq); - test_truth(gear->options.timeout_return); - } - } - /* - Add an option, and then replace with that option plus a new option. - */ - { - gearman_worker_set_options(gear, default_options); - { // See if we return to defaults - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_false(gear->options.timeout_return); - } - gearman_worker_add_options(gear, GEARMAN_WORKER_TIMEOUT_RETURN); - { // All defaults, except timeout_return - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_false(gear->options.grab_uniq); - test_truth(gear->options.timeout_return); - } - gearman_worker_add_options(gear, GEARMAN_WORKER_TIMEOUT_RETURN|GEARMAN_WORKER_GRAB_UNIQ); - { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. - test_truth(gear->options.allocated); - test_false(gear->options.non_blocking); - test_truth(gear->options.packet_init); - test_false(gear->options.grab_job_in_use); - test_false(gear->options.pre_sleep_in_use); - test_false(gear->options.work_job_in_use); - test_false(gear->options.change); - test_truth(gear->options.grab_uniq); - test_truth(gear->options.timeout_return); - } - } - } - - gearman_worker_free(gear); - - return TEST_SUCCESS; -} - -static test_return_t echo_test(void *object) -{ - gearman_worker_st *worker= (gearman_worker_st *)object; - gearman_return_t rc; - size_t value_length; - const char *value= "This is my echo test"; - - value_length= strlen(value); - - rc= gearman_worker_echo(worker, value, value_length); - test_truth(rc == GEARMAN_SUCCESS); - - return TEST_SUCCESS; -} - -static test_return_t echo_multi_test(void *object) -{ - gearman_worker_st *worker= (gearman_worker_st *)object; - gearman_return_t rc; - const char *value[]= { - "This is my echo test", - "This land is my land", - "This land is your land", - "We the people", - "in order to form a more perfect union", - "establish justice", - NULL - }; - const char **ptr= value; - - while (*ptr) - { - rc= gearman_worker_echo(worker, value, strlen(*ptr)); - test_truth( rc == GEARMAN_SUCCESS); - ptr++; - } - - return TEST_SUCCESS; -} - -static test_return_t echo_max_test(void *object) -{ - gearman_worker_st *worker= (gearman_worker_st *)object; - gearman_return_t rc; - const char *value= "This is my echo test"; - - rc= gearman_worker_echo(worker, value, SIZE_MAX); - test_truth(rc == GEARMAN_ARGUMENT_TOO_LARGE); - - return TEST_SUCCESS; -} - -static test_return_t abandoned_worker_test(void *object __attribute__((unused))) -{ - gearman_client_st client; - char job_handle[GEARMAN_JOB_HANDLE_SIZE]; - gearman_return_t ret; - gearman_universal_st gearman; - gearman_connection_st worker1; - gearman_connection_st worker2; - gearman_packet_st packet; - const void *args[2]; - size_t args_size[2]; - - assert(gearman_client_create(&client) != NULL); - gearman_client_add_server(&client, NULL, WORKER_TEST_PORT); - ret= gearman_client_do_background(&client, "abandoned_worker", NULL, NULL, 0, - job_handle); - if (ret != GEARMAN_SUCCESS) - { - printf("abandoned_worker_test:%s\n", gearman_client_error(&client)); - return TEST_FAILURE; - } - gearman_client_free(&client); - - /* Now take job with one worker. */ - if (gearman_universal_create(&gearman, NULL) == NULL) - return TEST_FAILURE; - - if (gearman_connection_create(&gearman, &worker1, NULL) == NULL) - return TEST_FAILURE; - - gearman_connection_set_host(&worker1, NULL, WORKER_TEST_PORT); - - args[0]= "abandoned_worker"; - args_size[0]= strlen("abandoned_worker"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CAN_DO, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&worker1, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_GRAB_JOB, - NULL, NULL, 0) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&worker1, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - gearman_connection_recv(&worker1, &packet, &ret, false); - if (ret != GEARMAN_SUCCESS || packet.command != GEARMAN_COMMAND_JOB_ASSIGN) - return TEST_FAILURE; - - if (strcmp(job_handle, packet.arg[0])) - { - printf("unexpected job: %s != %s\n", job_handle, (char *)packet.arg[0]); - return TEST_FAILURE; - } - - gearman_packet_free(&packet); - - if (gearman_connection_create(&gearman, &worker2, NULL) == NULL) - return TEST_FAILURE; - - gearman_connection_set_host(&worker2, NULL, WORKER_TEST_PORT); - - args[0]= "abandoned_worker"; - args_size[0]= strlen("abandoned_worker"); - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_CAN_DO, - args, args_size, 1) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&worker2, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - args[0]= job_handle; - args_size[0]= strlen(job_handle) + 1; - args[1]= "test"; - args_size[1]= 4; - if (gearman_packet_create_args(&gearman, &packet, GEARMAN_MAGIC_REQUEST, - GEARMAN_COMMAND_WORK_COMPLETE, - args, args_size, 2) != GEARMAN_SUCCESS) - { - return TEST_FAILURE; - } - - if (gearman_connection_send(&worker2, &packet, true) != GEARMAN_SUCCESS) - return TEST_FAILURE; - - gearman_packet_free(&packet); - - gearman_universal_set_timeout(&gearman, 1000); - gearman_connection_recv(&worker2, &packet, &ret, false); - if (ret != GEARMAN_SUCCESS || packet.command != GEARMAN_COMMAND_ERROR) - return TEST_FAILURE; - - gearman_packet_free(&packet); - gearman_universal_free(&gearman); - - return TEST_SUCCESS; -} - -static void *_gearman_worker_add_function_worker_fn(gearman_job_st *job __attribute__((unused)), - void *context __attribute__((unused)), - size_t *result_size __attribute__((unused)), - gearman_return_t *ret_ptr __attribute__((unused))) -{ - (void)job; - (void)context; - *ret_ptr= GEARMAN_WORK_FAIL; - - return NULL; -} - -static test_return_t gearman_worker_add_function_test(void *object) -{ - bool found; - gearman_return_t rc; - gearman_worker_st *worker= (gearman_worker_st *)object; - const char *function_name= "_gearman_worker_add_function_worker_fn"; - - rc= gearman_worker_add_function(worker, - function_name, - 0, _gearman_worker_add_function_worker_fn, NULL); - test_truth(rc == GEARMAN_SUCCESS); - - found= gearman_worker_function_exist(worker, function_name, strlen(function_name)); - test_truth(found); - - rc= gearman_worker_unregister(worker, function_name); - test_truth(rc == GEARMAN_SUCCESS); - - found= gearman_worker_function_exist(worker, function_name, strlen(function_name)); - test_false(found); - - /* Make sure we have removed it */ - rc= gearman_worker_unregister(worker, function_name); - test_truth(rc == GEARMAN_NO_REGISTERED_FUNCTION); - - return TEST_SUCCESS; -} - -static test_return_t gearman_worker_add_function_multi_test(void *object) -{ - uint32_t x; - gearman_return_t rc; - gearman_worker_st *worker= (gearman_worker_st *)object; - const char *function_name_ext= "_gearman_worker_add_function_worker_fn"; - - for (x= 0; x < 100; x++) - { - char buffer[1024]; - snprintf(buffer, 1024, "%u%s", x, function_name_ext); - rc= gearman_worker_add_function(worker, - buffer, - 0, _gearman_worker_add_function_worker_fn, NULL); - - test_truth(rc == GEARMAN_SUCCESS); - } - - for (x= 0; x < 100; x++) - { - char buffer[1024]; - - snprintf(buffer, 1024, "%u%s", x, function_name_ext); - rc= gearman_worker_unregister(worker, buffer); - test_truth(rc == GEARMAN_SUCCESS); - } - - for (x= 0; x < 100; x++) - { - char buffer[1024]; - - snprintf(buffer, 1024, "%u%s", x, function_name_ext); - rc= gearman_worker_unregister(worker, buffer); - test_truth(rc == GEARMAN_NO_REGISTERED_FUNCTION); - } - - return TEST_SUCCESS; -} - -static test_return_t gearman_worker_unregister_all_test(void *object) -{ - uint32_t x; - gearman_return_t rc; - gearman_worker_st *worker= (gearman_worker_st *)object; - const char *function_name_ext= "_gearman_worker_add_function_worker_fn"; - - for (x= 0; x < 100; x++) - { - char buffer[1024]; - snprintf(buffer, 1024, "%u%s", x, function_name_ext); - rc= gearman_worker_add_function(worker, - buffer, - 0, _gearman_worker_add_function_worker_fn, NULL); - - test_truth(rc == GEARMAN_SUCCESS); - } - - rc= gearman_worker_unregister_all(worker); - - for (x= 0; x < 100; x++) - { - char buffer[1024]; - - snprintf(buffer, 1024, "%u%s", x, function_name_ext); - rc= gearman_worker_unregister(worker, buffer); - test_truth(rc == GEARMAN_NO_REGISTERED_FUNCTION); - } - - rc= gearman_worker_unregister_all(worker); - test_truth(rc == GEARMAN_NO_REGISTERED_FUNCTIONS); - - return TEST_SUCCESS; -} - -static test_return_t gearman_worker_work_with_test(void *object) -{ - gearman_return_t rc; - gearman_worker_st *worker= (gearman_worker_st *)object; - const char *function_name= "_gearman_worker_add_function_worker_fn"; - - rc= gearman_worker_add_function(worker, - function_name, - 0, _gearman_worker_add_function_worker_fn, NULL); - test_truth(rc == GEARMAN_SUCCESS); - - gearman_worker_set_timeout(worker, 2); - - rc= gearman_worker_work(worker); - test_truth(rc == GEARMAN_TIMEOUT); - - /* Make sure we have remove worker function */ - rc= gearman_worker_unregister(worker, function_name); - test_truth(rc == GEARMAN_SUCCESS); - - return TEST_SUCCESS; -} - -static test_return_t gearman_worker_context_test(void *object) -{ - gearman_worker_st *worker= (gearman_worker_st *)object; - int value= 5; - int *ptr; - - ptr= gearman_worker_context(worker); - test_truth(ptr == NULL); - - gearman_worker_set_context(worker, &value); - - ptr= (int *)gearman_worker_context(worker); - - test_truth(ptr == &value); - test_truth(*ptr == value); - - return TEST_SUCCESS; -} - -/*********************** World functions **************************************/ - -void *create(void *object __attribute__((unused))) -{ - worker_test_st *test= (worker_test_st *)object; - return (void *)&(test->worker); -} - -void *world_create(test_return_t *error) -{ - worker_test_st *test; - pid_t gearmand_pid; - - gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, NULL, NULL, 0); - - test= malloc(sizeof(worker_test_st)); - - if (! test) - { - *error= TEST_MEMORY_ALLOCATION_FAILURE; - return NULL; - } - - memset(test, 0, sizeof(worker_test_st)); - - test->gearmand_pid= gearmand_pid; - - if (gearman_worker_create(&(test->worker)) == NULL) - { - *error= TEST_FAILURE; - return NULL; - } - - if (gearman_worker_add_server(&(test->worker), NULL, WORKER_TEST_PORT) != GEARMAN_SUCCESS) - { - *error= TEST_FAILURE; - return NULL; - } - - *error= TEST_SUCCESS; - - return (void *)test; -} - -test_return_t world_destroy(void *object) -{ - worker_test_st *test= (worker_test_st *)object; - test_gearmand_stop(test->gearmand_pid); - gearman_worker_free(&(test->worker)); - free(test); - - return TEST_SUCCESS; -} - -test_st tests[] ={ - {"init", 0, init_test }, - {"allocation", 0, allocation_test }, - {"clone", 0, clone_test }, - {"echo", 0, echo_test }, - {"echo_multi", 0, echo_multi_test }, - {"options", 0, option_test }, - {"gearman_worker_add_function", 0, gearman_worker_add_function_test }, - {"gearman_worker_add_function_multi", 0, gearman_worker_add_function_multi_test }, - {"gearman_worker_unregister_all", 0, gearman_worker_unregister_all_test }, - {"gearman_worker_work with timout", 0, gearman_worker_work_with_test }, - {"gearman_worker_context", 0, gearman_worker_context_test }, - {"echo_max", 0, echo_max_test }, - {"abandoned_worker", 0, abandoned_worker_test }, - {0, 0, 0} -}; - -collection_st collection[] ={ - {"worker", 0, 0, tests}, - {0, 0, 0, 0} -}; - - -typedef test_return_t (*libgearman_test_callback_fn)(gearman_worker_st *); -static test_return_t _runner_default(libgearman_test_callback_fn func, worker_test_st *container) -{ - gearman_worker_st *worker= &container->worker; - - if (func) - { - (void)gearman_worker_unregister_all(worker); - return func(worker); - } - else - { - return TEST_SUCCESS; - } -} - - -static world_runner_st runner= { - (test_callback_runner_fn)_runner_default, - (test_callback_runner_fn)_runner_default, - (test_callback_runner_fn)_runner_default -}; - -void get_world(world_st *world) -{ - world->collections= collection; - world->create= world_create; - world->destroy= world_destroy; - world->runner= &runner; -} diff -Nru gearmand-0.14/tests/worker_test.cc gearmand-0.23/tests/worker_test.cc --- gearmand-0.14/tests/worker_test.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/tests/worker_test.cc 2011-06-29 22:18:02.000000000 +0200 @@ -0,0 +1,848 @@ +/* Gearman server and library + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include "libgearman/packet.hpp" +#include "libgearman/universal.hpp" + +#include + +#include + +struct worker_test_st +{ + pid_t gearmand_pid; + gearman_worker_st *_worker; + + gearman_worker_st *worker() + { + return _worker; + } + + worker_test_st() : + gearmand_pid(-1) + { + _worker= gearman_worker_create(NULL); + } + + ~worker_test_st() + { + gearman_worker_free(_worker); + } +}; + +static test_return_t init_test(void *) +{ + gearman_worker_st worker; + + test_truth(gearman_worker_create(&worker)); + + gearman_worker_free(&worker); + + return TEST_SUCCESS; +} + +static test_return_t allocation_test(void *) +{ + gearman_worker_st *worker; + + test_truth(worker= gearman_worker_create(NULL)); + + gearman_worker_free(worker); + + return TEST_SUCCESS; +} + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +static test_return_t clone_test(void *object) +{ + gearman_worker_st *from= (gearman_worker_st *)object; + gearman_worker_st *worker; + + test_truth(worker= gearman_worker_clone(NULL, NULL)); + + test_truth(worker->options.allocated); + + gearman_worker_free(worker); + + test_truth(worker= gearman_worker_clone(NULL, from)); + + gearman_worker_free(worker); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_timeout_default_test(void *) +{ + gearman_worker_st *worker= gearman_worker_create(NULL); + test_true(worker); + + test_compare(-1, gearman_worker_timeout(worker)); + gearman_worker_free(worker); + + return TEST_SUCCESS; +} + +static test_return_t option_test(void *) +{ + gearman_worker_st *gear; + gearman_worker_options_t default_options; + + gear= gearman_worker_create(NULL); + test_truth(gear); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + + /* Set up for default options */ + default_options= gearman_worker_options(gear); + + /* + We take the basic options, and push + them back in. See if we change anything. + */ + gearman_worker_set_options(gear, default_options); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + + /* + We will trying to modify non-mutable options (which should not be allowed) + */ + { + gearman_worker_remove_options(gear, GEARMAN_WORKER_ALLOCATED); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + + gearman_worker_remove_options(gear, GEARMAN_WORKER_PACKET_INIT); + { // Initial Allocated, no changes + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + } + + /* + We will test modifying GEARMAN_WORKER_NON_BLOCKING in several manners. + */ + { + gearman_worker_remove_options(gear, GEARMAN_WORKER_NON_BLOCKING); + { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + gearman_worker_add_options(gear, GEARMAN_WORKER_NON_BLOCKING); + { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_truth(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + gearman_worker_set_options(gear, GEARMAN_WORKER_NON_BLOCKING); + { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_truth(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_false(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + gearman_worker_set_options(gear, GEARMAN_WORKER_GRAB_UNIQ); + { // Everything is now set to false except GEARMAN_WORKER_GRAB_UNIQ, and non-mutable options + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_truth(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + /* + Reset options to default. Then add an option, and then add more options. Make sure + the options are all additive. + */ + { + gearman_worker_set_options(gear, default_options); + { // See if we return to defaults + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + gearman_worker_add_options(gear, GEARMAN_WORKER_TIMEOUT_RETURN); + { // All defaults, except timeout_return + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_truth(gear->options.timeout_return); + } + gearman_worker_add_options(gear, (gearman_worker_options_t)(GEARMAN_WORKER_NON_BLOCKING|GEARMAN_WORKER_GRAB_UNIQ)); + { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_truth(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_truth(gear->options.grab_uniq); + test_truth(gear->options.timeout_return); + } + } + /* + Add an option, and then replace with that option plus a new option. + */ + { + gearman_worker_set_options(gear, default_options); + { // See if we return to defaults + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_false(gear->options.timeout_return); + } + gearman_worker_add_options(gear, GEARMAN_WORKER_TIMEOUT_RETURN); + { // All defaults, except timeout_return + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_true(gear->options.grab_uniq); + test_truth(gear->options.timeout_return); + } + gearman_worker_add_options(gear, (gearman_worker_options_t)(GEARMAN_WORKER_TIMEOUT_RETURN|GEARMAN_WORKER_GRAB_UNIQ)); + { // GEARMAN_WORKER_NON_BLOCKING set to default, by default. + test_truth(gear->options.allocated); + test_false(gear->options.non_blocking); + test_truth(gear->options.packet_init); + test_false(gear->options.change); + test_truth(gear->options.grab_uniq); + test_truth(gear->options.timeout_return); + } + } + } + + gearman_worker_free(gear); + + return TEST_SUCCESS; +} + +static test_return_t echo_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + assert(worker); + + test_true_got(gearman_success(gearman_worker_echo(worker, gearman_literal_param("This is my echo test"))), gearman_worker_error(worker)); + + return TEST_SUCCESS; +} + +static test_return_t echo_multi_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + assert(worker); + const char *value[]= { + "This is my echo test", + "This land is my land", + "This land is your land", + "We the people", + "in order to form a more perfect union", + "establish justice", + NULL + }; + const char **ptr= value; + + while (*ptr) + { + test_true_got(gearman_success(gearman_worker_echo(worker, gearman_c_str_param(*ptr))), gearman_worker_error(worker)); + ptr++; + } + + return TEST_SUCCESS; +} + +static test_return_t echo_max_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + assert(worker); + + test_compare(GEARMAN_ARGUMENT_TOO_LARGE, gearman_worker_echo(worker, "This is my echo test", SIZE_MAX)); + + return TEST_SUCCESS; +} + +static test_return_t abandoned_worker_test(void *) +{ + gearman_job_handle_t job_handle; + const void *args[2]; + size_t args_size[2]; + + { + gearman_client_st *client= gearman_client_create(NULL); + test_truth(client); + gearman_client_add_server(client, NULL, WORKER_TEST_PORT); + test_true_got(gearman_success(gearman_client_do_background(client, "abandoned_worker", NULL, NULL, 0, job_handle)), gearman_client_error(client)); + gearman_client_free(client); + } + + /* Now take job with one worker. */ + gearman_universal_st universal; + gearman_universal_initialize(universal); + + gearman_connection_st *worker1; + test_truth(worker1= gearman_connection_create(universal, NULL)); + + worker1->set_host(NULL, WORKER_TEST_PORT); + + gearman_packet_st packet; + args[0]= "abandoned_worker"; + args_size[0]= strlen("abandoned_worker"); + test_truth(gearman_success(gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_CAN_DO, + args, args_size, 1))); + + test_true_got(gearman_success(worker1->send(packet, true)), gearman_universal_error(universal)); + + gearman_packet_free(&packet); + + gearman_return_t ret; + test_true_got(gearman_success(ret= gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_GRAB_JOB, + NULL, NULL, 0)), gearman_strerror(ret)); + + test_true_got(gearman_success(ret= worker1->send(packet, true)), gearman_strerror(ret)); + + gearman_packet_free(&packet); + + worker1->receiving(packet, ret, false); + test_truth(not (ret != GEARMAN_SUCCESS || packet.command != GEARMAN_COMMAND_JOB_ASSIGN)); + + test_strcmp(job_handle, packet.arg[0]); // unexepcted job + + gearman_packet_free(&packet); + + gearman_connection_st *worker2; + test_truth(worker2= gearman_connection_create(universal, NULL)); + + worker2->set_host(NULL, WORKER_TEST_PORT); + + args[0]= "abandoned_worker"; + args_size[0]= strlen("abandoned_worker"); + test_true_got(gearman_success(ret= gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_CAN_DO, + args, args_size, 1)), gearman_strerror(ret)); + + test_true_got(gearman_success(ret= worker2->send(packet, true)), gearman_strerror(ret)); + + gearman_packet_free(&packet); + + args[0]= job_handle; + args_size[0]= strlen(job_handle) + 1; + args[1]= "test"; + args_size[1]= 4; + test_true_got(gearman_success(ret= gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, + GEARMAN_COMMAND_WORK_COMPLETE, + args, args_size, 2)), gearman_strerror(ret)); + + test_true_got(gearman_success(ret= worker2->send(packet, true)), gearman_strerror(ret)); + + gearman_packet_free(&packet); + + gearman_universal_set_timeout(universal, 1000); + worker2->receiving(packet, ret, false); + test_truth(not (ret != GEARMAN_SUCCESS or packet.command != GEARMAN_COMMAND_ERROR)); + + delete worker1; + delete worker2; + gearman_packet_free(&packet); + gearman_universal_free(universal); + + return TEST_SUCCESS; +} + +static void *no_unique_worker(gearman_job_st *job, + void *, size_t *size, + gearman_return_t *ret_ptr) +{ + if (gearman_job_unique(job) and strlen(gearman_job_unique(job))) + { + *ret_ptr= GEARMAN_WORK_FAIL; + } + else + { + *ret_ptr= GEARMAN_SUCCESS; + } + *size= 0; + + return NULL; +} + +static void *check_unique_worker(gearman_job_st *job, + void *context, size_t *size, + gearman_return_t *ret_ptr) +{ + if (gearman_job_unique(job)) + { + size_t length= strlen(gearman_job_unique(job)); + if (length == gearman_job_workload_size(job)) + { + if (not memcmp(gearman_job_unique(job), gearman_job_workload(job),length)) + { + bool *success= (bool *)context; + if (success) + *success= true; + + *ret_ptr= GEARMAN_SUCCESS; + *size= length; + return strdup((char*)gearman_job_unique(job)); + } + } + } + + *size= 0; + *ret_ptr= GEARMAN_WORK_FAIL; + + return NULL; +} + +static void *fail_worker(gearman_job_st *, + void *, size_t *size, + gearman_return_t *ret_ptr) +{ + *ret_ptr= GEARMAN_WORK_FAIL; + *size= 0; + + return NULL; +} + +static test_return_t gearman_worker_add_function_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + const char *function_name= "fail_worker"; + + test_true_got(gearman_success(gearman_worker_add_function(worker, function_name,0, fail_worker, NULL)), gearman_worker_error(worker)); + + test_truth(gearman_worker_function_exist(worker, gearman_c_str_param(function_name))); + + test_true_got(gearman_success(gearman_worker_unregister(worker, function_name)), gearman_worker_error(worker)); + + bool found= gearman_worker_function_exist(worker, function_name, strlen(function_name)); + test_false(found); + + /* Make sure we have removed it */ + test_true_got(GEARMAN_NO_REGISTERED_FUNCTION == gearman_worker_unregister(worker, function_name), gearman_worker_error(worker)); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_add_function_multi_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + const char *function_name_ext= "fail_worker"; + + for (uint32_t x= 0; x < 100; x++) + { + char buffer[1024]; + snprintf(buffer, 1024, "%u%s", x, function_name_ext); + + test_true_got(gearman_success(gearman_worker_add_function(worker, buffer, 0, fail_worker, NULL)), gearman_worker_error(worker)); + } + + for (uint32_t x= 0; x < 100; x++) + { + char buffer[1024]; + + snprintf(buffer, 1024, "%u%s", x, function_name_ext); + test_true_got(gearman_success(gearman_worker_unregister(worker, buffer)), gearman_worker_error(worker)); + } + + for (uint32_t x= 0; x < 100; x++) + { + char buffer[1024]; + + snprintf(buffer, 1024, "%u%s", x, function_name_ext); + test_true_got(GEARMAN_NO_REGISTERED_FUNCTION == gearman_worker_unregister(worker, buffer), gearman_worker_error(worker)); + } + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_unregister_all_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + const char *function_name_ext= "fail_worker"; + + for (uint32_t x= 0; x < 100; x++) + { + char buffer[1024]; + snprintf(buffer, sizeof(buffer), "%u%s", x, function_name_ext); + gearman_return_t rc= gearman_worker_add_function(worker, + buffer, + 0, fail_worker, NULL); + + test_true_got(gearman_success(rc), gearman_strerror(rc)); + } + + test_truth(gearman_success(gearman_worker_unregister_all(worker))); + + for (uint32_t x= 0; x < 100; x++) + { + char buffer[1024]; + + snprintf(buffer, sizeof(buffer), "%u%s", x, function_name_ext); + gearman_return_t rc= gearman_worker_unregister(worker, buffer); + test_true_got(rc == GEARMAN_NO_REGISTERED_FUNCTION, gearman_strerror(rc)); + } + + test_true_got(GEARMAN_NO_REGISTERED_FUNCTIONS == gearman_worker_unregister_all(worker), gearman_worker_error(worker)); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_work_with_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + const char *function_name= "fail_worker"; + + gearman_return_t rc; + rc= gearman_worker_add_function(worker, + function_name, + 0, fail_worker, NULL); + test_true_got(rc == GEARMAN_SUCCESS, gearman_strerror(rc)); + + gearman_worker_set_timeout(worker, 0); + + rc= gearman_worker_work(worker); + test_compare(GEARMAN_TIMEOUT, rc); + + rc= gearman_worker_work(worker); + test_compare_got(GEARMAN_TIMEOUT, rc, gearman_strerror(rc)); + + /* Make sure we have remove worker function */ + rc= gearman_worker_unregister(worker, function_name); + test_true_got(rc == GEARMAN_SUCCESS, gearman_strerror(rc)); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_context_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + test_truth(worker); + + test_false(gearman_worker_context(worker)); + + int value= 5; + gearman_worker_set_context(worker, &value); + + int *ptr= (int *)gearman_worker_context(worker); + + test_truth(ptr == &value); + test_truth(*ptr == value); + gearman_worker_set_context(worker, NULL); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_remove_options_GEARMAN_WORKER_GRAB_UNIQ(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + + const char *function_name= "_test_worker"; + const char *unique_name= "fooman"; + gearman_return_t rc; + test_true_got(gearman_success(rc= gearman_worker_add_function(worker, + function_name, + 0, + no_unique_worker, NULL)), gearman_strerror(rc)); + + { + gearman_client_st *client; + test_truth(client= gearman_client_create(NULL)); + gearman_client_add_server(client, NULL, WORKER_TEST_PORT); + test_true_got(gearman_success(gearman_client_do_background(client, function_name, unique_name, gearman_c_str_param(unique_name), NULL)), gearman_client_error(client)); + gearman_client_free(client); + } + + test_true(worker->options.grab_uniq); + gearman_worker_add_options(worker, GEARMAN_WORKER_GRAB_UNIQ); + test_truth(worker->options.grab_uniq); + + gearman_worker_remove_options(worker, GEARMAN_WORKER_GRAB_UNIQ); + test_false(worker->options.grab_uniq); + + gearman_job_st *job= gearman_worker_grab_job(worker, NULL, &rc); + test_true_got(gearman_success(rc), gearman_strerror(rc)); + test_truth(job); + size_t size= 0; + void *result= no_unique_worker(job, NULL, &size, &rc); + test_true_got(gearman_success(rc), gearman_strerror(rc)); + test_false(result); + test_false(size); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_add_options_GEARMAN_WORKER_GRAB_UNIQ(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + + const char *function_name= "_test_worker"; + const char *unique_name= "fooman"; + gearman_return_t rc; + test_true_got(gearman_success(rc= gearman_worker_add_function(worker, + function_name, + 0, + check_unique_worker, NULL)), gearman_strerror(rc)); + + { + gearman_client_st *client; + test_truth(client= gearman_client_create(NULL)); + gearman_client_add_server(client, NULL, WORKER_TEST_PORT); + test_compare_got(GEARMAN_SUCCESS, + gearman_client_do_background(client, function_name, unique_name, gearman_c_str_param(unique_name), NULL), + gearman_client_error(client)); + gearman_client_free(client); + } + + test_true(worker->options.grab_uniq); + gearman_job_st *job= gearman_worker_grab_job(worker, NULL, &rc); + test_true_got(gearman_success(rc), gearman_strerror(rc)); + test_truth(job); + size_t size= 0; + void *result= check_unique_worker(job, NULL, &size, &rc); + test_true_got(gearman_success(rc), gearman_strerror(rc)); + test_truth(result); + test_truth(size); + free(result); + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_add_options_GEARMAN_WORKER_GRAB_UNIQ_worker_work(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + + const char *function_name= "_test_worker"; + const char *unique_name= "fooman"; + gearman_return_t rc; + bool success= false; + test_true_got(gearman_success(rc= gearman_worker_add_function(worker, + function_name, + 0, + check_unique_worker, &success)), gearman_strerror(rc)); + + { + gearman_client_st *client; + test_truth(client= gearman_client_create(NULL)); + gearman_client_add_server(client, NULL, WORKER_TEST_PORT); + test_true_got(gearman_success(gearman_client_do_background(client, function_name, unique_name, gearman_c_str_param(unique_name), NULL)), gearman_client_error(client)); + gearman_client_free(client); + } + + test_true(worker->options.grab_uniq); + gearman_worker_add_options(worker, GEARMAN_WORKER_GRAB_UNIQ); + test_truth(worker->options.grab_uniq); + + test_true_got(gearman_success(rc= gearman_worker_work(worker)), gearman_strerror(rc)); + + test_truth(success); + + + return TEST_SUCCESS; +} + +static test_return_t gearman_worker_failover_test(void *object) +{ + gearman_worker_st *worker= (gearman_worker_st *)object; + + gearman_return_t rc; + test_true_got(gearman_success(rc= gearman_worker_add_server(worker, NULL, WORKER_TEST_PORT)), gearman_strerror(rc)); + test_true_got(gearman_success(rc= gearman_worker_add_server(worker, NULL, WORKER_TEST_PORT +1)), gearman_strerror(rc)); + + const char *function_name= "fail_worker"; + test_true_got(gearman_success(rc= gearman_worker_add_function(worker, + function_name, + 0, fail_worker, NULL)), gearman_strerror(rc)); + + gearman_worker_set_timeout(worker, 2); + + test_compare_got(GEARMAN_TIMEOUT, gearman_worker_work(worker), gearman_strerror(rc)); + + /* Make sure we have remove worker function */ + test_compare(GEARMAN_SUCCESS, + gearman_worker_unregister(worker, function_name)); + + return TEST_SUCCESS; +} + +/*********************** World functions **************************************/ + +static void *world_create(test_return_t *error) +{ + pid_t gearmand_pid; + + gearmand_pid= test_gearmand_start(WORKER_TEST_PORT, 0, NULL); + if (gearmand_pid == -1) + { + *error= TEST_FAILURE; + return NULL; + } + + worker_test_st *test= new worker_test_st; + if (not test) + { + *error= TEST_MEMORY_ALLOCATION_FAILURE; + return NULL; + } + + test->gearmand_pid= gearmand_pid; + + if (gearman_worker_add_server(test->worker(), NULL, WORKER_TEST_PORT) != GEARMAN_SUCCESS) + { + *error= TEST_FAILURE; + return NULL; + } + + *error= TEST_SUCCESS; + + return (void *)test; +} + +static test_return_t world_destroy(void *object) +{ + worker_test_st *test= (worker_test_st *)object; + + test_gearmand_stop(test->gearmand_pid); + + delete test; + + return TEST_SUCCESS; +} + +test_st tests[] ={ + {"init", 0, init_test }, + {"allocation", 0, allocation_test }, + {"clone", 0, clone_test }, + {"echo", 0, echo_test }, + {"echo_multi", 0, echo_multi_test }, + {"options", 0, option_test }, + {"gearman_worker_add_function()", 0, gearman_worker_add_function_test }, + {"gearman_worker_add_function() multi", 0, gearman_worker_add_function_multi_test }, + {"gearman_worker_unregister_all()", 0, gearman_worker_unregister_all_test }, + {"gearman_worker_work() with timout", 0, gearman_worker_work_with_test }, + {"gearman_worker_context", 0, gearman_worker_context_test }, + {"gearman_worker_failover", 0, gearman_worker_failover_test }, + {"gearman_worker_remove_options(GEARMAN_WORKER_GRAB_UNIQ)", 0, gearman_worker_remove_options_GEARMAN_WORKER_GRAB_UNIQ }, + {"gearman_worker_add_options(GEARMAN_WORKER_GRAB_UNIQ)", 0, gearman_worker_add_options_GEARMAN_WORKER_GRAB_UNIQ }, + {"gearman_worker_add_options(GEARMAN_WORKER_GRAB_UNIQ) worker_work()", 0, gearman_worker_add_options_GEARMAN_WORKER_GRAB_UNIQ_worker_work }, + {"echo_max", 0, echo_max_test }, + {"abandoned_worker", 0, abandoned_worker_test }, + {0, 0, 0} +}; + +test_st worker_defaults[] ={ + {"gearman_worker_timeout()", 0, gearman_worker_timeout_default_test }, + {0, 0, 0} +}; + +collection_st collection[] ={ + {"worker", 0, 0, tests}, + {"worker defaults", 0, 0, worker_defaults}, + {0, 0, 0, 0} +}; + + +typedef test_return_t (*libgearman_test_prepost_callback_fn)(worker_test_st *); +typedef test_return_t (*libgearman_test_callback_fn)(gearman_worker_st *); +static test_return_t _runner_prepost_default(libgearman_test_prepost_callback_fn func, worker_test_st *container) +{ + if (func) + { + return func(container); + } + + return TEST_SUCCESS; +} + +static test_return_t _runner_default(libgearman_test_callback_fn func, worker_test_st *container) +{ + if (func) + { + test_return_t rc; + + if (container->worker()) + { + gearman_worker_st *worker= gearman_worker_clone(NULL, container->worker()); + test_truth(worker); + rc= func(worker); + gearman_worker_free(worker); + } + else + { + rc= func(container->worker()); + } + + return rc; + } + + return TEST_SUCCESS; +} + + +static Runner runner= { + (test_callback_runner_fn*)_runner_prepost_default, + (test_callback_runner_fn*)_runner_default, + (test_callback_runner_fn*)_runner_prepost_default +}; + +void get_world(Framework *world) +{ + world->collections= collection; + world->_create= world_create; + world->_destroy= world_destroy; + world->runner= &runner; +} diff -Nru gearmand-0.14/THANKS gearmand-0.23/THANKS --- gearmand-0.14/THANKS 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/THANKS 2011-06-20 05:31:42.000000000 +0200 @@ -0,0 +1 @@ +John Ewart, john@johnewart.net -- Epoch support diff -Nru gearmand-0.14/unittests/include.am gearmand-0.23/unittests/include.am --- gearmand-0.14/unittests/include.am 2010-06-30 20:30:58.000000000 +0200 +++ gearmand-0.23/unittests/include.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -# vim:ft=automake -# included from Top Level Makefile.am -# All paths should be given relative to the root - - -if HAVE_LIBGTEST -check_PROGRAMS += unittests/unittests -endif - -unittests_unittests_SOURCES= \ - unittests/main.cc - -unittests_unittests_CXXFLAGS= ${AM_CXXFLAGS} ${NO_WERROR} -unittests_unittests_LDADD= \ - libgearman/libgearman.la \ - libgearman-server/libgearman-server.la \ - ${LTLIBGTEST} - -# Shorthand -unit: check-TESTS - diff -Nru gearmand-0.14/unittests/main.cc gearmand-0.23/unittests/main.cc --- gearmand-0.14/unittests/main.cc 2010-06-30 20:30:58.000000000 +0200 +++ gearmand-0.23/unittests/main.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * - * Copyright (C) 2010 Monty Taylor - * - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - */ - -#include "config.h" - -#include - - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff -Nru gearmand-0.14/util/daemon.cc gearmand-0.23/util/daemon.cc --- gearmand-0.14/util/daemon.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/daemon.cc 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,181 @@ +/* $Header: /cvsroot/wikipedia/willow/src/bin/willow/daemon.c,v 1.1 2005/05/02 19:15:21 kateturner Exp $ */ +/* $NetBSD: daemon.c,v 1.9 2003/08/07 16:42:46 agc Exp $ */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 2010 + * Stewart Smith + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#if defined __SUNPRO_C || defined __DECC || defined __HP_cc +# pragma ident "@(#)$Header: /cvsroot/wikipedia/willow/src/bin/willow/daemon.c,v 1.1 2005/05/02 19:15:21 kateturner Exp $" +# pragma ident "$NetBSD: daemon.c,v 1.9 2003/08/07 16:42:46 agc Exp $" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace gearmand +{ + +pid_t parent_pid; + +extern "C" +{ + +static void sigusr1_handler(int sig) +{ + if (sig == SIGUSR1) + { + _exit(EXIT_SUCCESS); + } +} + +} + +bool daemon_is_ready(bool close_io) +{ + kill(parent_pid, SIGUSR1); + + if (not close_io) + return true;; + + int fd; + if ((fd = open("/dev/null", O_RDWR, 0)) < 0) + { + perror("open"); + return false; + } + else + { + if(dup2(fd, STDIN_FILENO) < 0) + { + perror("dup2 stdin"); + return false; + } + + if(dup2(fd, STDOUT_FILENO) < 0) + { + perror("dup2 stdout"); + return false; + } + + if(dup2(fd, STDERR_FILENO) < 0) + { + perror("dup2 stderr"); + return false; + } + + if (fd > STDERR_FILENO) + { + if (close(fd) < 0) + { + perror("close"); + return false; + } + } + } + + return true; +} + +#ifndef __INTEL_COMPILER +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +bool daemonize(bool is_chdir, bool wait_sigusr1) +{ + pid_t child= -1; + + parent_pid= getpid(); + signal(SIGUSR1, sigusr1_handler); + + child= fork(); + + switch (child) + { + case -1: + return false; + + case 0: + break; + + default: + if (wait_sigusr1) + { + /* parent */ + int exit_code= EXIT_FAILURE; + int status; + while (waitpid(child, &status, 0) != child) + { } + + if (WIFEXITED(status)) + { + exit_code= WEXITSTATUS(status); + } + if (WIFSIGNALED(status)) + { + exit_code= EXIT_FAILURE; + } + _exit(exit_code); + } + else + { + _exit(EXIT_SUCCESS); + } + } + + /* child */ + if (setsid() == -1) + { + perror("setsid"); + return false; + } + + if (is_chdir) + { + if (chdir("/") < 0) + { + perror("chdir"); + return false; + } + } + + return true; +} + +} /* namespace drizzled */ diff -Nru gearmand-0.14/util/daemon.h gearmand-0.23/util/daemon.h --- gearmand-0.14/util/daemon.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/daemon.h 2011-03-03 08:43:32.000000000 +0100 @@ -0,0 +1,42 @@ +/* $Header: /cvsroot/wikipedia/willow/src/bin/willow/daemon.c,v 1.1 2005/05/02 19:15:21 kateturner Exp $ */ +/* $NetBSD: daemon.c,v 1.9 2003/08/07 16:42:46 agc Exp $ */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 2010 + * Stewart Smith + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#pragma once + +namespace gearmand +{ + +bool daemon_is_ready(bool close_io); +bool daemonize(bool is_chdir= true, bool wait_sigusr1= true); + +} diff -Nru gearmand-0.14/util/error.cc gearmand-0.23/util/error.cc --- gearmand-0.14/util/error.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/error.cc 2011-03-10 22:10:26.000000000 +0100 @@ -0,0 +1,93 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include + +#include +#include + +namespace gearman_util +{ + +namespace error { + +void perror(const char *message) +{ + char *errmsg_ptr; + char errmsg[BUFSIZ]; + errmsg[0]= 0; + +#ifdef STRERROR_R_CHAR_P + errmsg_ptr= strerror_r(errno, errmsg, sizeof(errmsg)); +#else + strerror_r(errno, errmsg, sizeof(errmsg)); + errmsg_ptr= errmsg; +#endif + std::cerr << "gearman: " << message << " (" << errmsg_ptr << ")" << std::endl; +} + +void message(const char *arg) +{ + std::cerr << "gearman: " << arg << std::endl; +} + +void message(const char *arg, const char *arg2) +{ + std::cerr << "gearman: " << arg << " : " << arg2 << std::endl; +} + +void message(const std::string &arg, gearman_return_t rc) +{ + std::cerr << "gearman: " << arg << " : " << gearman_strerror(rc) << std::endl; +} + +void message(const char *arg, const gearman_client_st &client) +{ + std::cerr << "gearman: " << arg << " : " << gearman_client_error(&client) << std::endl; +} + +void message(const char *arg, const gearman_worker_st &worker) +{ + std::cerr << "gearman: " << arg << " : " << gearman_worker_error(&worker) << std::endl; +} + +} // namespace error + +} // namespace gearman_util diff -Nru gearmand-0.14/util/error.h gearmand-0.23/util/error.h --- gearmand-0.14/util/error.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/error.h 2011-03-10 22:10:26.000000000 +0100 @@ -0,0 +1,63 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2008 Brian Aker, Eric Day + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +#include + +struct gearman_client_st; +struct gearman_worker_st; + +namespace gearman_util +{ + +namespace error { + +void perror(const char *); +void message(const char *); +void message(const std::string &arg, gearman_return_t rc); +void message(const char *arg, const char *arg2); +void message(const char *arg, const gearman_client_st &); +void message(const char *arg, const gearman_worker_st &); + +} // namespace error + + + +} // namespace gearman_util diff -Nru gearmand-0.14/util/include.am gearmand-0.23/util/include.am --- gearmand-0.14/util/include.am 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/include.am 2011-03-27 01:23:59.000000000 +0100 @@ -0,0 +1,18 @@ +# vim:ft=automake +# Gearman server and library +# Copyright (C) 2011 Data Differential +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# Included from Top Level Makefile.am +# All paths should be given relative to the root + + +noinst_HEADERS+= \ + util/daemon.h \ + util/error.h \ + util/instance.h \ + util/operation.h \ + util/pidfile.h diff -Nru gearmand-0.14/util/instance.cc gearmand-0.23/util/instance.cc --- gearmand-0.14/util/instance.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/instance.cc 2011-04-13 22:45:31.000000000 +0200 @@ -0,0 +1,247 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "config.h" + +#include "util/instance.h" + +#include +#include +#include +#include +#include +#include + + +namespace gearman_util { + +bool Instance::run() +{ + while (not _operations.empty()) + { + Operation::vector::value_type operation= _operations.back(); + + switch (state) + { + case NOT_WRITING: + { + free_addrinfo(); + + struct addrinfo ai; + memset(&ai, 0, sizeof(struct addrinfo)); + ai.ai_socktype= SOCK_STREAM; + ai.ai_protocol= IPPROTO_TCP; + + int ret= getaddrinfo(_host.c_str(), _port.c_str(), &ai, &_addrinfo); + if (ret) + { + std::cerr << "Failed to connect on " << _host.c_str() << ":" << _port.c_str() << " with " << gai_strerror(ret) << std::endl; + return false; + } + } + _addrinfo_next= _addrinfo; + state= CONNECT; + break; + + case NEXT_CONNECT_ADDRINFO: + if (_addrinfo_next->ai_next == NULL) + { + std::cerr << "Error connecting to " << _host.c_str() << "." << std::endl; + return false; + } + _addrinfo_next= _addrinfo_next->ai_next; + + + case CONNECT: + close_socket(); + + _sockfd= socket(_addrinfo_next->ai_family, + _addrinfo_next->ai_socktype, + _addrinfo_next->ai_protocol); + if (_sockfd == INVALID_SOCKET) + { + perror("socket"); + continue; + } + + if (connect(_sockfd, _addrinfo_next->ai_addr, _addrinfo_next->ai_addrlen) < 0) + { + switch(errno) + { + case EAGAIN: + case EINTR: + state= CONNECT; + break; + case EINPROGRESS: + state= CONNECTING; + break; + case ECONNREFUSED: + case ENETUNREACH: + case ETIMEDOUT: + default: + state= NEXT_CONNECT_ADDRINFO; + break; + } + } + else + { + state= CONNECTING; + } + break; + + case CONNECTING: + // Add logic for poll() for nonblocking. + state= CONNECTED; + break; + + case CONNECTED: + case WRITING: + { + size_t packet_length= operation->size(); + const char *packet= operation->ptr(); + + while(packet_length) + { + ssize_t write_size= send(_sockfd, packet, packet_length, 0); + + if (write_size < 0) + { + switch(errno) + { + default: + std::cerr << "Failed during send(" << strerror(errno) << ")" << std::endl; + break; + } + } + + packet_length-= static_cast(write_size); + packet+= static_cast(write_size); + } + } + state= READING; + break; + + case READING: + if (operation->has_response()) + { + size_t total_read; + ssize_t read_length; + + do + { + char buffer[1024]; + read_length= recv(_sockfd, buffer, sizeof(buffer), 0); + + if (read_length < 0) + { + switch(errno) + { + default: + std::cerr << "Error occured while reading data from " << _host.c_str() << std::endl; + return false; + } + } + + operation->push(buffer, static_cast(read_length)); + total_read+= static_cast(read_length); + } while (more_to_read()); + } // end has_response + + state= FINISHED; + break; + + case FINISHED: + operation->print(); + + if (operation->reconnect()) + { + } + _operations.pop_back(); + delete operation; + + state= CONNECTED; + break; + } // end switch + } + + return true; +} // end run() + +bool Instance::more_to_read() const +{ + struct pollfd fds; + fds.fd= _sockfd; + fds.events = POLLIN; + + if (poll(&fds, 1, 5) < 1) // Default timeout is 5 + { + return false; + } + + return true; +} + +void Instance::close_socket() +{ + if (_sockfd == INVALID_SOCKET) + return; + + /* in case of death shutdown to avoid blocking at close() */ + if (shutdown(_sockfd, SHUT_RDWR) == SOCKET_ERROR && get_socket_errno() != ENOTCONN) + { + perror("shutdown"); + } + else if (closesocket(_sockfd) == SOCKET_ERROR) + { + perror("close"); + } + + _sockfd= INVALID_SOCKET; +} + +void Instance::free_addrinfo() +{ + if (not _addrinfo) + return; + + freeaddrinfo(_addrinfo); + _addrinfo= NULL; + _addrinfo_next= NULL; +} + +} // namespace gearman_util diff -Nru gearmand-0.14/util/instance.h gearmand-0.23/util/instance.h --- gearmand-0.14/util/instance.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/instance.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,114 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#include +#include + +#include "util/operation.h" +#include + +struct addrinfo; + +namespace gearman_util { + +class Instance +{ + enum connection_state_t { + NOT_WRITING, + NEXT_CONNECT_ADDRINFO, + CONNECT, + CONNECTING, + CONNECTED, + WRITING, + READING, + FINISHED + }; + +public: + Instance() : + _host("localhost"), + _port(GEARMAN_DEFAULT_TCP_PORT_STRING), + _sockfd(INVALID_SOCKET), + state(NOT_WRITING), + _addrinfo(0), + _addrinfo_next(0), + _operations() + { + } + + ~Instance() + { + close_socket(); + free_addrinfo(); + } + + void set_host(const std::string &host) + { + _host= host; + } + + void set_port(const std::string &port) + { + _port= port; + } + + bool run(); + + void push(Operation *next) + { + _operations.push_back(next); + } + +private: + void close_socket(); + + void free_addrinfo(); + + bool more_to_read() const; + + std::string _host; + std::string _port; + int _sockfd; + connection_state_t state; + struct addrinfo *_addrinfo; + struct addrinfo *_addrinfo_next; + Operation::vector _operations; +}; + +} // namespace gearman_util diff -Nru gearmand-0.14/util/operation.h gearmand-0.23/util/operation.h --- gearmand-0.14/util/operation.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/operation.h 2011-04-28 19:44:27.000000000 +0200 @@ -0,0 +1,127 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +#include +#include +#include + +namespace gearman_util { + +class Operation { + typedef std::vector Packet; + +public: + typedef std::vector vector; + + Operation(const char *command, size_t command_length, bool expect_response= true) : + _expect_response(expect_response), + packet(), + response() + { + packet.resize(command_length); + memcpy(&packet[0], command, command_length); + } + + ~Operation() + { } + + size_t size() const + { + return packet.size(); + } + + const char* ptr() const + { + return &(packet)[0]; + } + + bool has_response() const + { + return _expect_response; + } + + void push(const char *buffer, size_t buffer_size) + { + size_t response_size= response.size(); + response.resize(response_size + buffer_size); + memcpy(&response[0] +response_size, buffer, buffer_size); + } + + void print() const + { + if (response.empty()) + return; + + if (not memcmp("OK\r\n", &response[0], 3)) + { + std::cout << "OK" << std::endl; + return; + } + else if (not memcmp("OK ", &response[0], 3)) + { + std::cout.write(&response[3], response.size() -3); + } + else if (not memcmp("ERR ", &response[0], 4)) + { + std::cerr << "Error: "; + std::cerr.write(&response[4], response.size() -4); + } + else + { +#if 0 // Do this until we have the factory in place for admin language + std::cerr << "Unknown reponse returned:"; +#endif + std::cerr.write(&response[0], response.size()); + std::cerr << std::endl; + } + } + + bool reconnect() const + { + return false; + } + +private: + bool _expect_response; + Packet packet; + Packet response; +}; + +} // namespace gearman_util diff -Nru gearmand-0.14/util/pidfile.cc gearmand-0.23/util/pidfile.cc --- gearmand-0.14/util/pidfile.cc 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/pidfile.cc 2011-04-26 02:06:54.000000000 +0200 @@ -0,0 +1,107 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" + +#include "pidfile.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace gearman_util +{ + +Pidfile::Pidfile(const std::string &arg) : + _last_errno(0), + _filename(arg) +{ +} + + +Pidfile::~Pidfile() +{ + if (not _filename.empty() and (unlink(_filename.c_str()) == -1)) + { + _error_message+= "Could not remove the pid file: "; + _error_message+= _filename; + } +} + +bool Pidfile::create() +{ + if (_filename.empty()) + return true; + + int file; + if ((file = open(_filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU|S_IRGRP|S_IROTH)) < 0) + { + _error_message+= "Could not open pid file for writing: "; + _error_message+= _filename; + return false; + } + + char buffer[BUFSIZ]; + + unsigned long temp= static_cast(getpid()); + int length= snprintf(buffer, sizeof(buffer), "%lu\n", temp); + + if (write(file, buffer, length) != length) + { + _error_message+= "Could not write pid to file: "; + _error_message+= _filename; + + return false; + } + + if (close(file < 0)) + { + _error_message+= "Could not close() file after writing pid to it: "; + _error_message+= _filename; + return false; + } + + return true; +} + +} // namespace gearman_util diff -Nru gearmand-0.14/util/pidfile.h gearmand-0.23/util/pidfile.h --- gearmand-0.14/util/pidfile.h 1970-01-01 01:00:00.000000000 +0100 +++ gearmand-0.23/util/pidfile.h 2011-04-26 02:06:59.000000000 +0200 @@ -0,0 +1,66 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Gearmand client and server library. + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + + +#include + +namespace gearman_util +{ + +class Pidfile +{ +public: + Pidfile(const std::string &arg); + + ~Pidfile(); + + const std::string &error_message() + { + return _error_message; + } + + bool create(); + +private: + int _last_errno; + std::string _filename; + std::string _error_message; +}; + +} // namespace gearman_util