gearmand-1.0.6/0000775000076400007640000000000012142673676013574 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-1.0/0000775000076400007640000000000012142673674016167 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-1.0/util.h0000664000076400007640000000416112111634227017302 0ustar00brianbrian00000000000000/* 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 const char *gearman_version(void); GEARMAN_API const char *gearman_bugreport(void); GEARMAN_API const char *gearman_verbose_name(gearman_verbose_t verbose); #define gearman_timeout(__object) (__object) ? ((__object)->universal.timeout) : 0 #define gearman_set_timeout(__object, __value) do { if (__object) ((__object)->universal.timeout)=(__value); } while(0); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/include.am0000664000076400007640000000260312107145705020120 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011 Data Differential, http://datadifferential.com/ include libgearman-1.0/t/include.am nobase_include_HEADERS+= libgearman-1.0/interface/status.h nobase_include_HEADERS+= libgearman-1.0/interface/task.h nobase_include_HEADERS+= libgearman-1.0/status.h nobase_include_HEADERS+= \ libgearman-1.0/actions.h \ libgearman-1.0/aggregator.h \ libgearman-1.0/allocator.h \ libgearman-1.0/argument.h \ libgearman-1.0/client.h \ libgearman-1.0/client_callbacks.h \ libgearman-1.0/configure.h \ libgearman-1.0/connection.h \ libgearman-1.0/constants.h \ libgearman-1.0/core.h \ libgearman-1.0/execute.h \ libgearman-1.0/function.h \ libgearman-1.0/gearman.h \ libgearman-1.0/job.h \ libgearman-1.0/job_handle.h \ libgearman-1.0/kill.h \ libgearman-1.0/limits.h \ libgearman-1.0/ostream.hpp \ libgearman-1.0/packet.h \ libgearman-1.0/parse.h \ libgearman-1.0/priority.h \ libgearman-1.0/protocol.h \ libgearman-1.0/result.h \ libgearman-1.0/return.h \ libgearman-1.0/signal.h \ libgearman-1.0/strerror.h \ libgearman-1.0/string.h \ libgearman-1.0/task.h \ libgearman-1.0/task_attr.h \ libgearman-1.0/universal.h \ libgearman-1.0/util.h \ libgearman-1.0/version.h \ libgearman-1.0/visibility.h \ libgearman-1.0/worker.h gearmand-1.0.6/libgearman-1.0/argument.h0000664000076400007640000000373012107145705020153 0ustar00brianbrian00000000000000/* 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_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 gearmand-1.0.6/libgearman-1.0/universal.h0000664000076400007640000000545112107145705020343 0ustar00brianbrian00000000000000/* 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 /** @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); typedef struct gearman_server_options_st gearman_server_options_st; /** * @ingroup gearman_universal */ struct gearman_universal_st { struct { bool dont_track_packets; bool non_blocking; } options; gearman_verbose_t verbose; uint32_t con_count; uint32_t packet_count; uint32_t pfds_size; uint32_t sending; int timeout; // Connection timeout. gearman_connection_st *con_list; gearman_server_options_st *server_options_list; gearman_packet_st *packet_list; struct pollfd *pfds; gearman_log_fn *log_fn; void *log_context; 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; int wakeup_fd[2]; }; gearmand-1.0.6/libgearman-1.0/execute.h0000664000076400007640000000540612107145705017775 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-1.0/interface/0000775000076400007640000000000012142673671020124 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-1.0/interface/status.h0000664000076400007640000000411612107145705021613 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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_status_version_t { GEARMAN_STATUS_V1 }; struct gearman_status_v1_t { gearman_return_t result_rc; bool is_known; bool is_running; uint32_t numerator; uint32_t denominator; uint32_t client_count; }; struct gearman_status_t { enum gearman_status_version_t version_; union { struct gearman_status_v1_t mesg_; uint8_t raw_[sizeof(struct gearman_status_v1_t)]; } status_; }; gearmand-1.0.6/libgearman-1.0/interface/task.h0000664000076400007640000000564412107145705021241 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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_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; bool send_in_use; bool is_known; bool is_running; bool was_reduced; bool is_paused; bool is_initialized; } options; enum gearman_task_kind_t type; enum gearman_task_state_t state; uint32_t magic_; uint32_t created_id; uint32_t numerator; uint32_t denominator; uint32_t client_count; gearman_client_st *client; gearman_task_st *next; gearman_task_st *prev; void *context; 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]; size_t unique_length; char unique[GEARMAN_MAX_UNIQUE_SIZE]; }; gearmand-1.0.6/libgearman-1.0/gearman.h0000664000076400007640000000657012107145705017750 0ustar00brianbrian00000000000000/* 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 Declarations */ #pragma once /* This seems to be required for older compilers @note http://stackoverflow.com/questions/8132399/how-to-printf-uint64-t */ #ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS #endif #ifdef __cplusplus # include # include # include # include #else # include # include # include # include # include #endif #include #include #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 #include #include #include gearmand-1.0.6/libgearman-1.0/aggregator.h0000664000076400007640000000350512107145705020453 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-1.0/status.h0000664000076400007640000000422512107145705017654 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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_return_t gearman_status_return(const struct gearman_status_t arg); GEARMAN_API bool gearman_status_is_known(const struct gearman_status_t arg); GEARMAN_API bool gearman_status_is_running(const struct gearman_status_t arg); GEARMAN_API uint32_t gearman_status_numerator(const struct gearman_status_t arg); GEARMAN_API uint32_t gearman_status_denominator(const struct gearman_status_t arg); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/limits.h0000664000076400007640000000507612107145705017637 0ustar00brianbrian00000000000000/* 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 /* Defines. */ #define GEARMAN_ARGS_BUFFER_SIZE 128 #define GEARMAN_DEFAULT_SOCKET_RECV_SIZE 32768 #define GEARMAN_DEFAULT_SOCKET_SEND_SIZE 32768 #define GEARMAN_DEFAULT_SOCKET_TIMEOUT 10 #define GEARMAN_DEFAULT_CONNECT_TIMEOUT 4000 #define GEARMAN_DEFAULT_TCP_HOST "localhost" #define GEARMAN_FUNCTION_MAX_SIZE 512 #define GEARMAN_JOB_HANDLE_SIZE 64 #define GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH 20 #define GEARMAN_MAX_COMMAND_ARGS 8 #define GEARMAN_MAX_ECHO_SIZE (UINT32_MAX -GEARMAN_ARGS_BUFFER_SIZE) #define GEARMAN_MAX_ERROR_SIZE 2048 #define GEARMAN_MAX_IDENTIFIER 254 #define GEARMAN_MAX_UNIQUE_SIZE 64 #define GEARMAN_MAX_UUID_SIZE 36 #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 GEARMAN_MAX_UNIQUE_SIZE #define GEARMAN_WORKER_WAIT_TIMEOUT (10 * 1000) /* Milliseconds */ gearmand-1.0.6/libgearman-1.0/constants.h0000664000076400007640000001265412107145705020352 0ustar00brianbrian00000000000000/* 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 #include #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearman_constants Constants * @ingroup gearman_universal * @ingroup gearman_client * @ingroup gearman_worker * @{ */ /** * Verbosity levels. */ typedef enum { GEARMAN_VERBOSE_NEVER, GEARMAN_VERBOSE_FATAL, GEARMAN_VERBOSE_ERROR, GEARMAN_VERBOSE_INFO, GEARMAN_VERBOSE_DEBUG, GEARMAN_VERBOSE_CRAZY, GEARMAN_VERBOSE_MAX } gearman_verbose_t; /** @} */ /** * @ingroup gearman_universal * Options for gearman_universal_st. */ typedef enum { GEARMAN_NON_BLOCKING, GEARMAN_DONT_TRACK_PACKETS, GEARMAN_MAX } gearman_universal_options_t; /** * @ingroup gearman_con * Options for gearman_connection_st. */ typedef enum { GEARMAN_CON_READY, GEARMAN_CON_PACKET_IN_USE, GEARMAN_CON_EXTERNAL_FD, GEARMAN_CON_IGNORE_LOST_CONNECTION, GEARMAN_CON_CLOSE_AFTER_FLUSH, GEARMAN_CON_MAX } gearman_connection_options_t; /** * @ingroup gearman_client * Options for gearman_client_st. */ typedef enum { GEARMAN_CLIENT_ALLOCATED= (1 << 0), GEARMAN_CLIENT_NON_BLOCKING= (1 << 1), GEARMAN_CLIENT_TASK_IN_USE= (1 << 2), GEARMAN_CLIENT_UNBUFFERED_RESULT= (1 << 3), GEARMAN_CLIENT_NO_NEW= (1 << 4), GEARMAN_CLIENT_FREE_TASKS= (1 << 5), GEARMAN_CLIENT_GENERATE_UNIQUE= (1 << 6), GEARMAN_CLIENT_MAX= (1 << 7) } gearman_client_options_t; /** * @ingroup gearman_worker * Options for gearman_worker_st. */ typedef enum { GEARMAN_WORKER_ALLOCATED= (1 << 0), GEARMAN_WORKER_NON_BLOCKING= (1 << 1), GEARMAN_WORKER_PACKET_INIT= (1 << 2), GEARMAN_WORKER_GRAB_JOB_IN_USE= (1 << 3), GEARMAN_WORKER_PRE_SLEEP_IN_USE= (1 << 4), GEARMAN_WORKER_WORK_JOB_IN_USE= (1 << 5), GEARMAN_WORKER_CHANGE= (1 << 6), GEARMAN_WORKER_GRAB_UNIQ= (1 << 7), GEARMAN_WORKER_TIMEOUT_RETURN= (1 << 8), GEARMAN_WORKER_GRAB_ALL= (1 << 9), GEARMAN_WORKER_MAX= (1 << 10) } gearman_worker_options_t; /* Types. */ typedef struct gearman_packet_st gearman_packet_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; typedef struct gearman_status_t gearman_status_t; // 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 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); // Worker types typedef void* (gearman_worker_fn)(gearman_job_st *job, void *context, size_t *result_size, gearman_return_t *ret_ptr); typedef gearman_return_t (gearman_function_fn)(gearman_job_st *job, void *worker_context); 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 gearmand-1.0.6/libgearman-1.0/parse.h0000664000076400007640000000444412107145705017446 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-1.0/packet.h0000664000076400007640000000457712107145705017612 0ustar00brianbrian00000000000000/* 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_magic_t { GEARMAN_MAGIC_TEXT, GEARMAN_MAGIC_REQUEST, GEARMAN_MAGIC_RESPONSE }; /** * @ingroup gearman_packet */ struct gearman_packet_st { struct { 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; struct gearman_universal_st *universal; gearman_packet_st *next; gearman_packet_st *prev; char *args; const void *data; char *arg[GEARMAN_MAX_COMMAND_ARGS]; size_t arg_size[GEARMAN_MAX_COMMAND_ARGS]; char args_buffer[GEARMAN_ARGS_BUFFER_SIZE]; #ifdef GEARMAN_PACKET_TRACE uint32_t _id; #endif }; gearmand-1.0.6/libgearman-1.0/job.h0000664000076400007640000001146012127430346017102 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 Job Declarations */ #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" { #endif /** * @addtogroup gearman_job Job Declarations * @ingroup gearman_worker * * The job functions are used to manage jobs assigned to workers. It is most * commonly used with the worker interface. * * @{ */ /** Free a job structure. * * @param[in] job Structure previously initialized with * gearman_worker_grab_job(). */ GEARMAN_API void gearman_job_free(gearman_job_st *job); /** * 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); /** * Send warning for a running job. */ GEARMAN_API gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size); /** * Send status information for a running job. */ GEARMAN_API gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator); /** * Send result and complete status for a job. */ GEARMAN_API gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size); /** Send exception for a running job. */ GEARMAN_API gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size); /** * Send fail status for a job. */ GEARMAN_API gearman_return_t gearman_job_send_fail(gearman_job_st *job); /** Get job handle. */ GEARMAN_API const char *gearman_job_handle(const gearman_job_st *job); /** * Get the function name associated with a job. */ GEARMAN_API const char *gearman_job_function_name(const gearman_job_st *job); /** Get the unique ID associated with a job. */ GEARMAN_API const char *gearman_job_unique(const gearman_job_st *job); /** Get a pointer to the workload for a job. */ GEARMAN_API const void *gearman_job_workload(const gearman_job_st *job); /** * Get size of the workload for a job. */ GEARMAN_API size_t gearman_job_workload_size(const gearman_job_st *job); /** * Take allocated workload from job. After this, the caller is responsible * for free()ing the memory. */ GEARMAN_API void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); GEARMAN_API gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job); GEARMAN_API const char *gearman_job_error(gearman_job_st *job); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/actions.h0000664000076400007640000000402212107145705017764 0ustar00brianbrian00000000000000/* 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; }; gearmand-1.0.6/libgearman-1.0/priority.h0000664000076400007640000000376512107145705020222 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-1.0/worker.h0000664000076400007640000004061612107145705017646 0ustar00brianbrian00000000000000/* 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 Worker Declarations */ #pragma once /** @addtogroup gearman_worker Worker Declarations * * This is the interface gearman workers should use. * * @ref main_page_worker "See Main Page for full details." * @{ */ 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 }; 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 }; /** * @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; void *context; gearman_connection_st *con; gearman_job_st *job; gearman_job_st *job_list; struct _worker_function_st *function; struct _worker_function_st *function_list; struct _worker_function_st *work_function; void *work_result; struct gearman_universal_st universal; gearman_packet_st grab_job; gearman_packet_st pre_sleep; 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 * in a pre-allocated structure. Some other initialization may have failed. It * is not required to memset() a structure before providing it. * * @param[in] worker 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_API gearman_worker_st *gearman_worker_create(gearman_worker_st *worker); /** * Clone a worker structure. * * @param[in] worker Caller allocated structure, or NULL to allocate one. * @param[in] from Structure to use as a source to clone from. * @return Same return as gearman_worker_create(). */ GEARMAN_API gearman_worker_st *gearman_worker_clone(gearman_worker_st *worker, const gearman_worker_st *from); /** * Free resources used by a worker structure. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). */ GEARMAN_API void gearman_worker_free(gearman_worker_st *worker); /** * See gearman_error() for details. */ GEARMAN_API const char *gearman_worker_error(const gearman_worker_st *worker); /** * See gearman_errno() for details. */ GEARMAN_API int gearman_worker_errno(gearman_worker_st *worker); /** * Get options for a worker structure. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @return Options set for the worker structure. */ GEARMAN_API gearman_worker_options_t gearman_worker_options(const gearman_worker_st *worker); /** * Set options for a worker structure. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param options Available options for worker structures. */ GEARMAN_API void gearman_worker_set_options(gearman_worker_st *worker, gearman_worker_options_t options); /** * Add options for a worker structure. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param options Available options for worker structures. */ GEARMAN_API void gearman_worker_add_options(gearman_worker_st *worker, gearman_worker_options_t options); /** * Remove options for a worker structure. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param options Available options for worker structures. */ GEARMAN_API void gearman_worker_remove_options(gearman_worker_st *worker, gearman_worker_options_t options); /** * See gearman_universal_timeout() for details. */ GEARMAN_API int gearman_worker_timeout(gearman_worker_st *worker); /** * See gearman_universal_set_timeout() for details. */ GEARMAN_API void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout); /** * Get the application context for a worker. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @return Application context that was previously set, or NULL. */ GEARMAN_API void *gearman_worker_context(const gearman_worker_st *worker); /** * Set the application context for a worker. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] context Application context to set. */ GEARMAN_API void gearman_worker_set_context(gearman_worker_st *worker, void *context); /** * See gearman_set_log_fn() for details. */ GEARMAN_API void gearman_worker_set_log_fn(gearman_worker_st *worker, gearman_log_fn *function, void *context, gearman_verbose_t verbose); /** * See gearman_set_workload_malloc_fn() for details. */ GEARMAN_API void gearman_worker_set_workload_malloc_fn(gearman_worker_st *worker, 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_API void gearman_worker_set_workload_free_fn(gearman_worker_st *worker, gearman_free_fn *function, void *context); /** * 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. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] host Hostname or IP address (IPv4 or IPv6) of the server to add. * @param[in] port Port of the server to add. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_add_server(gearman_worker_st *worker, const char *host, in_port_t port); /** * 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 * localhost234,jobserver2.domain.com:7003,10.0.0.3 * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] servers Server list described above. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_add_servers(gearman_worker_st *worker, const char *servers); /** * Remove all servers currently associated with the worker. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). */ GEARMAN_API void gearman_worker_remove_servers(gearman_worker_st *worker); /** * When in non-blocking I/O mode, wait for activity from one of the servers. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_wait(gearman_worker_st *worker); /** * 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. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] function_name Function name to register. * @param[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. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_register(gearman_worker_st *worker, const char *function_name, uint32_t timeout); /** * Unregister function with job servers. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] function_name Function name to unregister. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_unregister(gearman_worker_st *worker, const char *function_name); /** * Unregister all functions with job servers. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_unregister_all(gearman_worker_st *worker); /** * 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. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] job Caller allocated structure, or NULL to allocate one. * @param[out] ret_ptr Standard gearman return value. * @return On success, a pointer to the (possibly allocated) structure. On * failure this will be NULL. */ GEARMAN_API gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr); /** * Free all jobs for a gearman structure. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). */ GEARMAN_API void gearman_job_free_all(gearman_worker_st *worker); /** * See if a function exists in the server. It will not return * true if the function is currently being de-allocated. * @param[in] worker gearman_worker_st that will be used. * @param[in] function_name Function name for search. * @param[in] function_length Length of function name. * @return bool */ GEARMAN_API bool gearman_worker_function_exist(gearman_worker_st *worker, const char *function_name, size_t function_length); /** * Register and add callback function for worker. To remove functions that have * been added, call gearman_worker_unregister() or * gearman_worker_unregister_all(). * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] function_name Function name to register. * @param[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. * @param[in] function Function to run when there is a job ready. * @param[in] context Argument to pass into the callback function. * @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_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. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_work(gearman_worker_st *worker); /** * 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. * * @param[in] worker Structure previously initialized with * gearman_worker_create() or gearman_worker_clone(). * @param[in] workload The workload to ask the server to echo back. * @param[in] workload_size Size of the workload. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_worker_echo(gearman_worker_st *worker, 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); GEARMAN_API const char *gearman_worker_namespace(gearman_worker_st *self); GEARMAN_API gearman_id_t gearman_worker_shutdown_handle(gearman_worker_st *self); GEARMAN_API gearman_id_t gearman_worker_id(gearman_worker_st *self); GEARMAN_API gearman_return_t gearman_worker_set_identifier(gearman_worker_st *worker, const char *id, size_t id_size); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/t/0000775000076400007640000000000012142673676016434 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-1.0/t/c_test.c0000664000076400007640000000360712107145705020053 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Test C interface * * 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 int main(void) { gearman_client_st *client= gearman_client_create(NULL); if (client == NULL) { return EXIT_FAILURE; } gearman_client_free(client); return EXIT_SUCCESS; } gearmand-1.0.6/libgearman-1.0/t/include.am0000664000076400007640000000075212107145705020366 0ustar00brianbrian00000000000000# vim:ft=automake # Test linking with C application libgearman_1_0_t_c_test_SOURCES= libgearman-1.0/t/c_test.c libgearman_1_0_t_c_test_LDADD= libgearman/libgearman.la check_PROGRAMS+= libgearman-1.0/t/c_test noinst_PROGRAMS+= libgearman-1.0/t/c_test # Test linking with C application libgearman_1_0_t_cc_test_SOURCES= libgearman-1.0/t/cc_test.cc libgearman_1_0_t_cc_test_LDADD= libgearman/libgearman.la check_PROGRAMS+= libgearman-1.0/t/cc_test noinst_PROGRAMS+= libgearman-1.0/t/cc_test gearmand-1.0.6/libgearman-1.0/t/cc_test.cc0000664000076400007640000000360712107145705020361 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Test C interface * * 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 int main(void) { gearman_client_st *client= gearman_client_create(NULL); if (client == NULL) { return EXIT_FAILURE; } gearman_client_free(client); return EXIT_SUCCESS; } gearmand-1.0.6/libgearman-1.0/task.h0000664000076400007640000001133612127430346017274 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 Declarations */ #pragma once #include #include #ifdef __cplusplus extern "C" { #endif /** * Free a task structure. * * @param[in] task Structure previously initialized with one of the * gearman_client_add_task() functions. */ GEARMAN_API void gearman_task_free(gearman_task_st *task); /** * Get context for a task. */ GEARMAN_API void *gearman_task_context(const gearman_task_st *task); /** * Set context for a task. */ GEARMAN_API void gearman_task_set_context(gearman_task_st *task, void *context); /** * Get function name associated with a task. */ GEARMAN_API const char *gearman_task_function_name(const gearman_task_st *task); /** * Get unique identifier for a task. */ GEARMAN_API const char *gearman_task_unique(const gearman_task_st *task); /** * Get job handle for a task. */ GEARMAN_API const char *gearman_task_job_handle(const gearman_task_st *task); /** * Get status on whether a task is known or not. */ GEARMAN_API bool gearman_task_is_known(const gearman_task_st *task); /** * Get status on whether a task is running or not. */ GEARMAN_API bool gearman_task_is_running(const gearman_task_st *task); /** * Get the numerator of percentage complete for a task. */ GEARMAN_API uint32_t gearman_task_numerator(const gearman_task_st *task); /** * Get the denominator of percentage complete for a task. */ GEARMAN_API uint32_t gearman_task_denominator(const gearman_task_st *task); /** * Give allocated memory to task. After this, the library will be responsible * for freeing the workload memory when the task is destroyed. */ GEARMAN_API void gearman_task_give_workload(gearman_task_st *task, const void *workload, size_t workload_size); /** * Send packet workload for a task. */ GEARMAN_API size_t gearman_task_send_workload(gearman_task_st *task, const void *workload, size_t workload_size, gearman_return_t *ret_ptr); /** * Get result data being returned for a task. */ GEARMAN_API const void *gearman_task_data(const gearman_task_st *task); /** * Get result data size being returned for a task. */ GEARMAN_API size_t gearman_task_data_size(const gearman_task_st *task); /** * Take allocated result data from task. After this, the caller is responsible * for free()ing the memory. */ GEARMAN_API void *gearman_task_take_data(gearman_task_st *task, size_t *data_size); /** * Read result data into a buffer for a task. */ GEARMAN_API 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_API const char *gearman_task_strstate(const gearman_task_st *); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/ostream.hpp0000664000076400007640000001546712107145705020355 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearman Server and Client * * 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 #include #include static inline std::ostream& operator<<(std::ostream& output, const enum gearman_return_t &arg) { output << gearman_strerror(arg); return output; } static inline std::ostream& operator<<(std::ostream& output, const gearman_packet_st &arg) { const char* command_str; switch(arg.command) { case GEARMAN_COMMAND_TEXT: command_str= "GEARMAN_COMMAND_TEXT"; case GEARMAN_COMMAND_CAN_DO: command_str= "GEARMAN_COMMAND_CAN_DO"; case GEARMAN_COMMAND_CANT_DO: command_str= "GEARMAN_COMMAND_CANT_DO"; case GEARMAN_COMMAND_RESET_ABILITIES: command_str= "GEARMAN_COMMAND_RESET_ABILITIES"; case GEARMAN_COMMAND_PRE_SLEEP: command_str= "GEARMAN_COMMAND_PRE_SLEEP"; case GEARMAN_COMMAND_UNUSED: command_str= "GEARMAN_COMMAND_UNUSED"; case GEARMAN_COMMAND_NOOP: command_str= "GEARMAN_COMMAND_NOOP"; case GEARMAN_COMMAND_SUBMIT_JOB: command_str= "GEARMAN_COMMAND_SUBMIT_JOB"; case GEARMAN_COMMAND_JOB_CREATED: command_str= "GEARMAN_COMMAND_JOB_CREATED"; case GEARMAN_COMMAND_GRAB_JOB: command_str= "GEARMAN_COMMAND_GRAB_JOB"; case GEARMAN_COMMAND_NO_JOB: command_str= "GEARMAN_COMMAND_NO_JOB"; case GEARMAN_COMMAND_JOB_ASSIGN: command_str= "GEARMAN_COMMAND_JOB_ASSIGN"; case GEARMAN_COMMAND_WORK_STATUS: command_str= "GEARMAN_COMMAND_WORK_STATUS"; case GEARMAN_COMMAND_WORK_COMPLETE: command_str= "GEARMAN_COMMAND_WORK_COMPLETE"; case GEARMAN_COMMAND_WORK_FAIL: command_str= "GEARMAN_COMMAND_WORK_FAIL"; case GEARMAN_COMMAND_GET_STATUS: command_str= "GEARMAN_COMMAND_GET_STATUS"; case GEARMAN_COMMAND_ECHO_REQ: command_str= "GEARMAN_COMMAND_ECHO_REQ"; case GEARMAN_COMMAND_ECHO_RES: command_str= "GEARMAN_COMMAND_ECHO_RES"; case GEARMAN_COMMAND_SUBMIT_JOB_BG: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_BG"; case GEARMAN_COMMAND_ERROR: command_str= "GEARMAN_COMMAND_ERROR"; case GEARMAN_COMMAND_STATUS_RES: command_str= "GEARMAN_COMMAND_STATUS_RES"; case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_HIGH"; case GEARMAN_COMMAND_SET_CLIENT_ID: command_str= "GEARMAN_COMMAND_SET_CLIENT_ID"; case GEARMAN_COMMAND_CAN_DO_TIMEOUT: command_str= "GEARMAN_COMMAND_CAN_DO_TIMEOUT"; case GEARMAN_COMMAND_ALL_YOURS: command_str= "GEARMAN_COMMAND_ALL_YOURS"; case GEARMAN_COMMAND_WORK_EXCEPTION: command_str= "GEARMAN_COMMAND_WORK_EXCEPTION"; case GEARMAN_COMMAND_OPTION_REQ: command_str= "GEARMAN_COMMAND_OPTION_REQ"; case GEARMAN_COMMAND_OPTION_RES: command_str= "GEARMAN_COMMAND_OPTION_RES"; case GEARMAN_COMMAND_WORK_DATA: command_str= "GEARMAN_COMMAND_WORK_DATA"; case GEARMAN_COMMAND_WORK_WARNING: command_str= "GEARMAN_COMMAND_WORK_WARNING"; case GEARMAN_COMMAND_GRAB_JOB_UNIQ: command_str= "GEARMAN_COMMAND_GRAB_JOB_UNIQ"; case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: command_str= "GEARMAN_COMMAND_JOB_ASSIGN_UNIQ"; case GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG"; case GEARMAN_COMMAND_SUBMIT_JOB_LOW: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_LOW"; case GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG"; case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_SCHED"; case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: command_str= "GEARMAN_COMMAND_SUBMIT_JOB_EPOCH"; case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: command_str= "GEARMAN_COMMAND_SUBMIT_REDUCE_JOB"; case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: command_str= "GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND"; case GEARMAN_COMMAND_GRAB_JOB_ALL: command_str= "GEARMAN_COMMAND_GRAB_JOB_ALL"; case GEARMAN_COMMAND_JOB_ASSIGN_ALL: command_str= "GEARMAN_COMMAND_JOB_ASSIGN_ALL"; case GEARMAN_COMMAND_MAX: command_str= "GEARMAN_COMMAND_MAX"; case GEARMAN_COMMAND_GET_STATUS_UNIQUE: command_str= "GEARMAN_COMMAND_GET_STATUS_UNIQUE"; case GEARMAN_COMMAND_STATUS_RES_UNIQUE: command_str= "GEARMAN_COMMAND_STATUS_RES_UNIQUE"; } output << std::boolalpha << "command: " << command_str << " argc: " << int(arg.argc); for (uint8_t x= 0; x < arg.argc; x++) { output << "arg[" << int(x) << "]: "; output.write(arg.arg[x], arg.arg_size[x]); output << " "; } return output; } static inline std::ostream& operator<<(std::ostream& output, const gearman_task_st &arg) { output << std::boolalpha << "job: " << gearman_task_job_handle(&arg) << " unique: " << gearman_task_unique(&arg) << " has_result:" << bool(arg.result_ptr) << " complete: " << gearman_task_numerator(&arg) << "/" << gearman_task_denominator(&arg) << " state: " << gearman_task_strstate(&arg) << " is_known: " << gearman_task_is_known(&arg) << " is_running: " << gearman_task_is_running(&arg) << " ret: " << gearman_task_return(&arg); if (arg.recv) { output << " " << *arg.recv; } return output; } static inline std::ostream& operator<<(std::ostream& output, const gearman_status_t &arg) { output << std::boolalpha << " is_known: " << gearman_status_is_known(arg) << " is_running: " << gearman_status_is_running(arg) << " complete: " << gearman_status_numerator(arg) << "/" << gearman_status_denominator(arg) << " ret: " << gearman_strerror(gearman_status_return(arg)); return output; } gearmand-1.0.6/libgearman-1.0/client.h0000664000076400007640000006715712121207471017617 0ustar00brianbrian00000000000000/* 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 Client Declarations */ #pragma once /** @addtogroup gearman_client Client Declarations * * This is the interface gearman clients should use. You can run tasks one at a * time or concurrently. * * @ref main_page_client "See Main Page for full details." * @{ */ enum gearman_client_t { GEARMAN_CLIENT_STATE_IDLE, GEARMAN_CLIENT_STATE_NEW, GEARMAN_CLIENT_STATE_SUBMIT, GEARMAN_CLIENT_STATE_PACKET }; /** * @ingroup gearman_client */ struct gearman_client_st { struct { bool allocated; bool non_blocking; bool unbuffered_result; bool no_new; bool free_tasks; bool generate_unique; } options; enum gearman_client_t state; uint32_t new_tasks; uint32_t running_tasks; uint32_t task_count; void *context; gearman_connection_st *con; gearman_task_st *task; gearman_task_st *task_list; gearman_task_context_free_fn *task_context_free_fn; 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 * is not required to memset() a structure before providing it. * * @param[in] client 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_API gearman_client_st *gearman_client_create(gearman_client_st *client); /** * Clone a client structure. * * @param[in] client Caller allocated structure, or NULL to allocate one. * @param[in] from Structure to use as a source to clone from. * @return Same return as gearman_client_create(). */ GEARMAN_API gearman_client_st *gearman_client_clone(gearman_client_st *client, const gearman_client_st *from); /** * Free resources used by a client structure. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). */ GEARMAN_API void gearman_client_free(gearman_client_st *client); /** * See gearman_error() for details. */ GEARMAN_API const char *gearman_client_error(const gearman_client_st *client); GEARMAN_API gearman_return_t gearman_client_error_code(const gearman_client_st *client); /** * See gearman_errno() for details. */ GEARMAN_API int gearman_client_errno(const gearman_client_st *client); /** * Get options for a client structure. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @return Options set for the client structure. */ GEARMAN_API gearman_client_options_t gearman_client_options(const gearman_client_st *client); /** * Set options for a client structure. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] options Available options for client structures. */ GEARMAN_API void gearman_client_set_options(gearman_client_st *client, gearman_client_options_t options); /** * Add options for a client structure. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] options Available options for client structures. */ GEARMAN_API 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. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] options Available options for client structures. */ GEARMAN_API void gearman_client_remove_options(gearman_client_st *client, gearman_client_options_t options); /** * See gearman_universal_timeout() for details. */ GEARMAN_API int gearman_client_timeout(gearman_client_st *client); /** * See gearman_universal_set_timeout() for details. */ GEARMAN_API void gearman_client_set_timeout(gearman_client_st *client, int timeout); /** * Get the application context for a client. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @return Application context that was previously set, or NULL. */ GEARMAN_API void *gearman_client_context(const gearman_client_st *client); /** * Set the application context for a client. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] context Application context to set. */ GEARMAN_API void gearman_client_set_context(gearman_client_st *client, void *context); /** * See gearman_set_log_fn() for details. */ GEARMAN_API void gearman_client_set_log_fn(gearman_client_st *client, gearman_log_fn *function, void *context, gearman_verbose_t verbose); /** * See gearman_set_workload_malloc_fn() for details. */ GEARMAN_API void gearman_client_set_workload_malloc_fn(gearman_client_st *client, gearman_malloc_fn *function, void *context); /** * See gearman_set_workload_malloc_fn() for details. */ GEARMAN_API void gearman_client_set_workload_free_fn(gearman_client_st *client, 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. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] host Hostname or IP address (IPv4 or IPv6) of the server to add. * @param[in] port Port of the server to add. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_client_add_server(gearman_client_st *client, const char *host, in_port_t port); /** * 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 * localhost234,jobserver2.domain.com:7003,10.0.0.3 * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] servers Server list described above. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_client_add_servers(gearman_client_st *client, const char *servers); /** * Remove all servers currently associated with the client. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). */ GEARMAN_API void gearman_client_remove_servers(gearman_client_st *client); /** * When in non-blocking I/O mode, wait for activity from one of the servers. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_client_wait(gearman_client_st *client); /** @} */ /** * @addtogroup gearman_client_single Single Task Interface * @ingroup gearman_client * Use the following set of functions to run one task at a time. * * @ref main_page_client_single "See Main Page for full details." * @{ */ /** * Run a single task and return an allocated result. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function_name The name of the function to run. * @param[in] unique Optional unique job identifier, or NULL for a new UUID. * @param[in] workload The workload to pass to the function when it is run. * @param[in] workload_size Size of the workload. * @param[out] result_size The size of the data being returned. * @param[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. * @return The result allocated by the library, this needs to be freed when the * caller is done using it. */ GEARMAN_API 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); /** * Run a high priority task and return an allocated result. See * gearman_client_do() for parameter and return information. */ GEARMAN_API 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); /** * Run a low priority task and return an allocated result. See * gearman_client_do() for parameter and return information. */ GEARMAN_API 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); /** * Get the job handle 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(). * @return Pointer to static buffer in the client structure that holds the job * handle. */ GEARMAN_API const char *gearman_client_do_job_handle(gearman_client_st *client); // Deprecatd GEARMAN_API void gearman_client_do_status(gearman_client_st *client, uint32_t *numerator, uint32_t *denominator); /** * Run a task in the background. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function_name The name of the function to run. * @param[in] unique Optional unique job identifier, or NULL for a new UUID. * @param[in] workload The workload to pass to the function when it is run. * @param[in] workload_size Size of the workload. * @param[out] job_handle A buffer to store the job handle in. Must be at least GEARMAN_JOB_HANDLE_SIZE bytes long. * @return Standard gearman return value. */ GEARMAN_API 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, gearman_job_handle_t job_handle); /** * Run a high priority task in the background. See * gearman_client_do_background() for parameter and return information. */ GEARMAN_API 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); /** * Run a low priority task in the background. See * gearman_client_do_background() for parameter and return information. */ GEARMAN_API 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); /** * Get the status for a backgound job. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] job_handle The job handle to get status for. * @param[out] is_known Optional parameter to store the known status in. * @param[out] is_running Optional parameter to store the running status in. * @param[out] numerator Optional parameter to store the numerator in. * @param[out] denominator Optional parameter to store the denominator in. * @return Standard gearman return value. */ GEARMAN_API 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_API gearman_status_t gearman_client_unique_status(gearman_client_st *client, const char *unique, size_t unique_length); // This is not in the API yet, subject to change GEARMAN_API gearman_task_st *gearman_client_add_task_status_by_unique(gearman_client_st *client, gearman_task_st *task_ptr, const char *unique_handle, gearman_return_t *ret_ptr); /** * 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. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] workload The workload to ask the server to echo back. * @param[in] workload_size Size of the workload. * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_client_echo(gearman_client_st *client, const void *workload, size_t workload_size); /** @} */ /** * @addtogroup gearman_client_concurrent Concurrent Task Interface * @ingroup gearman_client * Use the following set of functions to multiple run tasks concurrently. * * @ref main_page_client_concurrent "See Main Page for full details." * @{ */ /** * Free all tasks for a gearman structure. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). */ GEARMAN_API void gearman_client_task_free_all(gearman_client_st *client); /** * Set function to call when tasks are being cleaned up so applications can * clean up the task context. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call to clean up task context. */ GEARMAN_API 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. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] task Caller allocated structure, or NULL to allocate one. * @param[in] context Application context to associate with the task. * @param[in] function_name The name of the function to run. * @param[in] unique Optional unique job identifier, or NULL for a new UUID. * @param[in] workload The workload to pass to the function when it is run. * @param[in] workload_size Size of the workload. * @param[out] ret_ptr Standard gearman return value. * @return On success, a pointer to the (possibly allocated) structure. On * failure this will be NULL. */ GEARMAN_API 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); /** * Add a high priority task to be run in parallel. See * gearman_client_add_task() for details. */ GEARMAN_API 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); /** * Add a low priority task to be run in parallel. See * gearman_client_add_task() for details. */ GEARMAN_API 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); /** * Add a background task to be run in parallel. See * gearman_client_add_task() for details. */ GEARMAN_API 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); /** * Add a high priority background task to be run in parallel. See * gearman_client_add_task() for details. */ GEARMAN_API 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); /** * Add a low priority background task to be run in parallel. See * gearman_client_add_task() for details. */ GEARMAN_API 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); /** * Add task to get the status for a backgound task in parallel. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] task Caller allocated structure, or NULL to allocate one. * @param[in] context Application context to associate with the task. * @param[in] job_handle The job handle to get status for. * @param[out] ret_ptr Standard gearman return value. * @return On success, a pointer to the (possibly allocated) structure. On * failure this will be NULL. */ GEARMAN_API 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); /** * Callback function when workload data needs to be sent for a task. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_workload_fn(gearman_client_st *client, gearman_workload_fn *function); /** * Callback function when a job has been created for a task. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_created_fn(gearman_client_st *client, gearman_created_fn *function); /** * Callback function when there is a data packet for a task. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_data_fn(gearman_client_st *client, gearman_data_fn *function); /** * Callback function when there is a warning packet for a task. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_warning_fn(gearman_client_st *client, gearman_warning_fn *function); /** * Callback function when there is a status packet for a task. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_status_fn(gearman_client_st *client, gearman_universal_status_fn *function); /** * Callback function when a task is complete. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_complete_fn(gearman_client_st *client, gearman_complete_fn *function); /** * Callback function when there is an exception packet for a task. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_exception_fn(gearman_client_st *client, gearman_exception_fn *function); /** * Callback function when a task has failed. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] function Function to call. */ GEARMAN_API void gearman_client_set_fail_fn(gearman_client_st *client, gearman_fail_fn *function); /** * Clear all task callback functions. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). */ GEARMAN_API void gearman_client_clear_fn(gearman_client_st *client); /** * Run tasks that have been added in parallel. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @return Standard gearman return value. */ GEARMAN_API gearman_return_t gearman_client_run_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_API void gearman_client_set_namespace(gearman_client_st *self, const char *namespace_key, size_t namespace_key_size); GEARMAN_API gearman_return_t gearman_client_set_identifier(gearman_client_st *client, const char *id, size_t id_size); const char *gearman_client_namespace(gearman_client_st *self); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/protocol.h0000664000076400007640000001074112107145705020172 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 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, /* J->C: 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_GET_STATUS_UNIQUE, /* C->J: UNIQUE */ GEARMAN_COMMAND_STATUS_RES_UNIQUE, /* J->C: UNIQUE[0]KNOWN[0]RUNNING[0]NUM[0]DENOM[0]CLIENT_COUNT */ GEARMAN_COMMAND_MAX /* Always add new commands before this. */ }; #ifndef __cplusplus typedef enum gearman_command_t gearman_command_t; #endif gearmand-1.0.6/libgearman-1.0/allocator.h0000664000076400007640000000345012107145705020310 0ustar00brianbrian00000000000000/* 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; }; gearmand-1.0.6/libgearman-1.0/result.h0000664000076400007640000000503712121165261017644 0ustar00brianbrian00000000000000/* 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 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_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 gearmand-1.0.6/libgearman-1.0/core.h0000664000076400007640000000352212107145705017260 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 #include gearmand-1.0.6/libgearman-1.0/version.h.in0000664000076400007640000000345312107145705020425 0ustar00brianbrian00000000000000/* 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 "@LIBGEARMAN_VERSION_STRING@" #define LIBGEARMAN_VERSION_HEX @LIBGEARMAN_VERSION_HEX@ gearmand-1.0.6/libgearman-1.0/kill.h0000664000076400007640000000421012107145705017256 0ustar00brianbrian00000000000000/* 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_id_t { int read_fd; int write_fd; }; #ifndef __cplusplus typedef struct gearman_id_t gearman_id_t; #endif #ifdef __cplusplus extern "C" { #endif GEARMAN_API gearman_return_t gearman_kill(const gearman_id_t handle, const gearman_signal_t); GEARMAN_API bool gearman_id_valid(const gearman_id_t handle); GEARMAN_API gearman_id_t gearman_id_initialize(void); #define GEARMAN_ID_INITIALIZER gearman_id_initialize() #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/configure.h0000664000076400007640000000337612107145705020320 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-1.0/signal.h0000664000076400007640000000372312107145705017610 0ustar00brianbrian00000000000000/* 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_signal_t { GEARMAN_SIGNAL_CHECK, GEARMAN_SIGNAL_INTERRUPT, GEARMAN_SIGNAL_KILL, GEARMAN_SIGNAL_KILLWAIT, GEARMAN_INTERRUPT= GEARMAN_SIGNAL_INTERRUPT, GEARMAN_KILL= GEARMAN_SIGNAL_KILL }; #ifndef __cplusplus typedef enum gearman_signal_t gearman_signal_t; #endif gearmand-1.0.6/libgearman-1.0/function.h0000664000076400007640000000612012107145705020152 0ustar00brianbrian00000000000000/* 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_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); GEARMAN_API gearman_function_t gearman_function_create_v2(gearman_function_fn func); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/task_attr.h0000664000076400007640000000507212107145705020326 0ustar00brianbrian00000000000000/* 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); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/visibility.h0000664000076400007640000000642112107145705020520 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Visibility Control Macros */ #ifndef __GEARMAN_VISIBILITY_H #define __GEARMAN_VISIBILITY_H /** * GEARMAN_API is used for the public API symbols. It either DLL imports or * DLL exports (or does nothing for static build). * * GEARMAN_LOCAL is used for non-api symbols. */ #if defined(BUILDING_LIBGEARMAN) # if defined(HAVE_VISIBILITY) # define GEARMAN_API __attribute__ ((visibility("default"))) # define GEARMAN_INTERNAL_API __attribute__ ((visibility("hidden"))) # define GEARMAN_API_DEPRECATED __attribute__ ((deprecated,visibility("default"))) # define GEARMAN_LOCAL __attribute__ ((visibility("hidden"))) # elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define GEARMAN_API __global # define GEARMAN_INTERNAL_API __hidden # define GEARMAN_API_DEPRECATED __global # define GEARMAN_LOCAL __hidden # elif defined(_MSC_VER) # define GEARMAN_API extern __declspec(dllexport) # define GEARMAN_INTERNAL_API extern __declspec(dllexport) # define GEARMAN_DEPRECATED_API extern __declspec(dllexport) # define GEARMAN_LOCAL # endif /* defined(HAVE_VISIBILITY) */ #else /* defined(BUILDING_LIBGEARMAN) */ # if defined(_MSC_VER) # define GEARMAN_API extern __declspec(dllimport) # define GEARMAN_INTERNAL_API extern __declspec(dllimport) # define GEARMAN_API_DEPRECATED extern __declspec(dllimport) # define GEARMAN_LOCAL # else # define GEARMAN_API # define GEARMAN_INTERNAL_API # define GEARMAN_API_DEPRECATED # define GEARMAN_LOCAL # endif /* defined(_MSC_VER) */ #endif /* defined(BUILDING_LIBGEARMAN) */ #endif /* __GEARMAN_VISIBILITY_H */ gearmand-1.0.6/libgearman-1.0/strerror.h0000664000076400007640000000355512107145705020220 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2010-2012 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 Gearman Declarations */ #pragma once #ifdef __cplusplus extern "C" { #endif GEARMAN_API const char *gearman_strerror(gearman_return_t rc); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-1.0/string.h0000664000076400007640000000467012122444522017637 0ustar00brianbrian00000000000000/* 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) #ifndef gearman_literal_param # ifdef __cplusplus # define gearman_literal_param(X) (X), (static_cast((sizeof(X) - 1))) # define gearman_literal_param_size(X) static_cast(sizeof(X) - 1) # endif #endif #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 gearmand-1.0.6/libgearman-1.0/client_callbacks.h0000664000076400007640000000456012107145705021610 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-1.0/return.h0000664000076400007640000001021112107145705017640 0ustar00brianbrian00000000000000/* 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_INVALID_SERVER_OPTION, // Bad server option sent to server GEARMAN_MAX_RETURN, /* Always add new error code before */ GEARMAN_FAIL= GEARMAN_WORK_FAIL, GEARMAN_FATAL= GEARMAN_WORK_FAIL, GEARMAN_ERROR= GEARMAN_WORK_ERROR }; static inline bool gearman_continue(enum gearman_return_t rc) { return rc == GEARMAN_IO_WAIT || rc == GEARMAN_IN_PROGRESS || rc == GEARMAN_PAUSE || rc == GEARMAN_JOB_EXISTS; } static inline bool gearman_failed(enum gearman_return_t rc) { return rc != GEARMAN_SUCCESS; } static inline bool gearman_success(enum gearman_return_t rc) { return rc == GEARMAN_SUCCESS; } #ifndef __cplusplus typedef enum gearman_return_t gearman_return_t; #endif gearmand-1.0.6/libgearman-1.0/version.h0000664000076400007640000000340712142673655020030 0ustar00brianbrian00000000000000/* 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 "1.0.6" #define LIBGEARMAN_VERSION_HEX 0x01000006 gearmand-1.0.6/libgearman-1.0/job_handle.h0000664000076400007640000000335612107145705020422 0ustar00brianbrian00000000000000/* 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]; gearmand-1.0.6/libgearman-1.0/connection.h0000664000076400007640000000514612107145705020473 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 #include #ifdef NI_MAXHOST # define GEARMAN_NI_MAXHOST NI_MAXHOST #else # define GEARMAN_NI_MAXHOST 1025 #endif #ifdef NI_MAXSERV # define GEARMAN_NI_MAXSERV NI_MAXSERV #else # define GEARMAN_NI_MAXSERV 32 #endif /* 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 }; 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 }; enum gearman_con_universal_t { GEARMAN_CON_UNIVERSAL_ADDRINFO, GEARMAN_CON_UNIVERSAL_CONNECT, GEARMAN_CON_UNIVERSAL_CONNECTING, GEARMAN_CON_UNIVERSAL_CONNECTED }; gearmand-1.0.6/benchmark/0000775000076400007640000000000012142673675015525 5ustar00brianbrian00000000000000gearmand-1.0.6/benchmark/include.am0000664000076400007640000000434012107145705017455 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2008 Brian Aker, Eric Day # Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor # 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_PROGRAMS+= benchmark/blobslap_client noinst_PROGRAMS+= benchmark/blobslap_worker noinst_HEADERS+= benchmark/benchmark.h noinst_LTLIBRARIES+= benchmark/libbenchmark.la 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_CXXFLAGS= benchmark_blobslap_worker_LDADD= benchmark_blobslap_worker_LDFLAGS= benchmark_blobslap_worker_SOURCES= benchmark_blobslap_worker_CXXFLAGS+= @BOOST_CPPFLAGS@ benchmark_blobslap_worker_CXXFLAGS+= @PTHREAD_CFLAGS@ benchmark_blobslap_worker_LDADD+= $(BOOST_PROGRAM_OPTIONS_LIBS) benchmark_blobslap_worker_LDADD+= @PTHREAD_LIBS@ benchmark_blobslap_worker_LDADD+= benchmark/libbenchmark.la benchmark_blobslap_worker_LDADD+= libgearman/libgearman.la benchmark_blobslap_worker_LDFLAGS+= $(BOOST_PROGRAM_OPTIONS_LDFLAGS) benchmark_blobslap_worker_SOURCES+= benchmark/blobslap_worker.cc benchmark_blobslap_worker_SOURCES+= util/daemon.cc benchmark_blobslap_worker_SOURCES+= util/logfile.cc benchmark_blobslap_worker_SOURCES+= util/pidfile.cc benchmark_blobslap_worker_SOURCES+= util/signal.cc 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 gearmand-1.0.6/benchmark/blobslap_client.cc0000664000076400007640000002741412107145705021165 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 client utility */ #include "gear_config.h" #include #include #include #include #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 master_client; bool shutdown_worker= false; if (gearman_client_create(&master_client) == NULL) { std::cerr << "Failed to allocate memory for client" << std::endl; return EXIT_FAILURE; } gearman_client_add_options(&master_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(&master_client, host, port))) { std::cerr << "Failed while adding server " << host << ":" << port << " :" << gearman_client_error(&master_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; case '?': gearman_client_free(&master_client); _usage(argv[0]); exit(EXIT_SUCCESS); break; default: gearman_client_free(&master_client); _usage(argv[0]); exit(EXIT_FAILURE); } } if (host == NULL) { if (gearman_failed(gearman_client_add_server(&master_client, NULL, port))) { std::cerr << "Failing to add localhost:" << port << " :" << gearman_client_error(&master_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 { gearman_client_st client; if (gearman_client_clone(&client, &master_client) == NULL) { std::cerr << "Failed to allocate client clone" << std::endl; exit(EXIT_FAILURE); } 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--; gearman_client_free(&client); } while (count or error); exit_immediatly: if (shutdown_worker) { gearman_client_do(&master_client, "shutdown", 0, 0, 0, 0, 0); } delete [] blob; delete [] tasks; gearman_client_free(&master_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_benchmark_st *benchmark= static_cast(gearman_task_context(task)); while (1) { gearman_return_t ret; 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"); } gearmand-1.0.6/benchmark/blobslap_worker.cc0000664000076400007640000002162112107145705021212 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include #include #include "util/daemon.hpp" #include "util/logfile.hpp" #include "util/pidfile.hpp" #include "util/signal.hpp" #include "util/string.hpp" using namespace datadifferential; 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; } static gearman_return_t ping_fn(gearman_job_st*, void* /* context */) { return GEARMAN_SUCCESS; } int main(int args, char *argv[]) { gearman_benchmark_st benchmark; bool opt_daemon; bool opt_chunk; bool opt_status; bool opt_unique; std::string pid_file; std::string log_file; int32_t timeout; uint32_t count= UINT_MAX; in_port_t port; std::string host; std::vector functions; 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.") ("pid-file", boost::program_options::value(&pid_file), "File to write process ID out to.") ("log-file", boost::program_options::value(&log_file), "Create a log file.") ; 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) { util::daemonize(false, true); } util::Pidfile _pid_file(pid_file); if (pid_file.empty() == false) { if (_pid_file.create() == false) { std::cerr << _pid_file.error_message().c_str(); return EXIT_FAILURE; } } if (not log_file.empty()) { FILE *file= fopen(log_file.c_str(), "w+"); if (file == NULL) { std::cerr << "Unable to open:" << log_file << "(" << strerror(errno) << ")" << std::endl; return EXIT_FAILURE; } fclose(file); // We let the error from this happen later (if one was to occur) unlink(log_file.c_str()); } gearman_worker_st *worker; if (not (worker= gearman_worker_create(NULL))) { std::cerr << "Failed to allocate worker" << std::endl; return EXIT_FAILURE; } 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; return EXIT_FAILURE; } benchmark.verbose= static_cast(verbose_string.length()); if (opt_daemon) { util::daemon_is_ready(benchmark.verbose == 0); } util::SignalThread signal(true); util::Logfile log(log_file); if (not log.open()) { std::cerr << "Could not open logfile:" << log_file << std::endl; return EXIT_FAILURE; } if (not signal.setup()) { log.log() << "Failed signal.setup()" << std::endl; return EXIT_FAILURE; } gearman_function_t shutdown_function= gearman_function_create(shutdown_fn); if (gearman_failed(gearman_worker_define_function(worker, util_literal_param("shutdown"), shutdown_function, 0, 0))) { log.log() << "Failed to add shutdown function: " << gearman_worker_error(worker) << std::endl; return EXIT_FAILURE; } gearman_function_t ping_function= gearman_function_create(ping_fn); if (gearman_failed(gearman_worker_define_function(worker, util_literal_param("blobslap_worker_ping"), ping_function, 0, 0))) { log.log() << "Failed to add blobslap_worker_ping function: " << gearman_worker_error(worker) << std::endl; return EXIT_FAILURE; } if (functions.empty() == false) { 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))) { log.log() << "Failed to add default function: " << gearman_worker_error(worker) << std::endl; return EXIT_FAILURE; } } } else { if (gearman_failed(gearman_worker_add_function(worker, GEARMAN_BENCHMARK_DEFAULT_FUNCTION, 0, worker_fn, &benchmark))) { log.log() << "Failed to add default function: " << gearman_worker_error(worker) << std::endl; return 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) { log.log() << "shutdown" << std::endl; } break; } else if (gearman_failed(rc)) { log.log() << "gearman_worker_work(): " << gearman_worker_error(worker) << std::endl; break; } count--; } while(count and (not signal.is_shutdown())); gearman_worker_free(worker); return EXIT_SUCCESS; } 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; } gearmand-1.0.6/benchmark/benchmark.h0000664000076400007640000000505312107145705017620 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Common benchmark header */ #pragma once #include #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #define GEARMAN_BENCHMARK_DEFAULT_FUNCTION "gb" /** * @addtogroup benchmark Common Benchmark Utilities * @{ */ struct gearman_benchmark_st { bool background; uint8_t verbose; uint64_t total_jobs; uint64_t jobs; struct timeval total; struct timeval begin; struct timeval end; 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); gearmand-1.0.6/benchmark/benchmark.cc0000664000076400007640000000543212107145705017757 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Common benchmark functions */ #include "gear_config.h" #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); } } gearmand-1.0.6/tests/0000775000076400007640000000000012142673676014736 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/libgearman-1.0/0000775000076400007640000000000012142673676017333 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/libgearman-1.0/server_options.cc0000664000076400007640000000512012107145705022705 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #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(gearman_client_set_server_option(client, test_literal_param("exceptions"))); test_compare(GEARMAN_SUCCESS, gearman_client_echo(client, test_literal_param("echo"))); return TEST_SUCCESS; } test_return_t gearman_client_set_server_option_bad(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(gearman_client_set_server_option(client, test_literal_param("bad"))); test_compare(GEARMAN_INVALID_SERVER_OPTION, gearman_client_echo(client, test_literal_param("echo"))); return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/execute.cc0000664000076400007640000002146712107145705021302 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #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; test_true(client); const char *worker_function= (const char *)gearman_client_context(client); test_true(worker_function); gearman_task_st *task; gearman_argument_t value= gearman_argument_make(0, 0, test_literal_param("test load")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, NULL, &value, 0)); ASSERT_EQ(test_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_NULL_workload_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(client); const char *worker_function= (const char *)gearman_client_context(client); test_true(worker_function); gearman_task_attr_t task_attr= gearman_task_attr_init_background(GEARMAN_JOB_PRIORITY_NORMAL); gearman_task_st *task; test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, // unique &task_attr, // gearman_task_attr_t NULL, // argument 0)); gearman_task_free(task); return TEST_SUCCESS; } test_return_t gearman_execute_NULL_attr_NULL_workload_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(client); const char *worker_function= (const char *)gearman_client_context(client); test_true(worker_function); gearman_task_st *task; test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, // unique NULL, // gearman_task_attr_t NULL, // argument 0)); 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, test_literal_param("fail")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, NULL, &value, 0)); ASSERT_EQ(GEARMAN_WORK_FAIL, gearman_task_return(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, test_literal_param("test load")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, NULL, &value, 0)); 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); test_true(worker_function); gearman_task_attr_t task_attr= 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, test_literal_param("test load")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, // unique &task_attr, &value, 0)); 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 task_attr= 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, test_literal_param("test load")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, &task_attr, &value, 0)); test_truth(task); test_truth(gearman_task_job_handle(task)); gearman_return_t rc; bool is_known; size_t limit= 10; do { if (--limit) { rc= gearman_client_job_status(client, gearman_task_job_handle(task), &is_known, NULL, NULL, NULL); } else { break; } } while (gearman_continue(rc) or is_known); if (limit) { ASSERT_EQ(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 task_attr= gearman_task_attr_init_background(GEARMAN_JOB_PRIORITY_NORMAL); gearman_task_st *task; gearman_argument_t value= gearman_argument_make(0, 0, test_literal_param("test load")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), test_literal_param("my id"), &task_attr, &value, 0)); // Lets make sure we have a task test_truth(task); test_truth(gearman_task_job_handle(task)); test_true(gearman_success(gearman_client_run_tasks(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 task_attr= gearman_task_attr_init_background(GEARMAN_JOB_PRIORITY_NORMAL); gearman_task_st *task; gearman_argument_t value= gearman_argument_make(0, 0, test_literal_param("test load")); test_true(task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, &task_attr, &value, 0)); // Lets make sure we have a task test_truth(task); test_truth(gearman_task_job_handle(task)); } ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_run_tasks(client)); gearman_client_task_free_all(client); return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/client_test.cc0000664000076400007640000024330412140607662022153 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #define GEARMAN_CORE #include #include "tests/start_worker.h" #include "tests/workers/v1/echo_or_react.h" #include "tests/workers/v1/echo_or_react_chunk.h" #include "tests/workers/v2/echo_or_react.h" #include "tests/workers/v2/echo_or_react_chunk.h" #define NAMESPACE_KEY "foo123" #define WORKER_FUNCTION_NAME "client_test" #define WORKER_CHUNKED_FUNCTION_NAME "reverse_test" #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/limits.h" #include "tests/do.h" #include "tests/server_options.h" #include "tests/do_background.h" #include "tests/execute.h" #include "tests/gearman_client_do_job_handle.h" #include "tests/gearman_execute_partition.h" #include "tests/protocol.h" #include "tests/regression.h" #include "tests/task.h" #include "tests/unique.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #include "tests/runner.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #include "tests/libgearman-1.0/client_test.h" /** @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 */ static 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; } extern "C" { static __attribute__((noreturn)) void *client_thread(void *object) { volatile gearman_return_t *ret= (volatile gearman_return_t *)object; { libgearman::Client client(libtest::default_port()); gearman_return_t rc= gearman_client_add_server(&client, NULL, libtest::default_port()); if (gearman_failed(rc)) { *ret= rc; } else { gearman_client_set_timeout(&client, 400); for (size_t x= 0; x < 5; x++) { size_t result_size; (void)gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, &result_size, &rc); if (gearman_failed(rc)) { *ret= rc; break; } } } } pthread_exit(0); } } #if 0 static void log_2_stderr(const char *line, gearman_verbose_t verbose, void*) { Error << line << " " << gearman_verbose_name(verbose); } #endif 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 *) { { gearman_client_st *client= gearman_client_clone(NULL, NULL); test_truth(client); test_truth(client->options.allocated); gearman_client_free(client); } { gearman_client_st *from= gearman_client_create(NULL); ASSERT_TRUE(from); gearman_client_st* client= gearman_client_clone(NULL, from); ASSERT_TRUE(client); gearman_client_free(client); gearman_client_free(from); } { gearman_client_st *from_with_host= gearman_client_create(NULL); ASSERT_TRUE(from_with_host); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_add_server(from_with_host, "localhost", 12345)); ASSERT_TRUE(from_with_host->universal.con_list); gearman_client_st* client= gearman_client_clone(NULL, from_with_host); ASSERT_TRUE(client); ASSERT_TRUE(client->universal.con_list); ASSERT_TRUE(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); test_true(gear->options.generate_unique); } /* 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); test_true(gear->options.generate_unique); } /* 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); test_true(gear->options.generate_unique); } 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); test_true(gear->options.generate_unique); } } /* 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); } // Test setting GEARMAN_CLIENT_GENERATE_UNIQUE { 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); test_true(gear->options.generate_unique); } gearman_client_remove_options(gear, GEARMAN_CLIENT_GENERATE_UNIQUE); { // 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); test_false(gear->options.generate_unique); } gearman_client_set_options(gear, GEARMAN_CLIENT_GENERATE_UNIQUE); { // 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); test_true(gear->options.generate_unique); } } /* 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); test_true(gear->options.generate_unique); } 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); test_true(gear->options.generate_unique); } 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); test_true(gear->options.generate_unique); } } /* 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= { test_literal_param("This is my echo test") }; ASSERT_EQ(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); test_true(worker_function); gearman_string_t value= { test_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); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_truth(job_result); ASSERT_EQ(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); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_zero(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, test_literal_param("exception"), &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, 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, test_literal_param("warning"), &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, 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); ASSERT_EQ(GEARMAN_WORK_FAIL, rc); 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= uint32_t(random() %3); switch (option) { case 0: ASSERT_EQ(TEST_SUCCESS, submit_null_job_test(object)); break; case 1: ASSERT_EQ(TEST_SUCCESS, submit_job_test(object)); break; default: case 2: ASSERT_EQ(TEST_SUCCESS, submit_exception_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= { test_literal_param("background_test") }; const char *worker_function= (const char *)gearman_client_context(client); test_truth(worker_function); gearman_job_handle_t job_handle; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_do_background(client, worker_function, NULL, gearman_string_param(value), job_handle)); gearman_return_t ret; bool is_known; do { bool is_running; uint32_t numerator; uint32_t denominator; ASSERT_EQ(GEARMAN_SUCCESS, (ret= gearman_client_job_status(client, job_handle, &is_known, &is_running, &numerator, &denominator))); } 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); ASSERT_EQ(TEST_SUCCESS, submit_job_test(object)); ASSERT_EQ(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); ASSERT_EQ(TEST_SUCCESS, submit_job_test(object)); ASSERT_EQ(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); ASSERT_EQ(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= { test_literal_param("background_test") }; const char *worker_function= (const char *)gearman_client_context(client); test_truth(worker_function); gearman_job_handle_t job_handle; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_do_background(client, worker_function, NULL, gearman_string_param(value), job_handle)); 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)); ASSERT_EQ(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, test_literal_param("background_failure_test"), job_handle); ASSERT_EQ(GEARMAN_SUCCESS, rc); 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 ASSERT_EQ(GEARMAN_SUCCESS, rc); return TEST_SUCCESS; } static test_return_t add_servers_test(void *) { libgearman::Client client; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_add_servers(&client, "localhost:4730,localhost")); if (libtest::check_dns()) { ASSERT_EQ(GEARMAN_GETADDRINFO, gearman_client_add_servers(&client, "exist.gearman.info:7003,does_not_exist.gearman.info:12345")); } return TEST_SUCCESS; } static test_return_t hostname_resolution(void *) { test_skip_valgrind(); libgearman::Client client; assert(&client); test_skip(GEARMAN_SUCCESS, gearman_client_add_servers(&client, "exist.gearman.info:12345")); ASSERT_EQ(GEARMAN_SUCCESS, client->universal.error.rc); #if defined(TARGET_OS_FREEBSD) && TARGET_OS_FREEBSD ASSERT_EQ(GEARMAN_TIMEOUT, gearman_client_echo(&client, test_literal_param("foo"))); #else ASSERT_EQ(GEARMAN_COULD_NOT_CONNECT, gearman_client_echo(&client, test_literal_param("foo"))); #endif return TEST_SUCCESS; } static test_return_t gearman_client_st_id_t_TEST(gearman_client_st*) { return TEST_SKIPPED; // @todo, test the internal value of client, no API is available for this // right now. #if 0 gearman_client_st *client= gearman_client_create(NULL); test_true(client); ASSERT_EQ(false, gearman_id_valid(client)); gearman_client_free(client); return TEST_SUCCESS; #endif } static test_return_t gearman_worker_st_id_t_TEST(gearman_client_st*) { gearman_worker_st *worker= gearman_worker_create(NULL); test_true(worker); gearman_id_t id= gearman_worker_id(worker); ASSERT_EQ(true, gearman_id_valid(id)); gearman_worker_free(worker); return TEST_SUCCESS; } static test_return_t bug_518512_test(void *) { size_t result_size; libgearman::Client client(libtest::default_port()); gearman_client_set_timeout(&client, 0); gearman_return_t rc; void *result= gearman_client_do(&client, "client_test_temp", NULL, NULL, 0, &result_size, &rc); ASSERT_EQ(GEARMAN_TIMEOUT, rc); test_false(result); test_zero(result_size); gearman_function_t func_arg= gearman_function_create_v1(client_test_temp_worker); std::auto_ptr completion_worker(test_worker_start(libtest::default_port(), NULL, "client_test_temp", func_arg, NULL, gearman_worker_options_t())); libgearman::Client client2(libtest::default_port()); gearman_client_set_timeout(&client2, -1); result= gearman_client_do(&client2, "client_test_temp", NULL, NULL, 0, &result_size, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_false(result); test_zero(result_size); return TEST_SUCCESS; } #define NUMBER_OF_WORKERS 2 static test_return_t loop_test(void *) { pthread_t one; pthread_t two; 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(libtest::default_port(), NULL, "client_test_temp", func_arg, NULL, gearman_worker_options_t()); } gearman_return_t one_rc= GEARMAN_SUCCESS; pthread_create(&one, NULL, client_thread, &one_rc); gearman_return_t two_rc= GEARMAN_SUCCESS; pthread_create(&two, NULL, client_thread, &two_rc); void *unused; pthread_join(one, &unused); pthread_join(two, &unused); for (size_t x= 0; x < NUMBER_OF_WORKERS; x++) { delete handles[x]; } ASSERT_EQ(GEARMAN_SUCCESS, one_rc); ASSERT_EQ(GEARMAN_SUCCESS, two_rc); return TEST_SUCCESS; } static test_return_t regression_785203_do_test(void *) { libgearman::Client client(libtest::default_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_function_t func= gearman_function_create_v2(echo_or_react_worker_v2); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, func, NULL, gearman_worker_options_t())); gearman_return_t rc; size_t result_length; void *result= gearman_client_do(&client, __func__, NULL, test_literal_param("keep it rocking and sing"), &result_length, &rc); test_true(result); free(result); 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); gearman_function_t echo_react_chunk_fn_v2= gearman_function_create_v2(echo_or_react_worker_v2); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, echo_react_chunk_fn_v2, NULL, gearman_worker_options_t())); libgearman::Client client(libtest::default_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; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_do_background(&client, __func__, NULL, // No unique requested test_literal_param("keep it rocking and sing"), job_handle)); 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)); ASSERT_EQ(GEARMAN_SUCCESS, ret); return TEST_SUCCESS; } static test_return_t regression2_TEST(void *) { libgearman::Client client; size_t result_length; gearman_return_t rc; void *job_result= gearman_client_do(&client, __func__, // Worker does not exist. NULL, // no unique test_literal_param("submit_log_failure"), &result_length, &rc); ASSERT_EQ(GEARMAN_NO_SERVERS, rc); test_false(job_result); test_zero(result_length); return TEST_SUCCESS; } static test_return_t gearman_worker_timeout_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_truth(client); gearman_function_t dreaming_fn= gearman_function_create(echo_or_react_worker_v2); std::auto_ptr worker_handle(test_worker_start(libtest::default_port(), NULL, __func__, dreaming_fn, NULL, gearman_worker_options_t(), 0)); /* The client should get a timeout since the "sleeper" will sleep longer then the timeout. */ size_t result_length; gearman_return_t rc; void *job_result= gearman_client_do(client, __func__, // Our sleeper function NULL, // No unique gearman_literal_param("sleep"), // We send "sleep" to tell the sleeper to sleep &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_true(job_result); ASSERT_EQ(sizeof("slept") -1, result_length); test_memcmp("slept", job_result, 5); free(job_result); return TEST_SUCCESS; } static test_return_t gearman_worker_timeout_TIMEOUT_TEST(void *object) { // This test currently takes to long. test_skip_valgrind(); gearman_client_st *client= (gearman_client_st *)object; test_truth(client); test_truth(ECHO_OR_REACT_DREAM); int timeout= ECHO_OR_REACT_DREAM/4; gearman_function_t dreaming_fn= gearman_function_create(echo_or_react_worker_v2); std::auto_ptr worker_handle(test_worker_start(libtest::default_port(), NULL, __func__, dreaming_fn, NULL, gearman_worker_options_t(), timeout)); /* The client should get a timeout since the "sleeper" will sleep longer then the timeout. */ size_t result_length; gearman_return_t rc; void *job_result= gearman_client_do(client, __func__, // Our sleeper function NULL, // No unique gearman_literal_param("sleep"), // We send "sleep" to tell the sleeper to sleep &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_true(job_result); ASSERT_EQ(sizeof("slept") -1, result_length); test_memcmp("slept", job_result, 5); free(job_result); return TEST_SUCCESS; } static test_return_t regression_975591_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(client); gearman_function_t dreaming_fn= gearman_function_create(echo_or_react_worker_v2); std::auto_ptr worker_handle(test_worker_start(libtest::default_port(), NULL, __func__, dreaming_fn, NULL, gearman_worker_options_t(), 0)); size_t payload_size[] = { 100, 1000, 10000, 1000000, 1000000, 0 }; libtest::vchar_t payload; for (size_t *ptr= payload_size; *ptr; ptr++) { payload.reserve(*ptr); for (size_t x= payload.size(); x < *ptr; x++) { payload.push_back(rand()); } size_t result_length; gearman_return_t rc; char *job_result= (char*)gearman_client_do(client, __func__, NULL, &payload[0], payload.size(), &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); ASSERT_EQ(payload.size(), result_length); test_memcmp(&payload[0], job_result, result_length); free(job_result); } 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 submit_log_failure_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_truth(client); gearman_string_t value= { test_literal_param("submit_log_failure") }; gearman_log_fn *func= log_counter; uint32_t global_counter= 0; gearman_client_set_log_fn(client, func, &global_counter, GEARMAN_VERBOSE_MAX); test_null(client->universal.con_list); const char *worker_function= (const char *)gearman_client_context(client); test_truth(worker_function); size_t result_length; gearman_return_t rc; test_null(client->task); void *job_result= gearman_client_do(client, worker_function, NULL, gearman_string_param(value), &result_length, &rc); ASSERT_EQ(GEARMAN_NO_SERVERS, rc); test_false(job_result); test_zero(result_length); test_null(client->task); test_truth(global_counter); return TEST_SUCCESS; } static test_return_t strerror_count(void *) { ASSERT_EQ((int)GEARMAN_MAX_RETURN, 52); return TEST_SUCCESS; } #undef MAKE_NEW_STRERROR 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, 723914800U }; 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)); ASSERT_EQ_(values[rc], hash_val, "New Value for %s at %d: %uU\n", msg, rc, hash_val); } return TEST_SUCCESS; } #define REGRESSION_FUNCTION_833394_54 "54_char_function_name________________________________" #define REGRESSION_FUNCTION_833394_55 "55_char_function_name_________________________________" #define REGRESSION_FUNCTION_833394_65 "65_char_function_name___________________________________________" static test_return_t regression_833394_test(void *object) { gearman_client_st *client= (gearman_client_st *)object; gearman_function_t echo_react_chunk_fn_v2= gearman_function_create_v2(echo_or_react_worker_v2); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, REGRESSION_FUNCTION_833394_54, echo_react_chunk_fn_v2, NULL, gearman_worker_options_t())); std::auto_ptr handle1(test_worker_start(libtest::default_port(), NULL, REGRESSION_FUNCTION_833394_55, echo_react_chunk_fn_v2, NULL, gearman_worker_options_t())); std::auto_ptr handle2(test_worker_start(libtest::default_port(), NULL, REGRESSION_FUNCTION_833394_65, echo_react_chunk_fn_v2, NULL, gearman_worker_options_t())); for (size_t x= 0; x < 100; x++) { test_true(client); size_t result_length; gearman_return_t rc; char *job_result= (char*)gearman_client_do(client, REGRESSION_FUNCTION_833394_54, NULL, test_literal_param("this should be echo'ed"), &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_true(job_result); ASSERT_EQ(test_literal_param_size("this should be echo'ed"), result_length); free(job_result); } for (size_t x= 0; x < 100; x++) { test_true(client); size_t result_length; gearman_return_t rc; char *job_result= (char*)gearman_client_do(client, REGRESSION_FUNCTION_833394_55, NULL, test_literal_param("this should be echo'ed"), &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_true(job_result); ASSERT_EQ(test_literal_param_size("this should be echo'ed"), result_length); free(job_result); } for (size_t x= 0; x < 100; x++) { test_true(client); size_t result_length; gearman_return_t rc; char *job_result= (char*)gearman_client_do(client, REGRESSION_FUNCTION_833394_65, NULL, test_literal_param("this should be echo'ed"), &result_length, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_true(job_result); ASSERT_EQ(test_literal_param_size("this should be echo'ed"), result_length); free(job_result); } return TEST_SUCCESS; } static test_return_t GEARMAN_SUCCESS_TEST(void*) { ASSERT_EQ(0, int(GEARMAN_SUCCESS)); return TEST_SUCCESS; } static test_return_t GEARMAN_FAIL_COMPAT_TEST(void*) { ASSERT_EQ(GEARMAN_FAIL, GEARMAN_FATAL); ASSERT_EQ(GEARMAN_FAIL, GEARMAN_WORK_FAIL); return TEST_SUCCESS; } static test_return_t GEARMAN_ERROR_COMPAT_TEST(void*) { ASSERT_EQ(GEARMAN_ERROR, GEARMAN_WORK_ERROR); return TEST_SUCCESS; } static test_return_t gearman_client_set_identifier_TEST(void* object) { gearman_client_st *client= (gearman_client_st *)object; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_set_identifier(client, test_literal_param(__func__))); return TEST_SUCCESS; } static test_return_t gearman_client_set_identifier_plus_work_TEST(void* object) { ASSERT_EQ(TEST_SUCCESS, gearman_client_set_identifier_TEST(object)); ASSERT_EQ(TEST_SUCCESS, regression_833394_test(object)); return TEST_SUCCESS; } static test_return_t gearman_client_set_identifier_plus_random_TEST(void* object) { for (size_t x= 0; x < 10; x++) { switch (random() %3) { case 0: ASSERT_EQ(TEST_SUCCESS, gearman_client_set_identifier_TEST(object)); break; case 1: ASSERT_EQ(TEST_SUCCESS, regression_833394_test(object)); break; default: ASSERT_EQ(TEST_SUCCESS, regression_975591_TEST(object)); } } return TEST_SUCCESS; } static test_return_t gearman_client_free_TEST(void *) { gearman_client_free(NULL); return TEST_SUCCESS; } static test_return_t gearman_client_error_TEST(void *) { test_null(gearman_client_error(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_error_no_error_TEST(void *) { libgearman::Client client; test_null(gearman_client_error(&client)); return TEST_SUCCESS; } static test_return_t gearman_client_errno_TEST(void *) { ASSERT_EQ(EINVAL, gearman_client_errno(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_errno_no_error_TEST(void *) { libgearman::Client client; ASSERT_EQ(0, gearman_client_errno(&client)); return TEST_SUCCESS; } static test_return_t gearman_client_options_TEST(void *) { ASSERT_EQ(gearman_client_options_t(), gearman_client_options(NULL)); return TEST_SUCCESS; } static test_return_t __SETUP(client_test_st* test, const gearman_function_t& echo_react_fn) { test_true(test); test->set_worker_name(WORKER_FUNCTION_NAME); test->push(test_worker_start(libtest::default_port(), test->session_namespace(), test->worker_name(), echo_react_fn, NULL, gearman_worker_options_t())); return TEST_SUCCESS; } static test_return_t chunk_v1_SETUP(void *object) { gearman_function_t echo_react_chunk_fn= gearman_function_create_v1(echo_or_react_chunk_worker); ASSERT_EQ(TEST_SUCCESS, __SETUP((client_test_st *)object, echo_react_chunk_fn)); return TEST_SUCCESS; } static test_return_t chunk_v2_SETUP(void *object) { gearman_function_t echo_react_chunk_fn= gearman_function_create_v2(echo_or_react_chunk_worker_v2); ASSERT_EQ(TEST_SUCCESS, __SETUP((client_test_st *)object, echo_react_chunk_fn)); return TEST_SUCCESS; } static test_return_t reset_SETUP(void *object) { client_test_st* test= (client_test_st *)object; test->reset_clone(); return TEST_SUCCESS; } static test_return_t default_v2_SETUP(void *object) { gearman_function_t echo_react_fn= gearman_function_create_v2(echo_or_react_worker_v2); ASSERT_EQ(TEST_SUCCESS, __SETUP((client_test_st *)object, echo_react_fn)); return TEST_SUCCESS; } static test_return_t GEARMAN_CLIENT_GENERATE_UNIQUE_SETUP(void *object) { client_test_st* test= (client_test_st *)object; test_true(test); ASSERT_EQ(TEST_SUCCESS, default_v2_SETUP(object)); gearman_client_remove_options(test->client(), GEARMAN_CLIENT_GENERATE_UNIQUE); test_false(gearman_client_has_option(test->client(), GEARMAN_CLIENT_GENERATE_UNIQUE)); return TEST_SUCCESS; } static test_return_t gearman_client_add_server_localhost_TEST(void*) { libgearman::Client client; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_add_server(&client, "localhost", libtest::default_port())); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(&client, test_literal_param(__func__))); return TEST_SUCCESS; } static test_return_t gearman_client_add_server_empty_quote_TEST(void*) { libgearman::Client client; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_add_server(&client, "", libtest::default_port())); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(&client, test_literal_param(__func__))); return TEST_SUCCESS; } static test_return_t gearman_client_create_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_st* clone; ASSERT_TRUE((clone= gearman_client_create(NULL))); gearman_client_free(clone); return TEST_SUCCESS; } static test_return_t gearman_client_clone_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_st* clone; ASSERT_TRUE((clone= gearman_client_clone(NULL, NULL))); gearman_client_free(clone); return TEST_SUCCESS; } static test_return_t gearman_client_free_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_free(NULL); return TEST_SUCCESS; } static test_return_t gearman_client_error_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_client_error(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_error_code_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_error_code(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_options_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(gearman_client_options_t(GEARMAN_WORKER_MAX), gearman_client_options(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_has_option_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(false, gearman_client_has_option(NULL, GEARMAN_CLIENT_GENERATE_UNIQUE)); return TEST_SUCCESS; } static test_return_t gearman_client_set_options_GEARMAN_INVALID_ARGUMENT_TEST(void*) { // Hopefile valgrind will catch any issues that might crop up here gearman_client_set_options(NULL, GEARMAN_CLIENT_GENERATE_UNIQUE); return TEST_SUCCESS; } static test_return_t gearman_client_add_options_GEARMAN_INVALID_ARGUMENT_TEST(void*) { // Hopefile valgrind will catch any issues that might crop up here gearman_client_add_options(NULL, GEARMAN_CLIENT_GENERATE_UNIQUE); return TEST_SUCCESS; } static test_return_t gearman_client_remove_options_GEARMAN_INVALID_ARGUMENT_TEST(void*) { // Hopefile valgrind will catch any issues that might crop up here gearman_client_remove_options(NULL, GEARMAN_CLIENT_GENERATE_UNIQUE); return TEST_SUCCESS; } static test_return_t gearman_client_timeout_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(-1, gearman_client_timeout(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_set_timeout_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_timeout(NULL, 23); return TEST_SUCCESS; } static test_return_t gearman_client_context_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_client_context(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_set_context_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_context(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_log_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_log_fn(NULL, NULL, NULL, GEARMAN_VERBOSE_FATAL); return TEST_SUCCESS; } static test_return_t gearman_client_set_workload_malloc_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_workload_malloc_fn(NULL, NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_workload_free_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_workload_free_fn(NULL, NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_memory_allocators_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_set_memory_allocators(NULL, NULL, NULL, NULL, NULL, NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_add_server_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_add_server(NULL, NULL, 0)); return TEST_SUCCESS; } static test_return_t gearman_client_remove_servers_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_remove_servers(NULL); return TEST_SUCCESS; } static test_return_t gearman_client_wait_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_wait(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_do_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_do(NULL, NULL, NULL, NULL, 0, NULL, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_do_low_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_do_low(NULL, NULL, NULL, NULL, 0, NULL, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_do_high_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_do_high(NULL, NULL, NULL, NULL, 0, NULL, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_do_job_handle_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_client_do_job_handle(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_do_background_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_do_background(NULL, NULL, NULL, NULL, 0, NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_do_low_background_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_do_low_background(NULL, NULL, NULL, NULL, 0, NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_job_status_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_job_status(NULL, NULL, NULL, NULL, NULL, NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_unique_status_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_status_t status= gearman_client_unique_status(NULL, NULL, 0); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_status_return(status)); return TEST_SUCCESS; } static test_return_t gearman_client_do_high_background_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_do_high_background(NULL, NULL, NULL, NULL, 0, NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_status_by_unique_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_status_by_unique(NULL, NULL, NULL, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_echo_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_echo(NULL, NULL, 0)); return TEST_SUCCESS; } static test_return_t gearman_client_task_free_all_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_task_free_all(NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_task_context_free_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_task_context_free_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task(NULL, NULL, NULL, NULL, NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_high_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_high(NULL, NULL, NULL, NULL, NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_low_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_low(NULL, NULL, NULL, NULL, NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_background_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_background(NULL, NULL, NULL, NULL, NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_high_background_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_high_background(NULL, NULL, NULL, NULL, NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_low_background_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_low_background(NULL, NULL, NULL, NULL, NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_add_task_status_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(NULL, gearman_client_add_task_status(NULL, NULL, NULL, NULL, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_client_set_workload_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_workload_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_created_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_created_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_status_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_status_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_clear_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_clear_fn(NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_fail_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_fail_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_complete_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_complete_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_set_exception_fn_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_exception_fn(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_client_run_tasks_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_run_tasks(NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_compare_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(false, gearman_client_compare(NULL, NULL)); return TEST_SUCCESS; } static test_return_t gearman_client_set_identifier_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_client_set_identifier(NULL, NULL, 0)); return TEST_SUCCESS; } static test_return_t gearman_client_set_namespace_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_namespace(NULL, NULL, 0); return TEST_SUCCESS; } static test_return_t gearman_client_set_server_option_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_client_set_namespace(NULL, NULL, 0); return TEST_SUCCESS; } static test_return_t gearman_task_free_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_task_free(NULL); return TEST_SUCCESS; } static test_return_t gearman_task_context_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_task_context(NULL); return TEST_SUCCESS; } static test_return_t gearman_task_set_context_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_task_set_context(NULL, NULL); return TEST_SUCCESS; } static test_return_t gearman_task_function_name_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_function_name(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_unique_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_unique(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_job_handle_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_job_handle(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_is_known_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(false, gearman_task_is_known(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_is_running_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(false, gearman_task_is_running(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_numerator_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(0, gearman_task_numerator(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_denominator_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(0, gearman_task_denominator(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_give_workload_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_task_give_workload(NULL, NULL, 0); return TEST_SUCCESS; } static test_return_t gearman_task_send_workload_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(0, gearman_task_send_workload(NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_task_data_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_data(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_data_size_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(0, gearman_task_data_size(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_take_data_GEARMAN_INVALID_ARGUMENT_TEST(void*) { size_t taken_space; ASSERT_EQ(NULL, gearman_task_take_data(NULL, &taken_space)); return TEST_SUCCESS; } static test_return_t gearman_task_recv_data_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_return_t ret; ASSERT_EQ(0, gearman_task_recv_data(NULL, NULL, 0, &ret)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, ret); return TEST_SUCCESS; } static test_return_t gearman_task_error_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_error(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_result_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_result(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_return_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_task_return(NULL)); return TEST_SUCCESS; } static test_return_t gearman_task_strstate_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_task_strstate(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_free_GEARMAN_INVALID_ARGUMENT_TEST(void*) { gearman_job_free(NULL); return TEST_SUCCESS; } static test_return_t gearman_job_send_data_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_job_send_data(NULL, NULL, 0)); return TEST_SUCCESS; } static test_return_t gearman_job_send_warning_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_job_send_warning(NULL, NULL, 0)); return TEST_SUCCESS; } static test_return_t gearman_job_send_status_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_job_send_status(NULL, 0, 0)); return TEST_SUCCESS; } static test_return_t gearman_job_send_complete_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_job_send_complete(NULL, 0, 0)); return TEST_SUCCESS; } static test_return_t gearman_job_send_exception_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_job_send_exception(NULL, 0, 0)); return TEST_SUCCESS; } static test_return_t gearman_job_send_fail_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_job_send_fail(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_handle_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_handle(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_function_name_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_function_name(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_unique_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_unique(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_workload_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_unique(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_workload_size_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(0, gearman_job_workload_size(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_take_workload_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_take_workload(NULL, NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_clone_worker_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_clone_worker(NULL)); return TEST_SUCCESS; } static test_return_t gearman_job_error_GEARMAN_INVALID_ARGUMENT_TEST(void*) { ASSERT_EQ(NULL, gearman_job_error(NULL)); return TEST_SUCCESS; } static test_return_t default_v1_SETUP(void *object) { gearman_function_t echo_react_fn= gearman_function_create_v1(echo_or_react_worker); ASSERT_EQ(TEST_SUCCESS, __SETUP((client_test_st *)object, echo_react_fn)); return TEST_SUCCESS; } static test_return_t pre_free_tasks(void *object) { client_test_st *test= (client_test_st *)object; test_true(test); ASSERT_EQ(TEST_SUCCESS, default_v2_SETUP(object)); gearman_client_add_options(test->client(), GEARMAN_CLIENT_FREE_TASKS); test_true(gearman_client_has_option(test->client(), GEARMAN_CLIENT_FREE_TASKS)); return TEST_SUCCESS; } static test_return_t namespace_v1_SETUP(void *object) { client_test_st *test= (client_test_st *)object; test_true(test); test->session_namespace(NAMESPACE_KEY); ASSERT_EQ(TEST_SUCCESS, default_v1_SETUP(object)); return TEST_SUCCESS; } static test_return_t namespace_v2_SETUP(void *object) { client_test_st *test= (client_test_st *)object; test_true(test); test->session_namespace(NAMESPACE_KEY); ASSERT_EQ(TEST_SUCCESS, default_v2_SETUP(object)); return TEST_SUCCESS; } static test_return_t pre_logging(void *object) { client_test_st *test= (client_test_st *)object; test_true(test); test->clear_clone(); test_null(test->client()->universal.con_list); test->set_worker_name(WORKER_FUNCTION_NAME); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t& error) { const char *argv[]= { "--exceptions", 0 }; const char *null_args[]= { 0 }; in_port_t first_port= libtest::default_port(); in_port_t second_port= libtest::get_free_port(); ASSERT_TRUE(server_startup(servers, "gearmand", first_port, argv)); ASSERT_TRUE(server_startup(servers, "gearmand", second_port, null_args)); client_test_st *test= new client_test_st(); test->add_server(NULL, first_port); error= TEST_SUCCESS; return (void *)test; } static bool world_destroy(void *object) { client_test_st *test= (client_test_st *)object; delete test; return TEST_SUCCESS; } test_st gearman_client_add_server_TESTS[] ={ {"gearman_client_add_server(localhost)", 0, gearman_client_add_server_localhost_TEST }, {"gearman_client_add_server(empty quote)", 0, gearman_client_add_server_empty_quote_TEST }, {0, 0, 0} }; test_st gearman_client_st_GEARMAN_INVALID_ARGUMENT_TESTS[] ={ {"gearman_client_create()", 0, gearman_client_create_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_clone()", 0, gearman_client_clone_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_free()", 0, gearman_client_free_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_error()", 0, gearman_client_error_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_error_code()", 0, gearman_client_error_code_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_options()", 0, gearman_client_options_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_has_option()", 0, gearman_client_has_option_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_options()", 0, gearman_client_set_options_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_option()", 0, gearman_client_add_options_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_remove_options()", 0, gearman_client_remove_options_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_timeout()", 0, gearman_client_timeout_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_timeout()", 0, gearman_client_set_timeout_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_context()", 0, gearman_client_context_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_context()", 0, gearman_client_set_context_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_log_fn()", 0, gearman_client_set_log_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_workload_malloc_fn()", 0, gearman_client_set_workload_malloc_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_workload_free_fn()", 0, gearman_client_set_workload_free_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_memory_allocators()", 0, gearman_client_set_memory_allocators_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_server()", 0, gearman_client_add_server_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_remove_servers()", 0, gearman_client_remove_servers_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_wait()", 0, gearman_client_wait_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do()", 0, gearman_client_do_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do_high()", 0, gearman_client_do_high_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do_low()", 0, gearman_client_do_low_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do_job_handle()", 0, gearman_client_do_job_handle_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do_background()", 0, gearman_client_do_background_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do_high_background()", 0, gearman_client_do_high_background_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_do_low_background()", 0, gearman_client_do_low_background_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_job_status()", 0, gearman_client_job_status_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_unique_status()", 0, gearman_client_unique_status_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_status_by_unique()", 0, gearman_client_add_task_status_by_unique_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_echo()", 0, gearman_client_echo_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_task_context_free_fn()", 0, gearman_client_set_task_context_free_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_task_free_all()", 0, gearman_client_task_free_all_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task()", 0, gearman_client_add_task_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_high()", 0, gearman_client_add_task_high_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_low()", 0, gearman_client_add_task_low_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_background()", 0, gearman_client_add_task_background_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_high_background()", 0, gearman_client_add_task_high_background_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_low_background()", 0, gearman_client_add_task_low_background_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_add_task_status()", 0, gearman_client_add_task_status_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_workload_fn()", 0, gearman_client_set_workload_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_created_fn()", 0, gearman_client_set_created_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_status_fn()", 0, gearman_client_set_status_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_complete_fn()", 0, gearman_client_set_complete_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_exception_fn()", 0, gearman_client_set_exception_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_fail_fn()", 0, gearman_client_set_fail_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_clear_fn()", 0, gearman_client_clear_fn_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_run_tasks()", 0, gearman_client_run_tasks_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_compare()", 0, gearman_client_compare_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_server_option()", 0, gearman_client_set_server_option_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_namespace()", 0, gearman_client_set_namespace_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_client_set_identifier()", 0, gearman_client_set_identifier_GEARMAN_INVALID_ARGUMENT_TEST }, {0, 0, 0} }; test_st gearman_task_st_GEARMAN_INVALID_ARGUMENT_TESTS[] ={ {"gearman_task_free()", 0, gearman_task_free_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_context()", 0, gearman_task_context_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_set_context()", 0, gearman_task_set_context_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_function_name()", 0, gearman_task_function_name_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_unique()", 0, gearman_task_unique_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_job_handle()", 0, gearman_task_job_handle_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_is_known()", 0, gearman_task_is_known_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_is_running()", 0, gearman_task_is_running_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_numerator()", 0, gearman_task_numerator_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_denominator()", 0, gearman_task_denominator_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_give_workload()", 0, gearman_task_give_workload_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_send_workload()", 0, gearman_task_send_workload_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_data()", 0, gearman_task_data_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_data_size()", 0, gearman_task_data_size_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_take_data()", 0, gearman_task_take_data_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_recv_data()", 0, gearman_task_recv_data_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_error()", 0, gearman_task_error_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_result()", 0, gearman_task_result_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_return()", 0, gearman_task_return_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_task_strstate()", 0, gearman_task_strstate_GEARMAN_INVALID_ARGUMENT_TEST }, {0, 0, 0} }; test_st gearman_job_st_GEARMAN_INVALID_ARGUMENT_TESTS[] ={ {"gearman_job_free()", 0, gearman_job_free_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_send_data()", 0, gearman_job_send_data_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_send_warning()", 0, gearman_job_send_warning_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_send_statu()", 0, gearman_job_send_status_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_send_complete()", 0, gearman_job_send_complete_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_send_exception()", 0, gearman_job_send_exception_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_send()", 0, gearman_job_send_fail_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_handle()", 0, gearman_job_handle_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_function_name()", 0, gearman_job_function_name_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_unique()", 0, gearman_job_unique_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_workload()", 0, gearman_job_workload_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_workload_size()", 0, gearman_job_workload_size_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_take_workload()", 0, gearman_job_take_workload_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_clone_worker()", 0, gearman_job_clone_worker_GEARMAN_INVALID_ARGUMENT_TEST }, {"gearman_job_error()", 0, gearman_job_error_GEARMAN_INVALID_ARGUMENT_TEST }, {0, 0, 0} }; test_st gearman_client_set_identifier_TESTS[] ={ {"gearman_client_set_identifier()", 0, gearman_client_set_identifier_TEST }, {"gearman_client_set_identifier(with_work)", 0, gearman_client_set_identifier_plus_work_TEST }, {"gearman_client_set_identifier(RANDOM)", 0, gearman_client_set_identifier_plus_random_TEST }, {0, 0, 0} }; test_st gearman_return_t_TESTS[] ={ {"GEARMAN_SUCCESS", 0, (test_callback_fn*)GEARMAN_SUCCESS_TEST }, {"GEARMAN_FAIL == GEARMAN_FATAL == GEARMAN_WORK_FAIL", 0, (test_callback_fn*)GEARMAN_FAIL_COMPAT_TEST }, {"GEARMAN_ERROR == GEARMAN_WORK_ERROR", 0, (test_callback_fn*)GEARMAN_ERROR_COMPAT_TEST }, {0, 0, 0} }; test_st gearman_id_t_TESTS[] ={ {"gearman_client_st", 0, (test_callback_fn*)gearman_client_st_id_t_TEST }, {"gearman_worker_st", 0, (test_callback_fn*)gearman_worker_st_id_t_TEST }, {0, 0, 0} }; test_st gearman_client_st_init_TESTS[] ={ {"init", 0, init_test }, {"allocation", 0, allocation_test }, {"clone_test", 0, clone_test }, {"echo", 0, echo_test }, {"options", 0, option_test }, {0, 0, 0} }; test_st gearman_client_st_TESTS[] ={ {"submit_job", 0, submit_job_test }, {"submit_null_job", 0, submit_null_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 }, {"gearman_client_add_servers(GEARMAN_GETADDRINFO)", 0, hostname_resolution }, {"submit_fail_job", 0, submit_fail_job_test }, // Since this drops the worker, it must be last {0, 0, 0} }; test_st loop_TESTS[] ={ {"loop_test", 0, loop_test }, {0, 0, 0} }; test_st coalescence_TESTS[] ={ {"basic coalescence", 0, coalescence_TEST }, {"coalescence by hash", 0, coalescence_by_data_hash_TEST }, {"coalescence by data", 0, coalescence_by_data_TEST }, {"coalescence by data fail", 0, coalescence_by_data_FAIL_TEST }, {0, 0, 0} }; test_st gearman_command_t_tests[] ={ {"gearman_command_t", 0, check_gearman_command_t }, {0, 0, 0} }; test_st gearman_worker_timeout_TESTS[] ={ {"gearman_worker_timeout(0)", 0, gearman_worker_timeout_TEST }, {"gearman_worker_timeout(DEFAULT_TIMEOUT)", 0, gearman_worker_timeout_TIMEOUT_TEST }, {0, 0, 0} }; test_st tests_log_TESTS[] ={ {"submit_log_failure", 0, submit_log_failure_TEST }, {0, 0, 0} }; test_st regression2_TESTS[] ={ {"stale client", 0, regression2_TEST }, {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 }, {"gearman_client_unique_status(NOT_FOUND)", 0, gearman_client_unique_status_NOT_FOUND_TEST }, {"gearman_client_unique_status()", 0, gearman_client_unique_status_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[] ={ #if 0 {"lp:768317", 0, regression_768317_test }, #endif {"lp:785203 gearman_client_do()", 0, regression_785203_do_test }, {"lp:785203 gearman_client_do_background()", 0, regression_785203_do_background_test }, {"lp:833394 long function names", 0, regression_833394_test }, {"lp:975591 Increase the work size past the standard buffer size", 0, regression_975591_TEST }, {"lp:518512", 0, bug_518512_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() 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 }, {"gearman_execute() with NULL workload", 0, gearman_execute_NULL_workload_TEST }, {"gearman_execute() with NULL workload", 0, gearman_execute_NULL_attr_NULL_workload_TEST }, {"gearman_execute(GEARMAN_WORK_FAIL)", 0, gearman_execute_fail_test }, // Fail test must be run last {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 }, #if 0 {"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 }, #endif {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() 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() exception check returned string", 0, gearman_client_add_task_check_exception_TEST}, {"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}, {"gearman_client_add_task_status_by_unique(NOT_FOUND)", 0, gearman_client_add_task_status_by_unique_NOT_FOUND_TEST }, {"gearman_client_add_task_status_by_unique()", 0, gearman_client_add_task_status_by_unique_TEST }, {"gearman_client_add_task() fail", 0, gearman_client_add_task_test_fail}, // Fail needs to go last {0, 0, 0} }; test_st gearman_client_st_NULL_invocation_TESTS[] ={ {"gearman_client_free()", 0, gearman_client_free_TEST }, {"gearman_client_error()", 0, gearman_client_error_TEST }, {"gearman_client_error() no error", 0, gearman_client_error_no_error_TEST }, {"gearman_client_errno()", 0, gearman_client_errno_TEST }, {"gearman_client_errno() no error", 0, gearman_client_errno_no_error_TEST }, {"gearman_client_options()", 0, gearman_client_options_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} }; test_st limit_tests[] ={ {"GEARMAN_FUNCTION_MAX_SIZE", 0, function_name_limit_test}, {"GEARMAN_UNIQUE_MAX_SIZE", 0, unique_name_limit_test}, {0, 0, 0} }; collection_st collection[] ={ {"gearman_return_t", 0, 0, gearman_return_t_TESTS}, {"gearman_client_st GEARMAN_INVALID_ARGUMENT", 0, 0, gearman_client_st_GEARMAN_INVALID_ARGUMENT_TESTS }, {"gearman_task_st GEARMAN_INVALID_ARGUMENT", 0, 0, gearman_task_st_GEARMAN_INVALID_ARGUMENT_TESTS }, {"gearman_job_st GEARMAN_INVALID_ARGUMENT", 0, 0, gearman_job_st_GEARMAN_INVALID_ARGUMENT_TESTS }, {"gearman_id_t", 0, 0, gearman_id_t_TESTS}, {"gearman_strerror()", 0, 0, gearman_strerror_tests }, {"gearman_client_st init", 0, 0, gearman_client_st_init_TESTS }, {"gearman_client_add_server()", 0, 0, gearman_client_add_server_TESTS }, {"gearman_client_st", default_v2_SETUP, 0, gearman_client_st_TESTS}, {"gearman_client_st chunky", chunk_v1_SETUP, 0, gearman_client_st_TESTS}, // Test with a worker that will respond in part {"gearman_task_add_task() v1 workers", default_v1_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task() v2 workers", default_v2_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task() namespace v1", namespace_v1_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task() namespace v2", namespace_v2_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task() chunky v1 workers", chunk_v1_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task() chunky v2 workers", chunk_v2_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, 0, gearman_task_tests}, {"gearman_task_add_task(GEARMAN_CLIENT_GENERATE_UNIQUE)", GEARMAN_CLIENT_GENERATE_UNIQUE_SETUP, 0, gearman_task_tests}, {"gearman_task_add_task(GEARMAN_PAUSE)", chunk_v1_SETUP, 0, gearman_task_pause_tests}, {"gearman_task_add_task(GEARMAN_PAUSE)", chunk_v2_SETUP, 0, gearman_task_pause_tests}, {"unique", unique_SETUP, 0, unique_tests}, {"gearman_client_set_workload_malloc_fn()", default_v2_SETUP, 0, gearman_client_set_workload_malloc_fn_tests}, {"gearman_client_do()", default_v2_SETUP, 0, gearman_client_do_tests}, {"gearman_client_do() namespace v1", namespace_v1_SETUP, 0, gearman_client_do_tests}, {"gearman_client_do() namespace v2", namespace_v2_SETUP, 0, gearman_client_do_tests}, {"gearman_client_do(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, 0, gearman_client_do_tests}, {"gearman_client_do_job_handle()", default_v2_SETUP, 0, gearman_client_do_job_handle_tests}, {"gearman_client_do_job_handle() namespace v1", namespace_v1_SETUP, 0, gearman_client_do_job_handle_tests}, {"gearman_client_do_job_handle() namespace v2", namespace_v2_SETUP, 0, gearman_client_do_job_handle_tests}, {"gearman_client_do_job_handle(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, 0, gearman_client_do_job_handle_tests}, {"gearman_client_do_background()", default_v2_SETUP, 0, gearman_client_do_background_tests}, {"gearman_client_do_background(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, 0, gearman_client_do_background_tests}, {"gearman_client_set_server_option", 0, 0, gearman_client_set_server_option_tests}, {"gearman_execute()", default_v2_SETUP, 0, gearman_execute_tests}, {"gearman_execute(GEARMAN_CLIENT_FREE_TASKS)", pre_free_tasks, 0, gearman_execute_tests}, {"gearman_execute() chunked v1 return", chunk_v1_SETUP, 0, gearman_execute_tests}, {"gearman_execute() chunked v2 return", chunk_v2_SETUP, 0, gearman_execute_tests}, {"gearman_execute_partition()", partition_SETUP, 0, gearman_execute_partition_tests}, {"gearman_execute_partition(GEARMAN_CLIENT_FREE_TASKS)", partition_free_SETUP, 0, gearman_execute_partition_tests}, {"gearman_command_t", 0, 0, gearman_command_t_tests}, {"coalescence", 0, 0, coalescence_TESTS}, {"loop", 0, 0, loop_TESTS}, {"limits", 0, 0, limit_tests }, {"client-logging", pre_logging, 0, tests_log_TESTS }, {"regression", 0, 0, regression_tests}, {"regression2", reset_SETUP, 0, regression2_TESTS }, {"gearman_worker_timeout()", default_v2_SETUP, 0, gearman_worker_timeout_TESTS }, {"gearman_client_set_identifier()", default_v2_SETUP, 0, gearman_client_set_identifier_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); world->set_runner(new GearmandRunner); } gearmand-1.0.6/tests/libgearman-1.0/include.am0000664000076400007640000001442212107145705021264 0ustar00brianbrian00000000000000# vim:ft=automake noinst_HEADERS+= tests/libgearman-1.0/client_test.h noinst_HEADERS+= tests/libgearman-1.0/gearman_client_job_status_by_unique.h noinst_HEADERS+= tests/libgearman-1.0/multi_client_test.h LIBGEARMAN_1_0_CLIENT_LDADD= LIBGEARMAN_1_0_CLIENT_LDADD+= libgearman/libgearman.la LIBGEARMAN_1_0_CLIENT_LDADD+= libtest/libtest.la LIBGEARMAN_1_0_CLIENT_LDADD+= tests/libstartworker.la tests_libgearman_1_0_client_test_CXXFLAGS= tests_libgearman_1_0_client_test_SOURCES= tests_libgearman_1_0_client_test_LDADD= tests_libgearman_1_0_client_test_CXXFLAGS+= $(BOOST_CPPFLAGS) tests_libgearman_1_0_client_test_CXXFLAGS+= @PTHREAD_CFLAGS@ tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/client_test.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/do.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/do_background.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/execute.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/gearman_client_do_job_handle.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/gearman_client_job_status_by_unique.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/gearman_execute_partition.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/limits.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/protocol.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/server_options.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/task.cc tests_libgearman_1_0_client_test_SOURCES+= tests/libgearman-1.0/unique.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/aggregator/cat.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v1/echo_or_react.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v1/echo_or_react_chunk.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v1/unique.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v2/call_exception.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v2/echo_or_react.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v2/echo_or_react_chunk.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v2/sleep_return_random.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v2/split.cc tests_libgearman_1_0_client_test_SOURCES+= tests/workers/v2/unique.cc tests_libgearman_1_0_client_test_LDADD+= ${LIBGEARMAN_1_0_CLIENT_LDADD} tests_libgearman_1_0_client_test_LDADD+= @PTHREAD_LIBS@ check_PROGRAMS+=tests/libgearman-1.0/client_test noinst_PROGRAMS+=tests/libgearman-1.0/client_test tests_libgearman_1_0_multi_client_test_CXXFLAGS= tests_libgearman_1_0_multi_client_test_SOURCES= tests_libgearman_1_0_multi_client_test_LDADD= tests_libgearman_1_0_multi_client_test_SOURCES+= tests/libgearman-1.0/multi_client_test.cc tests_libgearman_1_0_multi_client_test_LDADD+= ${LIBGEARMAN_1_0_CLIENT_LDADD} check_PROGRAMS+=tests/libgearman-1.0/multi_client_test noinst_PROGRAMS+=tests/libgearman-1.0/multi_client_test test-multi-client: tests/libgearman-1.0/multi_client_test gearmand/gearmand @tests/libgearman-1.0/multi_client_test gdb-multi-client: tests/libgearman-1.0/multi_client_test gearmand/gearmand @$(GDB_COMMAND) tests/libgearman-1.0/multi_client_test valgrind-multi-client: tests/libgearman-1.0/multi_client_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/libgearman-1.0/multi_client_test tests_libgearman_1_0_internals_test_SOURCES= tests_libgearman_1_0_internals_test_LDADD= tests_libgearman_1_0_internals_test_SOURCES+= tests/libgearman-1.0/internals.cc tests_libgearman_1_0_internals_test_SOURCES+= tests/libgearman-1.0/regression.cc tests_libgearman_1_0_internals_test_LDADD+= ${LIBGEARMAN_1_0_CLIENT_LDADD} tests_libgearman_1_0_internals_test_LDADD+= libgearman/libgearmancore.la check_PROGRAMS+= tests/libgearman-1.0/internals_test noinst_PROGRAMS+= tests/libgearman-1.0/internals_test tests_libgearman_1_0_worker_test_LDADD= tests_libgearman_1_0_worker_test_SOURCES= tests_libgearman_1_0_worker_test_SOURCES+= tests/libgearman-1.0/worker_test.cc tests_libgearman_1_0_worker_test_SOURCES+= tests/workers/v2/echo_or_react.cc tests_libgearman_1_0_worker_test_SOURCES+= tests/workers/v2/echo_or_react_chunk.cc tests_libgearman_1_0_worker_test_LDADD+= ${LIBGEARMAN_1_0_CLIENT_LDADD} tests_libgearman_1_0_worker_test_LDADD+= libgearman/libgearmancore.la check_PROGRAMS+=tests/libgearman-1.0/worker_test noinst_PROGRAMS+=tests/libgearman-1.0/worker_test test-internals: tests/libgearman-1.0/internals_test gearmand/gearmand @tests/libgearman-1.0/internals_test gdb-internals: tests/libgearman-1.0/internals_test gearmand/gearmand @$(GDB_COMMAND) tests/libgearman-1.0/internals_test helgrind-internals: tests/internals_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/libgearman-1.0/internals_test valgrind-internals: tests/libgearman-1.0/internals_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/libgearman-1.0/internals_test valgrind-worker: tests/libgearman-1.0/worker_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/libgearman-1.0/worker_test massif-worker: tests/libgearman-1.0/worker_test gearmand/gearmand @$(MASSIF_COMMAND) tests/libgearman-1.0/worker_test helgrind-worker: tests/libgearman-1.0/worker_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/libgearman-1.0/worker_test gdb-worker: tests/libgearman-1.0/worker_test gearmand/gearmand @$(GDB_COMMAND) tests/libgearman-1.0/worker_test ptrdiff-worker: tests/libgearman-1.0/worker_test gearmand/gearmand @$(PTRCHECK_COMMAND) tests/libgearman-1.0/worker_test test-worker: tests/libgearman-1.0/worker_test gearmand/gearmand @tests/libgearman-1.0/worker_test test-client: tests/libgearman-1.0/client_test gearmand/gearmand @tests/libgearman-1.0/client_test gdb-client: tests/libgearman-1.0/client_test gearmand/gearmand @$(GDB_COMMAND) tests/libgearman-1.0/client_test valgrind-client: tests/libgearman-1.0/client_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/libgearman-1.0/client_test tests_libgearman_1_0_1077917_SOURCES= tests/libgearman-1.0/1077917.c tests_libgearman_1_0_1077917_LDADD= libgearman/libgearman.la check_PROGRAMS+= tests/libgearman-1.0/1077917 noinst_PROGRAMS+= tests/libgearman-1.0/1077917 valgrind-1077917: tests/libgearman-1.0/1077917 @$(VALGRIND_COMMAND) --leak-check=full --show-reachable=yes --track-origins=yes tests/libgearman-1.0/1077917 gearmand-1.0.6/tests/libgearman-1.0/do_background.cc0000664000076400007640000000772012107145705022435 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #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, test_literal_param("foobar"), job_handle); ASSERT_EQ(GEARMAN_SUCCESS, rc); 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, test_literal_param("foobar"), job_handle); ASSERT_EQ(GEARMAN_SUCCESS, rc); 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, test_literal_param("foobar"), job_handle); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_truth(job_handle[0]); return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/worker_test.cc0000664000076400007640000012302412140513350022170 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include "libgearman/packet.hpp" #include "libgearman/universal.hpp" #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/start_worker.h" #include "tests/workers/v2/echo_or_react.h" #include "tests/workers/v2/echo_or_react_chunk.h" 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; } static test_return_t sanity_TEST(void *) { // Sanity test on initial enum ASSERT_EQ(0, int(GEARMAN_SUCCESS)); ASSERT_EQ(1, int(GEARMAN_IO_WAIT)); return TEST_SUCCESS; } #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t gearman_worker_clone_NULL_NULL(void *) { gearman_worker_st *worker= gearman_worker_clone(NULL, NULL); test_truth(worker); ASSERT_EQ(true, worker->options.allocated); gearman_worker_free(worker); return TEST_SUCCESS; } static test_return_t gearman_worker_clone_NULL_SOURCE(void *) { libgearman::Worker source; gearman_worker_st *worker= gearman_worker_clone(NULL, &source); test_truth(worker); ASSERT_EQ(true, worker->options.allocated); gearman_worker_free(worker); return TEST_SUCCESS; } static test_return_t gearman_worker_timeout_default_test(void *) { libgearman::Worker worker; ASSERT_EQ(-1, gearman_worker_timeout(&worker)); return TEST_SUCCESS; } static test_return_t gearman_worker_free_TEST(void *) { gearman_worker_free(NULL); return TEST_SUCCESS; } static test_return_t gearman_worker_error_TEST(void *) { test_null(gearman_worker_error(NULL)); return TEST_SUCCESS; } static test_return_t gearman_worker_error_no_error_TEST(void *) { libgearman::Worker worker; test_null(gearman_worker_error(&worker)); return TEST_SUCCESS; } static test_return_t gearman_worker_errno_TEST(void *) { ASSERT_EQ(EINVAL, gearman_worker_errno(NULL)); return TEST_SUCCESS; } static test_return_t gearman_worker_errno_no_error_TEST(void *) { libgearman::Worker worker; ASSERT_EQ(0, gearman_worker_errno(&worker)); return TEST_SUCCESS; } static test_return_t gearman_worker_options_TEST(void *) { ASSERT_EQ(gearman_worker_options_t(), gearman_worker_options(NULL)); 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*) { libgearman::Worker worker; ASSERT_EQ(gearman_worker_echo(&worker, test_literal_param("This is my echo test")), GEARMAN_SUCCESS); return TEST_SUCCESS; } static test_return_t echo_multi_test(void *) { libgearman::Worker 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) { ASSERT_EQ(gearman_worker_echo(&worker, test_string_make_from_cstr(*ptr)), GEARMAN_SUCCESS); ptr++; } return TEST_SUCCESS; } static test_return_t gearman_worker_add_server_GEARMAN_INVALID_ARGUMENT_TEST(void *) { if (libtest::check_dns()) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_worker_add_server(NULL, "nonexist.gearman.info", libtest::default_port())); } return TEST_SUCCESS; } static test_return_t gearman_worker_add_server_GEARMAN_GETADDRINFO_TEST(void *) { if (libtest::check_dns()) { gearman_worker_st *worker= gearman_worker_create(NULL); test_true(worker); ASSERT_EQ(gearman_worker_add_server(worker, "nonexist.gearman.info", libtest::default_port()), GEARMAN_GETADDRINFO); gearman_worker_free(worker); } return TEST_SUCCESS; } static test_return_t echo_max_test(void *) { libgearman::Worker worker(libtest::default_port());; ASSERT_EQ(GEARMAN_ARGUMENT_TOO_LARGE, gearman_worker_echo(&worker, "This is my echo test", GEARMAN_MAX_ECHO_SIZE +1)); return TEST_SUCCESS; } // The idea is to return GEARMAN_ERROR until we hit limit, then return // GEARMAN_SUCCESS static gearman_return_t GEARMAN_ERROR_worker(gearman_job_st* job, void *context) { assert(gearman_job_workload_size(job) == 0); assert(gearman_job_workload(job) == NULL); size_t *ret= (size_t*)context; if (*ret > 0) { *ret= (*ret) -1; return GEARMAN_ERROR; } if (gearman_failed(gearman_job_send_data(job, test_literal_param("OK")))) { // We should return ERROR here, but that would then possibly loop return GEARMAN_FAIL; } return GEARMAN_SUCCESS; } static gearman_return_t error_return_worker(gearman_job_st* job, void *) { assert(sizeof(gearman_return_t) == gearman_job_workload_size(job)); const gearman_return_t *ret= (const gearman_return_t*)gearman_job_workload(job); if (gearman_failed(gearman_job_send_data(job, gearman_strerror(*ret), strlen(gearman_strerror(*ret))))) { return GEARMAN_ERROR; } return *ret; } static test_return_t error_return_TEST(void *) { libgearman::Client client(libtest::default_port()); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(&client, test_literal_param(__func__))); libgearman::Worker worker(libtest::default_port()); ASSERT_EQ(gearman_worker_register(&worker, __func__, 0), GEARMAN_SUCCESS); gearman_task_attr_t task_attr= gearman_task_attr_init_background(GEARMAN_JOB_PRIORITY_NORMAL); std::vector job_handles; job_handles.resize(int(GEARMAN_MAX_RETURN)); for (gearman_return_t x= GEARMAN_IO_WAIT; int(x) < int(GEARMAN_MAX_RETURN); x= gearman_return_t((int(x) +1))) { if (x == GEARMAN_SHUTDOWN) { continue; } if (x == GEARMAN_WORK_ERROR) { continue; } gearman_argument_t arg= gearman_argument_make(NULL, 0, (const char*)&x, sizeof(gearman_return_t)); gearman_task_st *task= gearman_execute(&client, test_literal_param(__func__), NULL, 0, // unique &task_attr, // gearman_task_attr_t &arg, // gearman_argument_t NULL); // context test_truth(task); bool is_known; ASSERT_EQ(gearman_client_job_status(&client, gearman_task_job_handle(task), &is_known, NULL, NULL, NULL), GEARMAN_SUCCESS); test_true(is_known); job_handles[int(x)].append(gearman_task_job_handle(task)); } gearman_function_t error_return_TEST_FN= gearman_function_create(error_return_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, error_return_TEST_FN, NULL, gearman_worker_options_t(), 0)); // timeout for (gearman_return_t x= GEARMAN_IO_WAIT; int(x) < int(GEARMAN_MAX_RETURN); x= gearman_return_t((int(x) +1))) { if (x == GEARMAN_SHUTDOWN) { continue; } if (x == GEARMAN_WORK_ERROR) { continue; } bool is_known; gearman_return_t rc; do { rc= gearman_client_job_status(&client, job_handles[int(x)].c_str(), &is_known, NULL, NULL, NULL); } while (gearman_continue(rc) or is_known); test_false(handle->is_shutdown()); } return TEST_SUCCESS; } static test_return_t GEARMAN_ERROR_return_TEST(void *) { libgearman::Client client(libtest::default_port()); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(&client, test_literal_param(__func__))); size_t count= 0; gearman_function_t GEARMAN_ERROR_FN= gearman_function_create(GEARMAN_ERROR_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, GEARMAN_ERROR_FN, &count, gearman_worker_options_t(), 0)); // timeout for (size_t x= 0; x < 24; x++) { count= x; gearman_task_st *task= gearman_execute(&client, test_literal_param(__func__), NULL, 0, // unique NULL, // gearman_task_attr_t NULL, // gearman_argument_t NULL); // context test_truth(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); ASSERT_EQ(gearman_task_return(task), GEARMAN_SUCCESS); test_zero(count); // Since we hit zero we know that we ran enough times. gearman_result_st *result= gearman_task_result(task); test_true(result); test_memcmp("OK", gearman_result_value(result), strlen("ok")); } return TEST_SUCCESS; } static test_return_t GEARMAN_FAIL_return_TEST(void *) { libgearman::Client client(libtest::default_port()); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(&client, test_literal_param(__func__))); gearman_function_t error_return_TEST_FN= gearman_function_create(error_return_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, error_return_TEST_FN, NULL, gearman_worker_options_t(), 0)); // timeout int count= 3; while(--count) { gearman_return_t x= GEARMAN_FAIL; gearman_argument_t arg= gearman_argument_make(NULL, 0, (const char*)&x, sizeof(gearman_return_t)); gearman_task_st *task= gearman_execute(&client, test_literal_param(__func__), NULL, 0, // unique NULL, // gearman_task_attr_t &arg, // gearman_argument_t NULL); // context test_truth(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); { ASSERT_EQ(GEARMAN_FAIL, gearman_task_return(task)); } } return TEST_SUCCESS; } static test_return_t gearman_client_job_status_is_known_TEST(void *) { libgearman::Client client(libtest::default_port()); libgearman::Worker worker(libtest::default_port()); ASSERT_EQ(gearman_worker_register(&worker, __func__, 0), GEARMAN_SUCCESS); gearman_job_handle_t job_handle; ASSERT_EQ(gearman_client_do_background(&client, __func__, NULL, NULL, 0, job_handle), GEARMAN_SUCCESS); bool is_known; ASSERT_EQ(gearman_client_job_status(&client, job_handle, &is_known, NULL, NULL, NULL), GEARMAN_SUCCESS); test_true(is_known); gearman_function_t echo_or_react_worker_v2_FN= gearman_function_create(echo_or_react_worker_v2); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, echo_or_react_worker_v2_FN, NULL, gearman_worker_options_t(), 0)); // timeout 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]; { libgearman::Client client(libtest::default_port()); ASSERT_EQ(gearman_client_do_background(&client, "abandoned_worker", NULL, NULL, 0, job_handle), GEARMAN_SUCCESS); } /* Now take job with one worker. */ gearman_universal_st universal; gearman_universal_initialize(universal); gearman_connection_st *connection1; test_truth(connection1= gearman_connection_create(universal, NULL)); connection1->set_host(NULL, libtest::default_port()); gearman_packet_st packet; args[0]= "abandoned_worker"; args_size[0]= strlen("abandoned_worker"); ASSERT_EQ(GEARMAN_SUCCESS, gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CAN_DO, args, args_size, 1)); ASSERT_EQ(connection1->send_packet(packet, true), GEARMAN_SUCCESS); gearman_packet_free(&packet); gearman_return_t ret; ASSERT_EQ(GEARMAN_SUCCESS, gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_GRAB_JOB, NULL, NULL, 0)); ASSERT_EQ(GEARMAN_SUCCESS, connection1->send_packet(packet, true)); gearman_packet_free(&packet); connection1->receiving(packet, ret, false); test_truth(not (ret != GEARMAN_SUCCESS or packet.command != GEARMAN_COMMAND_JOB_ASSIGN)); test_strcmp(job_handle, packet.arg[0]); // unexepcted job gearman_packet_free(&packet); gearman_connection_st *connection2; test_truth(connection2= gearman_connection_create(universal, NULL)); connection2->set_host(NULL, libtest::default_port()); args[0]= "abandoned_worker"; args_size[0]= strlen("abandoned_worker"); ASSERT_EQ(GEARMAN_SUCCESS, gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_CAN_DO, args, args_size, 1)); ASSERT_EQ(GEARMAN_SUCCESS, connection2->send_packet(packet, true)); gearman_packet_free(&packet); args[0]= job_handle; args_size[0]= strlen(job_handle) + 1; args[1]= "test"; args_size[1]= 4; ASSERT_EQ(GEARMAN_SUCCESS, gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_WORK_COMPLETE, args, args_size, 2)); ASSERT_EQ(GEARMAN_SUCCESS, connection2->send_packet(packet, true)); gearman_packet_free(&packet); gearman_universal_set_timeout(universal, 1000); connection2->receiving(packet, ret, false); test_truth(not (ret != GEARMAN_SUCCESS or packet.command != GEARMAN_COMMAND_ERROR)); delete connection1; delete connection2; 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 *) { libgearman::Worker worker; char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, function_name,0, fail_worker, NULL)); ASSERT_EQ(true, gearman_worker_function_exist(&worker, test_string_make_from_array(function_name))); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, function_name)); ASSERT_EQ(false, gearman_worker_function_exist(&worker, function_name, strlen(function_name))); /* Make sure we have removed it */ ASSERT_EQ(GEARMAN_NO_REGISTERED_FUNCTION, gearman_worker_unregister(&worker, function_name)); return TEST_SUCCESS; } static test_return_t gearman_worker_add_function_multi_test(void *) { libgearman::Worker worker; for (uint32_t x= 0; x < 100; x++) { char buffer[1024]; snprintf(buffer, 1024, "%u%s", x, __func__); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, buffer, 0, fail_worker, NULL)); } for (uint32_t x= 0; x < 100; x++) { char buffer[1024]; snprintf(buffer, 1024, "%u%s", x, __func__); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, buffer)); } for (uint32_t x= 0; x < 100; x++) { char buffer[1024]; snprintf(buffer, 1024, "%u%s", x, __func__); ASSERT_EQ(GEARMAN_NO_REGISTERED_FUNCTION, gearman_worker_unregister(&worker, buffer)); } return TEST_SUCCESS; } static test_return_t gearman_worker_unregister_all_test(void *) { libgearman::Worker worker; for (uint32_t x= 0; x < 100; x++) { char buffer[1024]; snprintf(buffer, sizeof(buffer), "%u%s", x, __func__); gearman_return_t rc= gearman_worker_add_function(&worker, buffer, 0, fail_worker, NULL); ASSERT_EQ(rc, GEARMAN_SUCCESS); } ASSERT_EQ(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, __func__); gearman_return_t rc= gearman_worker_unregister(&worker, buffer); ASSERT_EQ(rc, GEARMAN_NO_REGISTERED_FUNCTION); } ASSERT_EQ(gearman_worker_unregister_all(&worker), GEARMAN_NO_REGISTERED_FUNCTIONS); return TEST_SUCCESS; } static test_return_t gearman_worker_work_with_test(int timeout, gearman_worker_options_t option) { libgearman::Worker worker; if (option) { gearman_worker_add_options(&worker, option); if (option == GEARMAN_WORKER_NON_BLOCKING) { test_true(worker->options.non_blocking); } } char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); ASSERT_EQ(gearman_worker_add_function(&worker, function_name, 0, fail_worker, NULL), GEARMAN_SUCCESS); gearman_worker_set_timeout(&worker, timeout); if (option == GEARMAN_WORKER_NON_BLOCKING) { ASSERT_EQ(GEARMAN_NO_JOBS, gearman_worker_work(&worker)); ASSERT_EQ(GEARMAN_NO_JOBS, gearman_worker_work(&worker)); } else { ASSERT_EQ(GEARMAN_TIMEOUT, gearman_worker_work(&worker)); ASSERT_EQ(GEARMAN_TIMEOUT, gearman_worker_work(&worker)); } /* Make sure we have removed the worker function */ ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, function_name)); return TEST_SUCCESS; } static test_return_t gearman_worker_work_with_option(gearman_worker_options_t option) { int timeout[]= { 500, 1000, 2000, 8000, 0 }; // First we try with immediate timeout ASSERT_EQ(TEST_SUCCESS, gearman_worker_work_with_test(0, option)); for (size_t x= 0; timeout[x]; ++x) { ASSERT_EQ(TEST_SUCCESS, gearman_worker_work_with_test(timeout[x], option)); } return TEST_SUCCESS; } static test_return_t gearman_worker_work_with_TEST(void*) { return gearman_worker_work_with_option(gearman_worker_options_t()); } static test_return_t gearman_worker_work_with_GEARMAN_WORKER_NON_BLOCKING_TEST(void*) { return gearman_worker_work_with_option(GEARMAN_WORKER_NON_BLOCKING); } static test_return_t gearman_worker_context_test(void *) { libgearman::Worker 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_check_options_GEARMAN_WORKER_GRAB_UNIQ(void *) { libgearman::Worker worker; test_true(worker->options.grab_uniq); return TEST_SUCCESS; } static test_return_t gearman_worker_remove_options_GEARMAN_WORKER_GRAB_UNIQ(void *) { libgearman::Worker worker(libtest::default_port()); char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); char unique_name[GEARMAN_MAX_UNIQUE_SIZE]; snprintf(unique_name, GEARMAN_MAX_UNIQUE_SIZE, "_%s%d", __func__, int(random())); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, function_name, 0, no_unique_worker, NULL)); { libgearman::Client client(libtest::default_port()); ASSERT_EQ(gearman_client_do_background(&client, function_name, unique_name, test_string_make_from_array(unique_name), NULL), GEARMAN_SUCCESS); } gearman_worker_remove_options(&worker, GEARMAN_WORKER_GRAB_UNIQ); test_false(worker->options.grab_uniq); gearman_worker_set_timeout(&worker, 800); gearman_return_t rc; gearman_job_st *job= gearman_worker_grab_job(&worker, NULL, &rc); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_truth(job); size_t size= 0; void *result= no_unique_worker(job, NULL, &size, &rc); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_false(result); test_false(size); return TEST_SUCCESS; } static test_return_t gearman_worker_add_options_GEARMAN_WORKER_GRAB_UNIQ(void *) { char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); char unique_name[GEARMAN_MAX_UNIQUE_SIZE]; snprintf(unique_name, GEARMAN_MAX_UNIQUE_SIZE, "_%s%d", __func__, int(random())); { libgearman::Client client(libtest::default_port()); ASSERT_EQ(gearman_client_do_background(&client, function_name, unique_name, test_string_make_from_array(unique_name), NULL), GEARMAN_SUCCESS); } libgearman::Worker worker(libtest::default_port()); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, function_name, 0, check_unique_worker, NULL)); gearman_worker_add_options(&worker, GEARMAN_WORKER_GRAB_UNIQ); test_true(worker->options.grab_uniq); gearman_return_t rc; gearman_job_st *job= gearman_worker_grab_job(&worker, NULL, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_truth(job); size_t size= 0; void *result= check_unique_worker(job, NULL, &size, &rc); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_truth(result); test_truth(size); free(result); return TEST_SUCCESS; } static test_return_t gearman_worker_set_identifier_TEST(void *) { libgearman::Worker worker(libtest::default_port()); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_set_identifier(&worker, test_literal_param(__func__))); return TEST_SUCCESS; } static test_return_t gearman_worker_add_options_GEARMAN_WORKER_GRAB_UNIQ_worker_work(void *) { libgearman::Worker worker(libtest::default_port()); char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); char unique_name[GEARMAN_MAX_UNIQUE_SIZE]; snprintf(unique_name, GEARMAN_MAX_UNIQUE_SIZE, "_%s%d", __func__, int(random())); bool success= false; ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, function_name, 0, check_unique_worker, &success)); { libgearman::Client client(libtest::default_port()); ASSERT_EQ(gearman_client_do_background(&client, function_name, unique_name, test_string_make_from_array(unique_name), NULL), GEARMAN_SUCCESS); } test_true(worker->options.grab_uniq); gearman_worker_add_options(&worker, GEARMAN_WORKER_GRAB_UNIQ); test_truth(worker->options.grab_uniq); gearman_worker_set_timeout(&worker, 400); ASSERT_EQ(gearman_worker_work(&worker), GEARMAN_SUCCESS); test_truth(success); return TEST_SUCCESS; } static test_return_t _increase_TEST(gearman_function_t &func, gearman_client_options_t options, size_t block_size) { libgearman::Client client(libtest::default_port()); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(&client, test_literal_param(__func__))); gearman_client_add_options(&client, options); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, func, NULL, gearman_worker_options_t(), 0)); // timeout size_t max_block_size= 4; if (libtest::is_massive()) { max_block_size= 24; } for (size_t x= 1; x < max_block_size; ++x) { if (valgrind_is_caller() and (x * block_size) > 15728640) { continue; } libtest::vchar_t workload; libtest::vchar::make(workload, x * block_size); gearman_argument_t value= gearman_argument_make(0, 0, vchar_param(workload)); gearman_task_st *task= gearman_execute(&client, test_literal_param(__func__), NULL, 0, // unique NULL, // gearman_task_attr_t &value, // gearman_argument_t NULL); // context test_truth(task); gearman_return_t rc; do { rc= gearman_client_run_tasks(&client); if (options) { gearman_client_wait(&client); } } while (gearman_continue(rc)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(task)); gearman_result_st *result= gearman_task_result(task); test_true(result); ASSERT_EQ(gearman_result_size(result), workload.size()); } return TEST_SUCCESS; } static test_return_t gearman_client_run_tasks_increase_TEST(void*) { gearman_function_t func= gearman_function_create(echo_or_react_worker_v2); return _increase_TEST(func, gearman_client_options_t(), 1024 * 1024); } static test_return_t gearman_client_run_tasks_increase_GEARMAN_CLIENT_NON_BLOCKING_TEST(void*) { gearman_function_t func= gearman_function_create(echo_or_react_worker_v2); return _increase_TEST(func, GEARMAN_CLIENT_NON_BLOCKING, 1024 * 1024); } static test_return_t gearman_client_run_tasks_increase_chunk_TEST(void*) { gearman_function_t func= gearman_function_create(echo_or_react_chunk_worker_v2); return _increase_TEST(func, gearman_client_options_t(), 1024); } static test_return_t gearman_worker_failover_test(void *) { libgearman::Worker worker(libtest::default_port()); // Now add a port which we do not have a server running on ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_server(&worker, NULL, libtest::default_port() +1)); char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, function_name, 0, fail_worker, NULL)); gearman_worker_set_timeout(&worker, 400); ASSERT_EQ(GEARMAN_TIMEOUT, gearman_worker_work(&worker)); /* Make sure we have remove worker function */ ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, function_name)); return TEST_SUCCESS; } static test_return_t gearman_worker_set_timeout_FAILOVER_TEST(void *) { test_skip_valgrind(); // lp:961904 in_port_t known_server_port= libtest::default_port(); libgearman::Worker worker(known_server_port); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_server(&worker, NULL, known_server_port)); char function_name[GEARMAN_FUNCTION_MAX_SIZE]; snprintf(function_name, GEARMAN_FUNCTION_MAX_SIZE, "_%s%d", __func__, int(random())); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_add_function(&worker, function_name, 0, fail_worker, NULL)); gearman_worker_set_timeout(&worker, 2); ASSERT_EQ(GEARMAN_TIMEOUT, gearman_worker_work(&worker)); /* Make sure we have remove worker function */ ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, function_name)); return TEST_SUCCESS; } /*********************** World functions **************************************/ static void *world_create(server_startup_st& servers, test_return_t& error) { if (server_startup(servers, "gearmand", libtest::default_port(), NULL) == false) { error= TEST_SKIPPED; return NULL; } return NULL; } test_st worker_TESTS[] ={ {"init", 0, init_test }, {"allocation", 0, allocation_test }, {"sanity", 0, sanity_TEST }, {"gearman_worker_clone(NULL, NULL)", 0, gearman_worker_clone_NULL_NULL }, {"gearman_worker_clone(NULL, source)", 0, gearman_worker_clone_NULL_SOURCE }, {"gearman_worker_add_server(GEARMAN_GETADDRINFO)", false, gearman_worker_add_server_GEARMAN_GETADDRINFO_TEST }, {"gearman_worker_add_server(GEARMAN_INVALID_ARGUMENT)", false, gearman_worker_add_server_GEARMAN_INVALID_ARGUMENT_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_work(GEARMAN_WORKER_NON_BLOCKING) with timout", 0, gearman_worker_work_with_GEARMAN_WORKER_NON_BLOCKING_TEST }, {"gearman_worker_context", 0, gearman_worker_context_test }, {"gearman_worker_failover", 0, gearman_worker_failover_test }, {"gearman_worker_check_options(GEARMAN_WORKER_GRAB_UNIQ)", 0, gearman_worker_check_options_GEARMAN_WORKER_GRAB_UNIQ }, {"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 }, {"gearman_worker_set_timeout(2) with failover", 0, gearman_worker_set_timeout_FAILOVER_TEST }, {"gearman_return_t worker return coverage", 0, error_return_TEST }, {"gearman_return_t GEARMAN_FAIL worker coverage", 0, GEARMAN_FAIL_return_TEST }, {"gearman_return_t GEARMAN_ERROR worker coverage", 0, GEARMAN_ERROR_return_TEST }, {"gearman_client_run_tasks()", 0, gearman_client_run_tasks_increase_TEST }, {"gearman_client_run_tasks() GEARMAN_CLIENT_NON_BLOCKING", 0, gearman_client_run_tasks_increase_GEARMAN_CLIENT_NON_BLOCKING_TEST }, {"gearman_client_run_tasks() chunked", 0, gearman_client_run_tasks_increase_chunk_TEST }, {"gearman_client_job_status(is_known)", 0, gearman_client_job_status_is_known_TEST }, {"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} }; test_st gearman_worker_st_NULL_invocation_TESTS[] ={ {"gearman_worker_free()", 0, gearman_worker_free_TEST }, {"gearman_worker_error()", 0, gearman_worker_error_TEST }, {"gearman_worker_error() no error", 0, gearman_worker_error_no_error_TEST }, {"gearman_worker_errno()", 0, gearman_worker_errno_TEST }, {"gearman_worker_errno() no error", 0, gearman_worker_errno_no_error_TEST }, {"gearman_worker_options()", 0, gearman_worker_options_TEST }, {0, 0, 0} }; test_st gearman_worker_set_identifier_TESTS[] ={ {"gearman_worker_set_identifier()", 0, gearman_worker_set_identifier_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"worker", 0, 0, worker_TESTS}, {"worker defaults", 0, 0, worker_defaults}, {"null gearman_worker_st invocation", 0, 0, gearman_worker_st_NULL_invocation_TESTS }, {"gearman_worker_set_identifier()", 0, 0, gearman_worker_set_identifier_TESTS}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); } gearmand-1.0.6/tests/libgearman-1.0/multi_client_test.cc0000664000076400007640000001535512107145705023366 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2013 Keyur Govande * Copyright (C) 2011-2012 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #define GEARMAN_CORE #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #include "tests/runner.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #include "tests/libgearman-1.0/multi_client_test.h" #define SECOND_SERVER_PORT_OFFSET 2 static const char *server_argv[]= { "--exceptions", 0 }; static test_return_t multi_client_test(void *object) { multi_client_test_st *test_client= (multi_client_test_st*)object; test_truth(test_client); server_startup_st& server_container= test_client->server_container(); // make a client that connects to both servers. gearman_client_st *client_to_both= test_client->connected_to_both_client(); test_truth(client_to_both); (void)gearman_client_set_context(client_to_both, const_cast("nothing")); gearman_string_t value= { test_literal_param("background_test") }; const char *worker_function= (const char *)gearman_client_context(client_to_both); test_truth(worker_function); // queue up first job const char* unique_1= "unique_1"; gearman_job_handle_t job_handle; test_compare(GEARMAN_SUCCESS, gearman_client_do_background(client_to_both, worker_function, unique_1, gearman_string_param(value), job_handle)); { gearman_return_t ret; bool is_known; test_compare(GEARMAN_SUCCESS, (ret= gearman_client_job_status(client_to_both, job_handle, &is_known, NULL, NULL, NULL))); test_true(is_known); } // all OK. now shut down the gearmand server 1 in_port_t gearmand_port_1= test_client->port(0); in_port_t gearmand_port_2= test_client->port(1); test_true(server_container.shutdown(0)); // Try to queue up a job again const char* unique_2= "unique_2"; test_compare(GEARMAN_LOST_CONNECTION, gearman_client_do_background(client_to_both, worker_function, unique_2, gearman_string_param(value), job_handle)); const char* unique_3= "unique_3"; test_compare(GEARMAN_SUCCESS, gearman_client_do_background(client_to_both, worker_function, unique_3, gearman_string_param(value), job_handle)); // The job unique_2 is truly lost, but unique_3 will end up at the gearmand server 2 gearman_client_st *client_to_1= test_client->connected_to_1_client(); gearman_client_st *client_to_2= test_client->connected_to_2_client(); // First confirming that cannot connect to server 1 { gearman_status_t unique_3_status= gearman_client_unique_status(client_to_1, unique_3, strlen(unique_3)); test_compare(GEARMAN_COULD_NOT_CONNECT, gearman_status_return(unique_3_status)); } // Next, proving that the job is present on server 2. { gearman_status_t unique_3_status= gearman_client_unique_status(client_to_2, unique_3, strlen(unique_3)); test_compare(GEARMAN_SUCCESS, gearman_status_return(unique_3_status)); test_true(gearman_status_is_known(unique_3_status)); } // Bring server 1 back up server_container.shutdown(); test_true(server_startup(server_container, "gearmand", gearmand_port_1, server_argv)); test_true(server_startup(server_container, "gearmand", gearmand_port_2, server_argv)); // Try adding in a new job. const char* unique_4= "unique_4"; test_compare(GEARMAN_SUCCESS, gearman_client_do_background(client_to_both, worker_function, unique_4, gearman_string_param(value), job_handle)); // Next, proving that the job is present on server 1, but we got a timeout instead! { gearman_status_t unique_4_status= gearman_client_unique_status(client_to_both, unique_4, strlen(unique_4)); test_compare(GEARMAN_SUCCESS, gearman_status_return(unique_4_status)); test_true(gearman_status_is_known(unique_4_status)); } return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { multi_client_test_st *test= new multi_client_test_st(servers, 1000); // setting a default timeout ASSERT_TRUE(test); test->push_port(libtest::get_free_port()); test->push_port(libtest::get_free_port()); ASSERT_TRUE(server_startup(servers, "gearmand", test->port(0), server_argv)); ASSERT_TRUE(server_startup(servers, "gearmand", test->port(1), server_argv)); test->add_server("127.0.0.1", test->port(0), "127.0.0.1", test->port(1)); return (void *)test; } static bool world_destroy(void *object) { multi_client_test_st *test= (multi_client_test_st *)object; delete test; return TEST_SUCCESS; } test_st multi_client_TESTS[] ={ {"multi_client_test", 0, multi_client_test }, {0, 0, 0} }; collection_st collection[] ={ {"multi_client", 0, 0, multi_client_TESTS}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/libgearman-1.0/unique.cc0000664000076400007640000005232212120666021021132 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/libgearman-1.0/client_test.h" #include "tests/workers/v1/unique.h" #include "tests/workers/v2/sleep_return_random.h" #include "tests/workers/v2/echo_or_react.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #define WORKER_UNIQUE_FUNCTION_NAME "unique_test" test_return_t unique_SETUP(void *object) { client_test_st *test= (client_test_st *)object; test->set_worker_name(WORKER_UNIQUE_FUNCTION_NAME); gearman_function_t unique_worker_arg= gearman_function_create_v1(unique_worker); test->push(test_worker_start(libtest::default_port(), NULL, test->worker_name(), unique_worker_arg, NULL, GEARMAN_WORKER_GRAB_UNIQ)); return TEST_SUCCESS; } test_return_t coalescence_TEST(void *object) { gearman_client_st *client_one= (gearman_client_st *)object; test_true(client_one); libgearman::Client client_two(client_one); const char* unique_handle= "local_handle"; gearman_function_t sleep_return_random_worker_FN= gearman_function_create(sleep_return_random_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, sleep_return_random_worker_FN, NULL, gearman_worker_options_t(), 0)); // timeout // First task gearman_return_t ret; gearman_task_st *first_task= gearman_client_add_task(client_one, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique NULL, 0, // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(first_task); test_true(gearman_task_unique(first_task)); ASSERT_EQ(strlen(unique_handle), strlen(gearman_task_unique(first_task))); // Second task gearman_task_st *second_task= gearman_client_add_task(&client_two, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique NULL, 0, // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(second_task); test_true(gearman_task_unique(second_task)); ASSERT_EQ(strlen(unique_handle), strlen(gearman_task_unique(second_task))); test_strcmp(gearman_task_unique(first_task), gearman_task_unique(second_task)); do { ret= gearman_client_run_tasks(client_one); gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); do { ret= gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); gearman_result_st* first_result= gearman_task_result(first_task); gearman_result_st* second_result= gearman_task_result(second_task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(first_task)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(second_task)); ASSERT_EQ(gearman_result_value(first_result), gearman_result_value(second_result)); gearman_task_free(first_task); gearman_task_free(second_task); return TEST_SUCCESS; } test_return_t coalescence_by_data_hash_TEST(void *object) { gearman_client_st *client_one= (gearman_client_st *)object; test_true(client_one); libgearman::Client client_two(client_one); const char* unique_handle= "#"; gearman_function_t sleep_return_random_worker_FN= gearman_function_create(sleep_return_random_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, sleep_return_random_worker_FN, NULL, gearman_worker_options_t(), 0)); // timeout // First task gearman_return_t ret; gearman_task_st *first_task= gearman_client_add_task(client_one, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique test_literal_param(__func__), // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(first_task); test_true(gearman_task_unique(first_task)); ASSERT_EQ(strlen("2285535048"), strlen(gearman_task_unique(first_task))); // Second task gearman_task_st *second_task= gearman_client_add_task(&client_two, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique test_literal_param(__func__), // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(second_task); test_true(gearman_task_unique(second_task)); ASSERT_EQ(strlen("2285535048"), strlen(gearman_task_unique(second_task))); test_strcmp(gearman_task_unique(first_task), gearman_task_unique(second_task)); test_strcmp("2285535048", gearman_task_unique(second_task)); do { ret= gearman_client_run_tasks(client_one); gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); do { ret= gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); gearman_result_st* first_result= gearman_task_result(first_task); gearman_result_st* second_result= gearman_task_result(second_task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(first_task)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(second_task)); ASSERT_EQ(gearman_result_value(first_result), gearman_result_value(second_result)); gearman_task_free(first_task); gearman_task_free(second_task); return TEST_SUCCESS; } test_return_t coalescence_by_data_TEST(void *object) { gearman_client_st *client_one= (gearman_client_st *)object; test_true(client_one); libgearman::Client client_two(client_one); const char* unique_handle= "-"; gearman_function_t sleep_return_random_worker_FN= gearman_function_create(sleep_return_random_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, sleep_return_random_worker_FN, NULL, gearman_worker_options_t(), 0)); // timeout // First task gearman_return_t ret; gearman_task_st *first_task= gearman_client_add_task(client_one, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique NULL, 0, // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(first_task); test_true(gearman_task_unique(first_task)); ASSERT_EQ(strlen(unique_handle), strlen(gearman_task_unique(first_task))); // Second task gearman_task_st *second_task= gearman_client_add_task(&client_two, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique NULL, 0, // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(second_task); test_true(gearman_task_unique(second_task)); ASSERT_EQ(strlen(unique_handle), strlen(gearman_task_unique(second_task))); test_strcmp(gearman_task_unique(first_task), gearman_task_unique(second_task)); do { ret= gearman_client_run_tasks(client_one); gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); do { ret= gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); gearman_result_st* first_result= gearman_task_result(first_task); gearman_result_st* second_result= gearman_task_result(second_task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(first_task)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(second_task)); ASSERT_EQ(gearman_result_value(first_result), gearman_result_value(second_result)); gearman_task_free(first_task); gearman_task_free(second_task); return TEST_SUCCESS; } test_return_t coalescence_by_data_FAIL_TEST(void *object) { gearman_client_st *client_one= (gearman_client_st *)object; test_true(client_one); libgearman::Client client_two(client_one); const char* unique_handle= "-"; gearman_function_t sleep_return_random_worker_FN= gearman_function_create(sleep_return_random_worker); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, sleep_return_random_worker_FN, NULL, gearman_worker_options_t(), 0)); // timeout // First task gearman_return_t ret; gearman_task_st *first_task= gearman_client_add_task(client_one, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique NULL, 0, // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(first_task); test_true(gearman_task_unique(first_task)); ASSERT_EQ(strlen(unique_handle), strlen(gearman_task_unique(first_task))); // Second task gearman_task_st *second_task= gearman_client_add_task(&client_two, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique test_literal_param("mine"), // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(second_task); test_true(gearman_task_unique(second_task)); ASSERT_EQ(strlen(unique_handle), strlen(gearman_task_unique(second_task))); test_strcmp(gearman_task_unique(first_task), gearman_task_unique(second_task)); do { ret= gearman_client_run_tasks(client_one); gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); do { ret= gearman_client_run_tasks(&client_two); } while (gearman_continue(ret)); gearman_result_st* first_result= gearman_task_result(first_task); gearman_result_st* second_result= gearman_task_result(second_task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(first_task)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(second_task)); ASSERT_EQ(gearman_result_value(first_result), gearman_result_value(second_result)); gearman_task_free(first_task); gearman_task_free(second_task); return TEST_SUCCESS; } 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= { test_literal_param("my little unique") }; void *job_result= gearman_client_do(client, worker_function, // function gearman_c_str(unique), // unique gearman_string_param(unique), //workload &job_length, // result size &rc); ASSERT_EQ(rc, GEARMAN_SUCCESS); ASSERT_EQ(gearman_size(unique), job_length); test_memcmp(gearman_c_str(unique), job_result, job_length); free(job_result); return TEST_SUCCESS; } test_return_t gearman_client_unique_status_TEST(void *object) { gearman_client_st *original_client= (gearman_client_st *)object; libgearman::Client status_client(original_client); libgearman::Client client_one(original_client); libgearman::Client client_two(original_client); libgearman::Client client_three(original_client); const char* unique_handle= "local_handle4"; gearman_return_t ret; // First task gearman_task_st *first_task= gearman_client_add_task_background(&client_one, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique test_literal_param("first_task"), // workload &ret); test_true(first_task); gearman_task_st *second_task= gearman_client_add_task_background(&client_two, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique test_literal_param("second_task"), // workload &ret); test_true(second_task); gearman_task_st *third_task= gearman_client_add_task_background(&client_three, NULL, // preallocated task NULL, // context __func__, // function unique_handle, // unique test_literal_param("third_task"), // workload &ret); test_true(third_task); { ASSERT_EQ(gearman_client_run_tasks(&client_one), GEARMAN_SUCCESS); ASSERT_EQ(gearman_client_run_tasks(&client_two), GEARMAN_SUCCESS); ASSERT_EQ(gearman_client_run_tasks(&client_three), GEARMAN_SUCCESS); } ASSERT_EQ(gearman_client_job_status(&status_client, gearman_task_job_handle(third_task), // job handle NULL, // is_known NULL, // is_running NULL, // numerator NULL // denominator ), GEARMAN_JOB_EXISTS); { libgearman::Client unique_client(original_client); gearman_status_t status= gearman_client_unique_status(&unique_client, unique_handle, strlen(unique_handle)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_status_return(status)); } { gearman_status_t status= gearman_client_unique_status(&client_one, unique_handle, strlen(unique_handle)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_status_return(status)); ASSERT_EQ(true, gearman_status_is_known(status)); ASSERT_EQ(false, gearman_status_is_running(status)); test_zero(gearman_status_numerator(status)); test_zero(gearman_status_denominator(status)); } gearman_function_t func= gearman_function_create_v2(echo_or_react_worker_v2); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, func, NULL, gearman_worker_options_t())); { ASSERT_EQ(gearman_client_run_tasks(&client_one), GEARMAN_SUCCESS); ASSERT_EQ(gearman_client_run_tasks(&client_two), GEARMAN_SUCCESS); ASSERT_EQ(gearman_client_run_tasks(&client_three), GEARMAN_SUCCESS); } gearman_task_free(first_task); gearman_task_free(second_task); gearman_task_free(third_task); return TEST_SUCCESS; } test_return_t gearman_client_unique_status_NOT_FOUND_TEST(void *object) { gearman_client_st *original_client= (gearman_client_st *)object; libgearman::Client status_client(original_client); const char* unique_handle= YATL_UNIQUE; gearman_function_t func= gearman_function_create_v2(echo_or_react_worker_v2); std::auto_ptr handle(test_worker_start(libtest::default_port(), NULL, __func__, func, NULL, gearman_worker_options_t())); { gearman_status_t status= gearman_client_unique_status(&status_client, unique_handle, strlen(unique_handle)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_status_return(status)); ASSERT_EQ(false, gearman_status_is_known(status)); ASSERT_EQ(false, gearman_status_is_running(status)); test_zero(gearman_status_numerator(status)); test_zero(gearman_status_denominator(status)); } return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/gearman_client_do_job_handle.cc0000664000076400007640000000566612107145705025442 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #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_zero(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); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_true(gearman_client_do_job_handle(client)); test_truth(job_result); ASSERT_EQ(value_length, job_length); test_memcmp(value, job_result, value_length); free(job_result); return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/do.cc0000664000076400007640000000752412107145705020240 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #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; 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); void *job_result= gearman_client_do(client, worker_function, buffer, test_literal_param("gearman_client_do_huge_unique"), &job_length, &rc); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, rc); test_null(job_result); test_zero(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, test_literal_param("test load")); test_true(epoch_task= gearman_execute(client, test_string_make_from_cstr(worker_function), NULL, 0, &work_description, &value, 0)); test_truth(epoch_task); test_truth(gearman_task_job_handle(epoch_task)); } gearman_string_t value= { test_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); ASSERT_EQ(GEARMAN_SUCCESS, rc); test_truth(job_result); ASSERT_EQ(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; } gearmand-1.0.6/tests/libgearman-1.0/internals.cc0000664000076400007640000002765612125243252021641 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include using namespace libtest; #include #include #include #define GEARMAN_CORE #include "libgearman/common.h" #include "libgearman/packet.hpp" #include "libgearman/universal.hpp" #include "tests/regression.h" #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() { } }; static test_return_t init_test(void *) { gearman_universal_st gear; gearman_universal_initialize(gear); ASSERT_FALSE(gear.options.non_blocking); ASSERT_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.non_blocking == gear.options.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); ASSERT_EQ(-1, gearman_universal_timeout(universal)); // Current default gearman_universal_set_timeout(universal, 20); ASSERT_EQ(20, gearman_universal_timeout(universal)); // New value of 20 gearman_universal_set_timeout(universal, 10); ASSERT_EQ(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); ASSERT_FALSE(error); ASSERT_EQ(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 ASSERT_FALSE(universal.options.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.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); ASSERT_FALSE(universal._namespace); gearman_universal_set_namespace(universal, gearman_literal_param("foo23")); ASSERT_TRUE(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); ASSERT_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.non_blocking); } test_truth(gearman_universal_is_non_blocking(universal)); gearman_universal_initialize(universal); { // Initial Allocated, no changes ASSERT_FALSE(universal.options.non_blocking); } gearman_universal_add_options(universal, GEARMAN_DONT_TRACK_PACKETS); { // Initial Allocated, no changes ASSERT_FALSE(universal.options.non_blocking); } gearman_universal_remove_options(universal, GEARMAN_DONT_TRACK_PACKETS); { // Initial Allocated, no changes ASSERT_FALSE(universal.options.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); ASSERT_FALSE(connection_ptr->options.ready); ASSERT_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); ASSERT_FALSE(connection_ptr->options.ready); ASSERT_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); ASSERT_FALSE(packet.options.allocated); ASSERT_FALSE(packet_ptr->options.allocated); ASSERT_FALSE(packet.options.complete); ASSERT_FALSE(packet.options.free_data); test_truth(packet_ptr == &packet); gearman_packet_free(packet_ptr); ASSERT_FALSE(packet.options.allocated); return TEST_SUCCESS; } static test_return_t gearman_packet_give_data_test(void *) { // @note Since this is a give data, ignore any errors that believe there is // an implicit memory leak. size_t data_size= test_literal_param_size("Mine!"); char *data= (char *)calloc(sizeof(char), data_size +1); test_true(data); memcpy(data, "Mine!", data_size); 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); ASSERT_EQ(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 *) { // Since this is a take data, ignore any errors that believe there is an // implicit memory leak. size_t data_size= test_literal_param_size("Mine!"); char *data= (char *)calloc(sizeof(char), data_size +1); test_true(data); memcpy(data, "Mine!", data_size); 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); ASSERT_EQ(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); ASSERT_FALSE(packet_ptr->data); test_zero(packet_ptr->data_size); ASSERT_FALSE(packet_ptr->options.free_data); test_strcmp(mine, "Mine!"); ASSERT_EQ(data_size, mine_size); gearman_packet_free(packet_ptr); gearman_universal_free(universal); free(mine); 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(server_startup_st& servers, test_return_t& error) { /** We start up everything before we allocate so that we don't have to track memory in the forked process. */ if (server_startup(servers, "gearmand", libtest::default_port(), NULL) == false) { error= TEST_SKIPPED; return NULL; } return NULL; } void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); } gearmand-1.0.6/tests/libgearman-1.0/client_test.h0000664000076400007640000000660212127430346022011 0ustar00brianbrian00000000000000/* 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 struct client_test_st; #include "tests/start_worker.h" #include "libgearman/client.hpp" struct client_test_st { org::gearmand::libgearman::Client _client; gearman_client_st *_clone; std::vector workers; const char *_worker_name; const char *_session_namespace; client_test_st() : _clone(NULL), _worker_name(NULL), _session_namespace(NULL) { } ~client_test_st() { clear(); if (_clone) { gearman_client_free(_clone); _clone= NULL; } } void clear() { for (std::vector::iterator iter= workers.begin(); iter != workers.end(); ++iter) { delete *iter; } workers.clear(); set_worker_name(NULL); session_namespace(NULL); reset_clone(); } void push(worker_handle_st *arg) { workers.push_back(arg); } void add_server(const char* hostname, in_port_t port_arg) { gearman_client_add_server(&_client, hostname, port_arg); } const char *worker_name() const { return _worker_name; } void set_worker_name(const char *arg) { _worker_name= arg; } void session_namespace(const char *arg) { _session_namespace= arg; } const char* session_namespace() { return _session_namespace; } gearman_client_st *client() { if (_clone == NULL) { _clone= gearman_client_clone(NULL, &_client); } return _clone; } void clear_clone() { if (_clone) { gearman_client_free(_clone); } _clone= gearman_client_create(NULL); } void reset_clone() { if (_clone) { gearman_client_free(_clone); } _clone= gearman_client_clone(NULL, &_client); } }; gearmand-1.0.6/tests/libgearman-1.0/gearman_client_job_status_by_unique.cc0000664000076400007640000000354112107145705027116 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include #include #if 0 test_return_t gearman_client_job_status_by_unique_TEST(void*) { return TEST_SUCCESS; } #endif gearmand-1.0.6/tests/libgearman-1.0/regression.cc0000664000076400007640000002267312107145705022020 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #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, test_literal_param("dog"), &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); gearman_return_t local_ret= gearman_client_run_tasks(client); ASSERT_EQ(local_ret, GEARMAN_COULD_NOT_CONNECT); local_ret= gearman_client_run_tasks(client); ASSERT_EQ(local_ret, GEARMAN_COULD_NOT_CONNECT); 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, test_literal_param("dog"), &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); gearman_return_t local_ret= gearman_client_run_tasks(client); ASSERT_EQ(local_ret, GEARMAN_COULD_NOT_CONNECT); local_ret= gearman_client_run_tasks(client); ASSERT_EQ(local_ret, GEARMAN_COULD_NOT_CONNECT); 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(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(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(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(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(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(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(packet, true))); gearman_packet_free(&packet); delete con_ptr; } gearman_universal_free(universal); return TEST_SUCCESS; } 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, test_literal_param("reset"), &result_length, &rc); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_false(job_result); // Check to see that the task ran just once job_result= (char*)gearman_client_do(client, "increment_reset_worker", NULL, test_literal_param("10"), &result_length, &rc); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_truth(job_result); long count= strtol(job_result, (char **)NULL, 10); ASSERT_EQ(10L, 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, test_literal_param("14"), job_handle); ASSERT_EQ(rc, GEARMAN_SUCCESS); bool is_known; do { rc= gearman_client_job_status(client, job_handle, &is_known, NULL, NULL, NULL); } while (gearman_continue(rc) or is_known); ASSERT_EQ(rc, GEARMAN_SUCCESS); job_result= (char*)gearman_client_do(client, "increment_reset_worker", NULL, test_literal_param("10"), &result_length, &rc); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_truth(job_result); count= atol(job_result); ASSERT_EQ(34L, count); free(job_result); } return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/gearman_client_job_status_by_unique.h0000664000076400007640000000336112107145705026760 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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_job_status_by_unique_TEST(void*); gearmand-1.0.6/tests/libgearman-1.0/task.cc0000664000076400007640000005045512120667142020600 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include "libgearman/actions.hpp" #include "tests/task.h" #include "tests/workers/v2/call_exception.h" #include "tests/start_worker.h" #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif test_return_t gearman_client_add_task_status_by_unique_NOT_FOUND_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; const char *worker_function= (const char *)gearman_client_context(client); const char* unique_key= __func__; fatal_assert(worker_function); gearman_return_t ret; gearman_task_st* unique_task= gearman_client_add_task_status_by_unique(client, NULL, // context unique_key, &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(unique_task); test_true(gearman_task_unique(unique_task)); ASSERT_EQ(strlen(unique_key), strlen(gearman_task_unique(unique_task))); libtest::dream(1, 0); test_false(gearman_task_is_running(unique_task)); test_false(gearman_task_is_known(unique_task)); gearman_task_free(unique_task); return TEST_SUCCESS; } test_return_t gearman_client_add_task_status_by_unique_TEST(void *object) { gearman_client_st *client= (gearman_client_st *)object; const char *worker_function= (const char *)gearman_client_context(client); const char* unique_key= __func__; fatal_assert(worker_function); gearman_return_t ret; gearman_task_st *task= gearman_client_add_task(client, NULL, // preallocated task NULL, // context worker_function, // function unique_key, // unique test_literal_param("sleep"), // workload &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(task); test_true(gearman_task_unique(task)); ASSERT_EQ(strlen(unique_key), strlen(gearman_task_unique(task))); do { // just for async IO size_t limit= 10; do { if (--limit) { break; } ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); if (limit) { ASSERT_EQ(ret, GEARMAN_SUCCESS); } // 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_st* unique_task= gearman_client_add_task_status_by_unique(client, NULL, // context unique_key, &ret); ASSERT_EQ(GEARMAN_SUCCESS, ret); test_truth(unique_task); test_true(gearman_task_unique(unique_task)); ASSERT_EQ(strlen(unique_key), strlen(gearman_task_unique(unique_task))); gearman_task_free(unique_task); gearman_task_free(task); return TEST_SUCCESS; } test_return_t gearman_client_add_task_test(void *object) { SKIP_IF(HAVE_UUID_UUID_H != 1); gearman_client_st *client= (gearman_client_st *)object; const char *worker_function= (const char *)gearman_client_context(client); fatal_assert(worker_function); gearman_return_t ret; gearman_task_st *task= gearman_client_add_task(client, NULL, // preallocated task NULL, // context worker_function, // function NULL, // unique test_literal_param("dog"), // workload &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); test_true(gearman_task_unique(task)); ASSERT_EQ(size_t(GEARMAN_MAX_UUID_SIZE), strlen(gearman_task_unique(task))); do { // just for async IO do { ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // 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); fatal_assert(worker_function); gearman_return_t ret; gearman_task_st *task= gearman_client_add_task(client, NULL, NULL, worker_function, NULL, test_literal_param("fail"), &ret); ASSERT_EQ(GEARMAN_SUCCESS,ret); test_truth(task); test_truth(task->client); do { ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // 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); ASSERT_EQ(gearman_task_return(task), GEARMAN_WORK_FAIL); 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); fatal_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); ASSERT_EQ(ret, GEARMAN_INVALID_ARGUMENT); test_false(task); // We test for NULL with size task= gearman_client_add_task(client, NULL, NULL, worker_function, NULL, NULL, 5, &ret); ASSERT_EQ(ret, GEARMAN_INVALID_ARGUMENT); 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); fatal_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, test_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, test_literal_param("exception"), &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); do { ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); 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; } fatal_assert(client->task_list); gearman_task_free(task); return TEST_SUCCESS; } static gearman_return_t check_exception_function(gearman_task_st *task) { std::string *exception_str= (std::string *)gearman_task_context(task); if (exception_str == NULL) { Error << "Programmer error, null std::string passed"; return GEARMAN_WORK_FAIL; } assert(task); #if 0 exception_str->append(task->recv->arg[1], task->recv->arg_size[1]); #endif return GEARMAN_SUCCESS; } test_return_t gearman_client_add_task_check_exception_TEST(void*) { libgearman::Client client(libtest::default_port()); if (gearman_client_has_option(&client, GEARMAN_CLIENT_FREE_TASKS)) { return TEST_SKIPPED; } gearman_client_set_exception_fn(&client, check_exception_function); gearman_function_t func= gearman_function_create_v2(call_exception_WORKER); std::auto_ptr call_exception_worker(test_worker_start(libtest::default_port(), NULL, __func__, func, NULL, gearman_worker_options_t())); std::string exception_string; gearman_return_t ret; gearman_task_st *task= gearman_client_add_task(&client, NULL, &exception_string, __func__, NULL, test_literal_param("exception test"), &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); do { ret= gearman_client_run_tasks(&client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // This is a defect, from what I understand we should be passing along the // exception. #if 0 test_true(exception_string.compare("exception test") == 0); #endif // 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; } fatal_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); fatal_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); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); do { // just for async IO do { ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // 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)); fatal_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); fatal_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); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); do { // just for async IO do { ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // 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); fatal_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); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); do { // just for async IO do { ret= gearman_client_run_tasks(client); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // 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); fatal_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, test_literal_param("warning"), &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); ASSERT_EQ(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, test_literal_param("dog"), &ret); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); ASSERT_EQ(GEARMAN_NO_SERVERS, gearman_client_run_tasks(client)); ASSERT_EQ(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; fatal_assert(client); const char *worker_function= (const char *)gearman_client_context(client); fatal_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_true(client->actions.data_fn == pause_actions.data_fn); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); test_true(gearman_task_unique(task)); ASSERT_EQ(size_t(GEARMAN_MAX_UUID_SIZE), strlen(gearman_task_unique(task))); do { // just for async IO uint32_t count= 0; do { count++; test_true(client->actions.data_fn == pause_actions.data_fn); ret= gearman_client_run_tasks(client); test_true(client->actions.data_fn == pause_actions.data_fn); } while (gearman_continue(ret)); ASSERT_EQ(ret, GEARMAN_SUCCESS); 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) { fatal_assert(task); _task_free_st *foo= (_task_free_st *)context; fatal_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; fatal_assert(client); const char *worker_function= (const char *)gearman_client_context(client); fatal_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); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task); test_true(gearman_task_unique(task)); ASSERT_EQ(size_t(GEARMAN_MAX_UUID_SIZE), strlen(gearman_task_unique(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)); ASSERT_EQ(ret, GEARMAN_SUCCESS); // 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; } gearmand-1.0.6/tests/libgearman-1.0/limits.cc0000664000076400007640000000646412107145705021141 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include "tests/start_worker.h" test_return_t function_name_limit_test(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(client); std::vector function_name; function_name.resize(GEARMAN_FUNCTION_MAX_SIZE +2); memset(&function_name[0], 'b', GEARMAN_FUNCTION_MAX_SIZE +1); size_t result_length; gearman_return_t rc; char *job_result= (char*)gearman_client_do(client, &function_name[0], NULL, test_literal_param("reset"), &result_length, &rc); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, rc); test_null(job_result); return TEST_SUCCESS; } test_return_t unique_name_limit_test(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(client); std::vector function_name; function_name.resize(GEARMAN_FUNCTION_MAX_SIZE +1); memset(&function_name[0], 'b', GEARMAN_FUNCTION_MAX_SIZE); std::vector unique_name; unique_name.resize(GEARMAN_MAX_UNIQUE_SIZE +2); memset(&unique_name[0], 'b', GEARMAN_MAX_UNIQUE_SIZE +1); size_t result_length; gearman_return_t rc; char *job_result= (char*)gearman_client_do(client, &function_name[0], &unique_name[0], test_literal_param("reset"), &result_length, &rc); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, rc); test_null(job_result); return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/protocol.cc0000664000076400007640000001004712107145705021471 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif test_return_t check_gearman_command_t(void *) { ASSERT_EQ(0, int(GEARMAN_COMMAND_TEXT)); ASSERT_EQ(1, int(GEARMAN_COMMAND_CAN_DO)); ASSERT_EQ(2, int(GEARMAN_COMMAND_CANT_DO)); ASSERT_EQ(3, int(GEARMAN_COMMAND_RESET_ABILITIES)); ASSERT_EQ(4, int(GEARMAN_COMMAND_PRE_SLEEP)); ASSERT_EQ(5, int(GEARMAN_COMMAND_UNUSED)); ASSERT_EQ(6, int(GEARMAN_COMMAND_NOOP)); ASSERT_EQ(7, int(GEARMAN_COMMAND_SUBMIT_JOB)); ASSERT_EQ(8, int(GEARMAN_COMMAND_JOB_CREATED)); ASSERT_EQ(9, int(GEARMAN_COMMAND_GRAB_JOB)); ASSERT_EQ(10, int(GEARMAN_COMMAND_NO_JOB)); ASSERT_EQ(11, int(GEARMAN_COMMAND_JOB_ASSIGN)); ASSERT_EQ(12, int(GEARMAN_COMMAND_WORK_STATUS)); ASSERT_EQ(13, int(GEARMAN_COMMAND_WORK_COMPLETE)); ASSERT_EQ(14, int(GEARMAN_COMMAND_WORK_FAIL)); ASSERT_EQ(15, int(GEARMAN_COMMAND_GET_STATUS)); ASSERT_EQ(16, int(GEARMAN_COMMAND_ECHO_REQ)); ASSERT_EQ(17, int(GEARMAN_COMMAND_ECHO_RES)); ASSERT_EQ(18, int(GEARMAN_COMMAND_SUBMIT_JOB_BG)); ASSERT_EQ(19, int(GEARMAN_COMMAND_ERROR)); ASSERT_EQ(20, int(GEARMAN_COMMAND_STATUS_RES)); ASSERT_EQ(21, int(GEARMAN_COMMAND_SUBMIT_JOB_HIGH)); ASSERT_EQ(22, int(GEARMAN_COMMAND_SET_CLIENT_ID)); ASSERT_EQ(23, int(GEARMAN_COMMAND_CAN_DO_TIMEOUT)); ASSERT_EQ(24, int(GEARMAN_COMMAND_ALL_YOURS)); ASSERT_EQ(25, int(GEARMAN_COMMAND_WORK_EXCEPTION)); ASSERT_EQ(26, int(GEARMAN_COMMAND_OPTION_REQ)); ASSERT_EQ(27, int(GEARMAN_COMMAND_OPTION_RES)); ASSERT_EQ(28, int(GEARMAN_COMMAND_WORK_DATA)); ASSERT_EQ(29, int(GEARMAN_COMMAND_WORK_WARNING)); ASSERT_EQ(30, int(GEARMAN_COMMAND_GRAB_JOB_UNIQ)); ASSERT_EQ(31, int(GEARMAN_COMMAND_JOB_ASSIGN_UNIQ)); ASSERT_EQ(32, int(GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG)); ASSERT_EQ(33, int(GEARMAN_COMMAND_SUBMIT_JOB_LOW)); ASSERT_EQ(34, int(GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG)); ASSERT_EQ(35, int(GEARMAN_COMMAND_SUBMIT_JOB_SCHED)); ASSERT_EQ(36, int(GEARMAN_COMMAND_SUBMIT_JOB_EPOCH)); ASSERT_EQ(37, int(GEARMAN_COMMAND_SUBMIT_REDUCE_JOB)); ASSERT_EQ(38, int(GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND)); ASSERT_EQ(39, int(GEARMAN_COMMAND_GRAB_JOB_ALL)); ASSERT_EQ(40, int(GEARMAN_COMMAND_JOB_ASSIGN_ALL)); return TEST_SUCCESS; } gearmand-1.0.6/tests/libgearman-1.0/1077917.c0000664000076400007640000000050412107145705020321 0ustar00brianbrian00000000000000/* Look for any basic issue that valgrind might flag. https://bugs.launchpad.net/gearmand/+bug/1077917 */ #include int main (int argc, char **argv) { (void)argc; (void)argv; gearman_client_st client; gearman_client_create(&client); gearman_client_free(&client); exit( 0 ); } gearmand-1.0.6/tests/libgearman-1.0/gearman_execute_partition.cc0000664000076400007640000002431412125243252025053 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include "tests/gearman_execute_partition.h" #include "tests/libgearman-1.0/client_test.h" #include "tests/workers/v2/echo_or_react.h" #include "tests/workers/v2/split.h" #include "tests/workers/aggregator/cat.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #define WORKER_FUNCTION_NAME "client_test" #define WORKER_SPLIT_FUNCTION_NAME "split_worker" test_return_t partition_SETUP(void *object) { client_test_st *test= (client_test_st *)object; test_true(test); test->set_worker_name(WORKER_FUNCTION_NAME); gearman_function_t echo_react_fn= gearman_function_create_v2(echo_or_react_worker_v2); test->push(test_worker_start(libtest::default_port(), NULL, test->worker_name(), echo_react_fn, NULL, gearman_worker_options_t())); gearman_function_t split_worker_fn= gearman_function_create_partition(split_worker, cat_aggregator_fn); test->push(test_worker_start(libtest::default_port(), NULL, WORKER_SPLIT_FUNCTION_NAME, split_worker_fn, NULL, GEARMAN_WORKER_GRAB_ALL)); return TEST_SUCCESS; } test_return_t partition_free_SETUP(void *object) { client_test_st *test= (client_test_st *)object; ASSERT_EQ(TEST_SUCCESS, partition_SETUP(object)); gearman_client_add_options(test->client(), GEARMAN_CLIENT_FREE_TASKS); return TEST_SUCCESS; } test_return_t gearman_execute_partition_check_parameters(void *object) { gearman_client_st *client= (gearman_client_st *)object; test_true(client); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(client, test_literal_param("this is mine"))); // 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, test_literal_param("should fail")); gearman_argument_t workload= gearman_argument_make(0, 0, test_literal_param("this dog does not hunt")); // Test client as NULL gearman_task_st *task= gearman_execute_by_partition(NULL, test_literal_param("split_worker"), test_literal_param(WORKER_FUNCTION_NAME), NULL, 0, // unique NULL, &workload, 0); test_null(task); // Test no partition function task= gearman_execute_by_partition(client, NULL, 0, NULL, 0, NULL, 0, // unique NULL, &workload, 0); test_null(task); return TEST_SUCCESS; } test_return_t gearman_execute_partition_basic(void *object) { gearman_client_st *client= (gearman_client_st *)object; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(client, test_literal_param("this is mine"))); // 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, test_literal_param("should fail")); // This is the real work gearman_argument_t workload= gearman_argument_make(0, 0, test_literal_param("this dog does not hunt")); gearman_task_st *task= gearman_execute_by_partition(client, test_literal_param("split_worker"), test_literal_param(WORKER_FUNCTION_NAME), NULL, 0, // unique NULL, &workload, 0); ASSERT_TRUE(task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(task)); gearman_result_st *result= gearman_task_result(task); ASSERT_TRUE(result); const char *value= gearman_result_value(result); test_truth(value); ASSERT_EQ(18UL, 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); ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_echo(client, test_literal_param("this is mine"))); gearman_argument_t workload= gearman_argument_make(0, 0, test_literal_param("this dog does not hunt mapper_fail")); gearman_task_st *task= gearman_execute_by_partition(client, test_literal_param("split_worker"), gearman_string_param_cstr(worker_function), NULL, 0, // unique NULL, &workload, 0); test_true(task); ASSERT_EQ(GEARMAN_WORK_FAIL, gearman_task_return(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); ASSERT_EQ(gearman_client_echo(client, test_literal_param("this is mine")), GEARMAN_SUCCESS); gearman_argument_t workload= gearman_argument_make(0, 0, test_literal_param("this dog does not hunt fail")); gearman_task_st *task= gearman_execute_by_partition(client, test_literal_param("split_worker"), gearman_string_param_cstr(worker_function), NULL, 0, // unique NULL, &workload, 0); test_true(task); ASSERT_EQ(GEARMAN_WORK_FAIL, gearman_task_return(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; ASSERT_EQ(gearman_client_echo(client, test_literal_param("this is mine")), GEARMAN_SUCCESS); // 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, test_literal_param("should fail")); gearman_argument_t workload= gearman_argument_make(0, 0, test_literal_param("this dog does not hunt")); gearman_task_st *task= gearman_execute(client, test_literal_param("split_worker"), NULL, 0, // unique NULL, &workload, 0); test_true(task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(task)); gearman_result_st *result= gearman_task_result(task); test_truth(result); const char *value= gearman_result_value(result); test_truth(value); ASSERT_EQ(18UL, 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, test_literal_param("this dog does not hunt")); gearman_task_st *task= gearman_execute_by_partition(client, test_literal_param(WORKER_FUNCTION_NAME), test_literal_param("count"), NULL, 0, // unique NULL, &workload, 0); test_true(task); ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(task)); ASSERT_EQ(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; } gearmand-1.0.6/tests/libgearman-1.0/multi_client_test.h0000664000076400007640000001125112107145705023217 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2013 Keyur Govande * 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. * */ /* * This client takes in 2 gearmand server definitions and support the 4 * combinations possible of of gearman_client(s). */ #pragma once #include #define ARRAY_LENGTH 4 struct multi_client_test_st { // index 0: no connected clients index 1: only connected to server 1 index 2: // only connected to server 2 index 3: connected to both servers gearman_client_st* _client_array[ARRAY_LENGTH]; gearman_client_st* _clone_array[ARRAY_LENGTH]; multi_client_test_st(server_startup_st& container_, int timeout= 0) : _server_container(container_) { bool has_failed= false; for (size_t x= 0; (x < ARRAY_LENGTH) and has_failed == false; x++) { _clone_array[x]= NULL; _client_array[x]= gearman_client_create(NULL); has_failed= (_client_array[x] == NULL); if (has_failed == false and (timeout > 0)) { gearman_client_set_timeout(_client_array[x], timeout); } } if (has_failed) { FATAL("new gearman_client_create() failed"); } } ~multi_client_test_st() { for (size_t x= 0; x < ARRAY_LENGTH; ++x) { if (_client_array[x]) { gearman_client_free(_client_array[x]); _client_array[x]= NULL; } if (_clone_array[x]) { gearman_client_free(_clone_array[x]); _clone_array[x]= NULL; } } } void add_server(const char* hostname_1, in_port_t port_arg_1, const char* hostname_2, in_port_t port_arg_2) { gearman_client_add_server(_client_array[1], hostname_1, port_arg_1); gearman_client_add_server(_client_array[2], hostname_2, port_arg_2); gearman_client_add_server(_client_array[3], hostname_1, port_arg_1); gearman_client_add_server(_client_array[3], hostname_2, port_arg_2); } server_startup_st& server_container(void) const { return _server_container; } void push_port(in_port_t arg) { _ports.push_back(arg); } in_port_t port(size_t pos) { FATAL_IF(pos >= _ports.size()); return _ports[pos]; } #define CLIENT_METHODS(NAME, I) \ gearman_client_st* NAME##_client() \ { \ return client(I); \ } \ void reset_##NAME##_clone() \ { \ reset_clone(I); \ } \ void clear_##NAME##_clone() \ { \ clear_clone(I); \ } CLIENT_METHODS(unconnected, 0); CLIENT_METHODS(connected_to_1, 1); CLIENT_METHODS(connected_to_2, 2); CLIENT_METHODS(connected_to_both, 3); private: gearman_client_st *client(int index) { if (_clone_array[index] == NULL) { _clone_array[index]= gearman_client_clone(NULL, _client_array[index]); } return _clone_array[index]; } void clear_clone(int index) { if (_clone_array[index]) { gearman_client_free(_clone_array[index]); } _clone_array[index]= gearman_client_create(NULL); } void reset_clone(int index) { if (_clone_array[index]) { gearman_client_free(_clone_array[index]); } _clone_array[index]= gearman_client_clone(NULL, _client_array[index]); } private: server_startup_st& _server_container; std::vector _ports; }; gearmand-1.0.6/tests/result.cc0000664000076400007640000002511112140700275016543 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Test memcached_result_st * * Copyright (C) 2013 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. * */ /* Test that we are cycling the servers we are creating during testing. */ #include "gear_config.h" #include using namespace libtest; #include "libgearman/result.hpp" #include "libgearman/assert.hpp" #include "libgearman-1.0/visibility.h" #include "libgearman-1.0/result.h" #include static test_return_t declare_result_TEST(void*) { gearman_result_st result; ASSERT_EQ(0, result.size()); ASSERT_EQ(0, result.capacity()); return TEST_SUCCESS; } static test_return_t new_result_TEST(void*) { gearman_result_st* result= new gearman_result_st; ASSERT_EQ(0, result->size()); ASSERT_EQ(0, result->capacity()); delete result; return TEST_SUCCESS; } static test_return_t declare_result_size_TEST(void*) { gearman_result_st result(2048); ASSERT_EQ(0, result.size()); ASSERT_TRUE(result.capacity() >= 2048); return TEST_SUCCESS; } static test_return_t new_result_size_TEST(void*) { gearman_result_st* result= new gearman_result_st(2023); ASSERT_EQ(0, result->size()); ASSERT_TRUE(result->capacity() >= 2023); delete result; return TEST_SUCCESS; } static test_return_t zero_resize_TEST(void*) { gearman_result_st result(89); ASSERT_EQ(0, result.size()); ASSERT_TRUE(result.capacity() >= 89); result.resize(0); ASSERT_EQ(0, result.size()); ASSERT_EQ(0, result.capacity()); return TEST_SUCCESS; } static test_return_t smaller_resize_TEST(void*) { gearman_result_st result(89); ASSERT_EQ(0, result.size()); ASSERT_TRUE(result.capacity() >= 89); result.resize(20); ASSERT_EQ(0, result.size()); ASSERT_TRUE(result.capacity() >= 20); return TEST_SUCCESS; } static test_return_t bigger_resize_TEST(void*) { gearman_result_st result(89); ASSERT_EQ(0, result.size()); ASSERT_TRUE(result.capacity() >= 89); result.resize(181); ASSERT_EQ(0, result.size()); ASSERT_TRUE(result.capacity() >= 181); return TEST_SUCCESS; } static test_return_t random_resize_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_result_st result(random() % max_block); ASSERT_TRUE(result.capacity() >= result.size()); result.resize(random() % max_block); ASSERT_TRUE(result.capacity() >= result.size()); result.resize(random() % max_block +GEARMAN_VECTOR_BLOCK_SIZE); ASSERT_TRUE(result.capacity() >= result.size()); } return TEST_SUCCESS; } static test_return_t append_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_result_st result(random() % max_block); libtest::vchar_t random_string; libtest::vchar::make(random_string, (random() % max_block) +1); result.append(&random_string[0], random_string.size()); if (random() % 2) { result.clear(); } } return TEST_SUCCESS; } static test_return_t gearman_string_take_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_result_st result((random() % max_block) +1); // Now we insert a random string libtest::vchar_t random_string; libtest::vchar::make(random_string, (random() % max_block) +1); result.append(&random_string[0], random_string.size()); gearman_string_t temp= gearman_result_take_string(&result); ASSERT_TRUE(gearman_c_str(temp)); free((void*)(gearman_c_str(temp))); } return TEST_SUCCESS; } static test_return_t gearman_string_allocate_take_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_result_st* result= new gearman_result_st((random() % max_block) +1); { // Now we insert a random string libtest::vchar_t random_string; libtest::vchar::make(random_string, (random() % max_block) +1); result->append(&random_string[0], random_string.size()); } gearman_string_t temp= gearman_result_take_string(result); ASSERT_TRUE(gearman_c_str(temp)); free((void*)(gearman_c_str(temp))); if (random() % 2) { // Now we insert a random string libtest::vchar_t random_string; libtest::vchar::make(random_string, (random() % max_block) +1); result->append(&random_string[0], random_string.size()); } delete result; } return TEST_SUCCESS; } static test_return_t gearman_result_integer_TEST(void*) { gearman_result_st result; ASSERT_TRUE(result.store(8976)); ASSERT_EQ(0, gearman_result_integer(NULL)); ASSERT_EQ(8976, gearman_result_integer(&result)); return TEST_SUCCESS; } static test_return_t gearman_result_boolean_TEST(void*) { gearman_result_st result; ASSERT_TRUE(result.is_type(GEARMAN_RESULT_NULL)); ASSERT_EQ(false, gearman_result_boolean(NULL)); ASSERT_TRUE(result.boolean(true)); ASSERT_EQ(true, gearman_result_boolean(&result)); ASSERT_TRUE(result.is_type(GEARMAN_RESULT_BOOLEAN)); ASSERT_TRUE(result.boolean(false)); ASSERT_EQ(false, gearman_result_boolean(&result)); ASSERT_TRUE(result.is_type(GEARMAN_RESULT_BOOLEAN)); gearman_result_st result_false; ASSERT_TRUE(result_false.boolean(false)); ASSERT_EQ(false, gearman_result_boolean(&result_false)); ASSERT_TRUE(result.is_type(GEARMAN_RESULT_BOOLEAN)); return TEST_SUCCESS; } static test_return_t gearman_result_string_TEST(void*) { gearman_string_t value= { test_literal_param("This is my echo test") }; gearman_result_st result; ASSERT_EQ(GEARMAN_SUCCESS, gearman_result_store_string(&result, value)); gearman_string_t ret_value= gearman_result_string(&result); ASSERT_EQ(test_literal_param_size(value), test_literal_param_size(ret_value)); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_result_store_string(NULL, value)); return TEST_SUCCESS; } static test_return_t gearman_result_store_string_TEST(void*) { gearman_string_t value= { test_literal_param("This is my echo test") }; ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_result_store_string(NULL, value)); gearman_result_st result; ASSERT_EQ(GEARMAN_SUCCESS, gearman_result_store_string(&result, value)); return TEST_SUCCESS; } static test_return_t gearman_result_store_integer_TEST(void*) { const int64_t value= __LINE__; gearman_result_st result; gearman_result_store_integer(&result, value); return TEST_SUCCESS; } static test_return_t gearman_result_store_value_TEST(void*) { ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_result_store_value(NULL, NULL, 0)); gearman_result_st result; ASSERT_EQ(GEARMAN_SUCCESS, gearman_result_store_value(&result, test_literal_param(__func__))); return TEST_SUCCESS; } static test_return_t gearman_result_size_TEST(void*) { gearman_result_st result; ASSERT_EQ(GEARMAN_SUCCESS, gearman_result_store_value(&result, test_literal_param(__func__))); ASSERT_EQ(strlen(__func__), gearman_result_size(&result)); ASSERT_EQ(0, gearman_result_size(NULL)); return TEST_SUCCESS; } static test_return_t gearman_result_value_TEST(void*) { gearman_result_st result; ASSERT_EQ(GEARMAN_SUCCESS, gearman_result_store_value(&result, test_literal_param(__func__))); ASSERT_EQ(GEARMAN_INVALID_ARGUMENT, gearman_result_store_value(NULL, test_literal_param(__func__))); return TEST_SUCCESS; } static test_return_t gearman_result_is_null_TEST(void*) { gearman_result_st result; ASSERT_TRUE(gearman_result_is_null(&result)); ASSERT_TRUE(gearman_result_is_null(NULL)); return TEST_SUCCESS; } test_st allocate_TESTS[] ={ { "declare result", 0, declare_result_TEST }, { "new result", 0, new_result_TEST }, { "declare result(2048)", 0, declare_result_size_TEST }, { "new result(2023)", 0, new_result_size_TEST }, { 0, 0, 0 } }; test_st resize_TESTS[] ={ { "zero", 0, zero_resize_TEST }, { "smaller", 0, smaller_resize_TEST }, { "bigger", 0, bigger_resize_TEST }, { "random", 0, random_resize_TEST }, { 0, 0, 0 } }; test_st append_TESTS[] ={ { "append()", 0, append_TEST }, { 0, 0, 0 } }; test_st take_TESTS[] ={ { "gearman_string_take_string()", 0, gearman_string_take_TEST }, { "new gearman_result_st() gearman_string_take_string()", 0, gearman_string_allocate_take_TEST }, { 0, 0, 0 } }; test_st API_TESTS[] ={ { "gearman_result_integer()", 0, gearman_result_integer_TEST }, { "gearman_result_boolean()", 0, gearman_result_boolean_TEST }, { "gearman_result_string()", 0, gearman_result_string_TEST }, { "gearman_result_store_string()", 0, gearman_result_store_string_TEST }, { "gearman_result_store_integer()", 0, gearman_result_store_integer_TEST }, { "gearman_result_store_value()", 0, gearman_result_store_value_TEST }, { "gearman_result_size()", 0, gearman_result_size_TEST }, { "gearman_result_value()", 0, gearman_result_value_TEST }, { "gearman_result_is_null()", 0, gearman_result_is_null_TEST }, { 0, 0, 0 } }; collection_st collection[] ={ {"allocate", NULL, NULL, allocate_TESTS }, {"resize", NULL, NULL, resize_TESTS }, {"append", NULL, NULL, append_TESTS }, {"take", NULL, NULL, take_TESTS }, {"API", NULL, NULL, API_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); } gearmand-1.0.6/tests/burnin.cc0000664000076400007640000001242112120666220016521 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include "libgearman/client.hpp" using namespace org::gearmand; #include #define DEFAULT_WORKER_NAME "burnin" static gearman_return_t worker_fn(gearman_job_st*, void*) { return GEARMAN_SUCCESS; } struct client_test_st { libgearman::Client _client; worker_handle_st *handle; client_test_st(): _client(libtest::default_port()), handle(NULL) { gearman_function_t func_arg= gearman_function_create(worker_fn); handle= test_worker_start(libtest::default_port(), NULL, DEFAULT_WORKER_NAME, func_arg, NULL, gearman_worker_options_t()); } ~client_test_st() { delete handle; } gearman_client_st* client() { return &_client; } }; 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) { } ~client_context_st() { if (blob) { free(blob); } } }; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static client_test_st *test_client_context= NULL; static test_return_t burnin_TEST(void*) { gearman_client_st *client= test_client_context->client(); fatal_assert(client); client_context_st *context= (client_context_st *)gearman_client_context(client); fatal_assert(context); // This sketchy, don't do this in your own code. test_true(context->num_tasks > 0); std::vector tasks; try { tasks.resize(context->num_tasks); } catch (...) { } ASSERT_EQ(tasks.size(), context->num_tasks); ASSERT_EQ(gearman_client_echo(client, test_literal_param("echo_test")), GEARMAN_SUCCESS); 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); } ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(task_ptr); } gearman_return_t ret= gearman_client_run_tasks(client); for (uint32_t x= 0; x < context->num_tasks; x++) { ASSERT_EQ(GEARMAN_TASK_STATE_FINISHED, tasks[x].state); ASSERT_EQ(GEARMAN_SUCCESS, tasks[x].result_rc); } test_zero(client->new_tasks); ASSERT_EQ(ret, GEARMAN_SUCCESS); for (uint32_t x= 0; x < context->num_tasks; x++) { gearman_task_free(&(tasks[x])); } } while (context->count--); context->latch++; return TEST_SUCCESS; } static test_return_t burnin_setup(void*) { test_client_context= new client_test_st; client_context_st *context= new client_context_st; context->blob= (char *)malloc(context->max_size); test_true(context->blob); memset(context->blob, 'x', context->max_size); gearman_client_set_context(test_client_context->client(), context); return TEST_SUCCESS; } static test_return_t burnin_cleanup(void*) { client_context_st *context= (struct client_context_st *)gearman_client_context(test_client_context->client()); delete context; delete test_client_context; test_client_context= NULL; return TEST_SUCCESS; } /*********************** World functions **************************************/ static void *world_create(server_startup_st& servers, test_return_t& error) { if (server_startup(servers, "gearmand", libtest::default_port(), NULL) == false) { error= TEST_SKIPPED; return NULL; } worker_handles_st *handle= new worker_handles_st; if (handle == NULL) { error= TEST_FAILURE; return NULL; } return handle; } static bool world_destroy(void *object) { worker_handles_st *handles= (worker_handles_st *)object; delete handles; return TEST_SUCCESS; } test_st burnin_TESTS[] ={ {"burnin", 0, burnin_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"burnin", burnin_setup, burnin_cleanup, burnin_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/do.h0000664000076400007640000000345512107145705015504 0ustar00brianbrian00000000000000/* 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 *); gearmand-1.0.6/tests/c_test.c0000664000076400007640000000357312107145705016357 0ustar00brianbrian00000000000000/* 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) { gearman_client_st client; gearman_client_create(&client); gearman_client_free(&client); return EXIT_SUCCESS; } gearmand-1.0.6/tests/include.am0000664000076400007640000001320112137560516016665 0ustar00brianbrian00000000000000# vim:ft=automake # # Gearman server and library # Copyright (C) 2011-2012 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_HEADERS+= tests/basic.h noinst_HEADERS+= tests/burnin.h noinst_HEADERS+= tests/context.h noinst_HEADERS+= tests/do.h noinst_HEADERS+= tests/do_background.h noinst_HEADERS+= tests/execute.h noinst_HEADERS+= tests/gearman_client_do_job_handle.h noinst_HEADERS+= tests/gearman_execute_partition.h noinst_HEADERS+= tests/limits.h noinst_HEADERS+= tests/protocol.h noinst_HEADERS+= tests/regression.h noinst_HEADERS+= tests/runner.h noinst_HEADERS+= tests/server_options.h noinst_HEADERS+= tests/start_worker.h noinst_HEADERS+= tests/task.h noinst_HEADERS+= tests/unique.h CLIENT_LDADD= CLIENT_LDADD+= libgearman/libgearman.la CLIENT_LDADD+= libtest/libtest.la CLIENT_LDADD+= tests/libstartworker.la tests_cycle_SOURCES= tests_cycle_LDADD= EXTRA_tests_cycle_DEPENDENCIES= EXTRA_tests_cycle_DEPENDENCIES+= gearmand/gearmand tests_cycle_SOURCES+= tests/cycle.cc tests_cycle_LDADD+= ${CLIENT_LDADD} check_PROGRAMS+=tests/cycle noinst_PROGRAMS+=tests/cycle tests_blobslap_client_SOURCES= tests_blobslap_client_LDADD= tests_blobslap_client_SOURCES+= tests/blobslap_client.cc tests_blobslap_client_LDADD+= ${CLIENT_LDADD} noinst_PROGRAMS+= tests/blobslap_client # Vector tests tests_vector_SOURCES= tests_vector_LDADD= tests_vector_SOURCES+= tests/vector.cc tests_vector_LDADD+= libtest/libtest.la tests_vector_LDADD+= libgearman/libgearman-vector.la check_PROGRAMS+= tests/vector noinst_PROGRAMS+= tests/vector test-vector: tests/vector @tests/vector valgrind-vector: tests/vector @$(VALGRIND_COMMAND) tests/vector # Vector tests tests_result_SOURCES= tests_result_LDADD= tests_result_SOURCES+= tests/result.cc tests_result_LDADD+= libtest/libtest.la tests_result_LDADD+= libgearman/libgearman-result.la check_PROGRAMS+= tests/result noinst_PROGRAMS+= tests/result test-result: tests/result @tests/result valgrind-result: tests/result @$(VALGRIND_COMMAND) tests/result EXTRA_tests_cli_DEPENDENCIES= tests_cli_SOURCES= tests_cli_LDADD= tests_cli_SOURCES+= tests/cli.cc EXTRA_tests_cli_DEPENDENCIES+= bin/gearman EXTRA_tests_cli_DEPENDENCIES+= bin/gearadmin EXTRA_tests_cli_DEPENDENCIES+= gearmand/gearmand tests_cli_LDADD+= ${CLIENT_LDADD} check_PROGRAMS+= tests/cli noinst_PROGRAMS+= tests/cli EXTRA_tests_gearmand_DEPENDENCIES= tests_gearmand_LDADD= tests_gearmand_SOURCES= tests_gearmand_SOURCES+= tests/gearmand.cc tests_gearmand_LDADD+= ${CLIENT_LDADD} EXTRA_tests_gearmand_DEPENDENCIES+= gearmand/gearmand check_PROGRAMS+= tests/gearmand noinst_PROGRAMS+= tests/gearmand include tests/libgearman-1.0/include.am include tests/stress.am include tests/hostile.am include tests/workers/include.am tests_round_robin_test_SOURCES= tests_round_robin_test_LDADD= tests_round_robin_test_SOURCES+= tests/round_robin.cc tests_round_robin_test_LDADD+= ${CLIENT_LDADD} tests_round_robin_test_LDADD+= libgearman/libgearmancore.la check_PROGRAMS+= tests/round_robin_test noinst_PROGRAMS+= tests/round_robin_test test-round-robin: tests/round_robin_test gearmand/gearmand @tests/round_robin_test gdb-round-robin: tests/round_robin_test gearmand/gearmand @$(GDB_COMMAND) tests/round_robin_test valgrind-round-robin: tests/round_robin_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/round_robin_test helgrind-round-robin: tests/round_robin_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/round_robin_test # Test linking with C++ application tests_cpp_test_SOURCES= tests_cpp_test_LDADD= tests_cpp_test_SOURCES+= tests/cpp_test.cc tests_cpp_test_LDADD+= ${CLIENT_LDADD} check_PROGRAMS+=tests/cpp_test noinst_PROGRAMS+=tests/cpp_test valgrind-cpp_test: tests/cpp_test @$(VALGRIND_COMMAND) tests/cpp_test # Test linking with C application tests_c_test_SOURCES= tests_c_test_LDADD= tests_c_test_SOURCES+= tests/c_test.c tests_c_test_LDADD+= ${CLIENT_LDADD} check_PROGRAMS+=tests/c_test noinst_PROGRAMS+=tests/c_test valgrind-c_test: tests/c_test @$(VALGRIND_COMMAND) tests/c_test test-cycle: tests/cycle gearmand/gearmand @tests/cycle test-cli: tests/cli gearmand/gearmand @tests/cli test-gearmand: tests/gearmand gearmand/gearmand @tests/gearmand tests-blobslap_client: tests/blobslap_client gearmand/gearmand @tests/blobslap_client check-local: gdb-cli: tests/cli gearmand/gearmand @$(GDB_COMMAND) tests/cli gdb-blobslap_client: tests/blobslap_client gearmand/gearmand @$(GDB_COMMAND) tests/blobslap_client gdb-cycle: tests/cycle gearmand/gearmand @$(GDB_COMMAND) tests/cycle gdb-gearmand: tests/gearmand gearmand/gearmand @$(GDB_COMMAND) tests/gearmand valgrind-cli: tests/cli gearmand/gearmand @$(VALGRIND_COMMAND) tests/cli valgrind-burnin: tests/burnin_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/burnin_test valgrind-cycle: tests/cycle gearmand/gearmand @$(VALGRIND_COMMAND) tests/cycle valgrind-gearmand: tests/gearmand gearmand/gearmand @$(VALGRIND_COMMAND) tests/gearmand helgrind-client: tests/client_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/client_test helgrind-burnin: tests/burnin_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/burnin_test helgrind-cycle: tests/cycle gearmand/gearmand @$(HELGRIND_COMMAND) tests/cycle drd-cycle: tests/cycle gearmand/gearmand @$(DRD_COMMAND) tests/cycle include tests/ephemeral.am include tests/libdrizzle.am include tests/libmemcached.am include tests/postgres.am include tests/mysql.am include tests/sqlite.am include tests/tokyocabinet.am include tests/redis.am include tests/httpd.am include tests/perl/include.am bogus: gearmand-1.0.6/tests/execute.h0000664000076400007640000000432212107145705016536 0ustar00brianbrian00000000000000/* 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_NULL_workload_TEST(void *object); test_return_t gearman_execute_NULL_attr_NULL_workload_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); gearmand-1.0.6/tests/postgres.am0000664000076400007640000000163512107145705017114 0ustar00brianbrian00000000000000# 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_postgres_test_SOURCES= tests_postgres_test_CXXFLAGS= tests_postgres_test_LDADD= tests_postgres_test_SOURCES+= tests/basic.cc tests_postgres_test_SOURCES+= tests/postgres_test.cc tests_postgres_test_LDADD+= ${CLIENT_LDADD} check_PROGRAMS += tests/postgres_test noinst_PROGRAMS += tests/postgres_test test-postgres: tests/postgres_test gearmand/gearmand @tests/postgres_test gdb-postgres: tests/postgres_test gearmand/gearmand @$(GDB_COMMAND) tests/postgres_test valgrind-postgres: tests/postgres_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/postgres_test gearmand-1.0.6/tests/mysql_test.cc0000664000076400007640000000754612107145705017451 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--check-args", "--queue-type=MySQL", "--mysql-host=localhost", "--mysql-user=mysql", "--mysql-password=mysql", "--mysql-db=gearman", "--mysql-table=gearman", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t collection_init(void *object) { return TEST_SKIPPED; // Just skip until YaTL has MySQL startup support const char *argv[]= { "--queue-type=MySQL", "--mysql-table=gearman", 0 }; Context *test= (Context *)object; fatal_assert(test); test_truth(test->initialize(argv)); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { SKIP_IF(HAVE_UUID_UUID_H != 1); SKIP_IF(has_mysqld() == false); return new Context(default_port(), servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"all options", 0, gearmand_basic_option_test }, {0, 0, 0} }; 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[] ={ {"gearmand options", 0, 0, gearmand_basic_option_tests}, {"mysql queue", collection_init, collection_cleanup, tests}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/blobslap_client.cc0000664000076400007640000000711112107145705020365 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Test the blobslap_client program * * 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. * */ /* Test that we are cycling the servers we are creating during testing. */ #include using namespace libtest; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif static std::string executable; static test_return_t help_test(void *) { char buffer[1024]; snprintf(buffer, sizeof(buffer), "%d", int(default_port())); const char *args[]= { buffer, "-?", "-p", buffer, 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(executable, args, true)); return TEST_SUCCESS; } static test_return_t unknown_test(void *) { char buffer[1024]; snprintf(buffer, sizeof(buffer), "%d", int(default_port())); const char *args[]= { buffer, "--unknown", "-p", buffer, 0 }; // The argument doesn't exist, so we should see an error ASSERT_EQ(EXIT_FAILURE, exec_cmdline(executable, args, true)); return TEST_SUCCESS; } static test_return_t basic_benchmark_test(void *) { char buffer[1024]; snprintf(buffer, sizeof(buffer), "%d", int(default_port())); const char *args[]= { buffer, "-c", "100", "-n", "10", "-e", "-p", buffer, 0 }; // The argument doesn't exist, so we should see an error ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(executable, args, true)); return TEST_SUCCESS; } test_st benchmark_tests[] ={ {"--help", 0, help_test}, {"--unknown", 0, unknown_test}, {"-c 100 -n 10", 0, basic_benchmark_test}, {0, 0, 0} }; collection_st collection[] ={ {"blobslap_client", 0, 0, benchmark_tests}, {0, 0, 0, 0} }; static void *world_create(server_startup_st& servers, test_return_t& error) { if (server_startup(servers, "gearmand", libtest::default_port(), NULL) == false) { error= TEST_SKIPPED; } if (server_startup(servers, "blobslap_worker", libtest::default_port(), NULL) == false) { error= TEST_SKIPPED; } return &servers; } void get_world(libtest::Framework *world) { executable= "./benchmark/blobslap_client"; world->collections(collection); world->create(world_create); } gearmand-1.0.6/tests/redis.am0000664000076400007640000000140612107145705016350 0ustar00brianbrian00000000000000# 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_redis_test_CXXFLAGS= tests_redis_test_SOURCES= tests_redis_test_LDADD= tests_redis_test_LDADD+= ${CLIENT_LDADD} tests_redis_test_SOURCES+= tests/basic.cc tests_redis_test_SOURCES+= tests/redis.cc #check_PROGRAMS += tests/redis_test noinst_PROGRAMS += tests/redis_test test-redis: tests/redis_test gearmand/gearmand @tests/redis_test gdb-redis: tests/redis_test gearmand/gearmand @$(GDB_COMMAND) tests/redis_test gearmand-1.0.6/tests/perl/0000775000076400007640000000000012142673674015676 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/perl/include.am0000664000076400007640000000060712107145705017631 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2012 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 # EXTRA_DIST+= tests/perl/worker/echo.pl gearmand-1.0.6/tests/perl/worker/0000775000076400007640000000000012142673676017211 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/perl/worker/echo.pl0000775000076400007640000000152012107145705020451 0ustar00brianbrian00000000000000#!/usr/bin/perl #=============================================================================== # # FILE: echo.pl # # USAGE: ./echo.pl # # DESCRIPTION: Echo back the workload. # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: YOUR NAME (), # ORGANIZATION: # VERSION: 1.0 # CREATED: 07/11/2012 04:02:42 PM # REVISION: --- #=============================================================================== use Gearman::Worker; sub echo_worker { my $job = $_[0]; my $workload= $job->arg; return $workload; } use strict; use warnings; my $host = 'localhost'; my $port = '4730'; my $servers = $host . ':' . $port; my $worker = Gearman::Worker->new; $worker->job_servers($servers); $worker->register_function( 'echo', \&echo_worker); $worker->work while 1; gearmand-1.0.6/tests/start_worker.h0000664000076400007640000000565412107145705017633 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/called.h" struct worker_handle_st { public: worker_handle_st(); ~worker_handle_st(); void set_shutdown(); bool is_shutdown(); bool shutdown(); void kill(); void set_worker_id(gearman_worker_st*); libtest::thread::Barrier* sync_point(); void wait(); bool check(); volatile bool failed_startup; boost::shared_ptr _thread; private: bool _shutdown; libtest::thread::Mutex _shutdown_lock; gearman_id_t _worker_id; libtest::thread::Barrier _sync_point; }; struct worker_handles_st { worker_handles_st(); ~worker_handles_st(); // Warning, this will not clean up memory void kill_all(); void reset(); void push(worker_handle_st *arg); private: std::vector _workers; }; #pragma once LIBTEST_API struct worker_handle_st *test_worker_start(in_port_t port, const char *namespace_key, const char *function_name, const gearman_function_t &worker_fn, void *context, gearman_worker_options_t options, int timeout= 0); LIBTEST_API bool test_worker_stop(struct worker_handle_st *); gearmand-1.0.6/tests/workers/0000775000076400007640000000000012142673674016430 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/workers/v2/0000775000076400007640000000000012142673675016760 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/workers/v2/called.cc0000664000076400007640000000371512107145705020506 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/called.h" gearman_return_t called_worker(gearman_job_st *, void *object) { Called *count= (Called*)object; assert(count); count->increment(); return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/v2/split.cc0000664000076400007640000000612612107145705020414 0ustar00brianbrian00000000000000/* 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 using namespace libtest; #include #include "tests/workers/v2/split.h" #include #include 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, test_literal_param("mapper_fail"))) { return GEARMAN_FAIL; } // NULL Chunk gearman_return_t rc= gearman_job_send_data(job, chunk_begin, workload +x -chunk_begin); if (gearman_failed(rc)) { return GEARMAN_FAIL; } 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, test_literal_param("mapper_fail"))) { return GEARMAN_FAIL; } 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_FAIL; } } return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/v2/increment_reset.cc0000664000076400007640000000666012107145705022452 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/increment_reset.h" #include 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) == test_literal_param_size("reset") and (not memcmp(workload, test_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_FAIL; } 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, test_literal_param("strtol() failed")); return GEARMAN_FAIL; } } { 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))) { pthread_mutex_unlock(&increment_reset_worker_mutex); return GEARMAN_FAIL; } pthread_mutex_unlock(&increment_reset_worker_mutex); } return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/v2/sleep_return_random.cc0000664000076400007640000000473712107145705023336 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/sleep_return_random.h" /* Use this for string generation */ static const char ALPHANUMERICS[]= "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz"; #define ALPHANUMERICS_SIZE (sizeof(ALPHANUMERICS)-1) static size_t get_alpha_num(void) { return (size_t)random() % ALPHANUMERICS_SIZE; } gearman_return_t sleep_return_random_worker(gearman_job_st *job, void *) { libtest::dream(random() % 20, 0); char buffer[1024]; for (size_t x= 0; x < sizeof(buffer); x++) { buffer[x]= ALPHANUMERICS[get_alpha_num()]; } buffer[sizeof(buffer) -1]= 0; if (gearman_failed(gearman_job_send_data(job, buffer, sizeof(buffer)))) { return GEARMAN_ERROR; } return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/v2/echo_or_react.cc0000664000076400007640000000645312107145705022060 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/echo_or_react.h" #include #include 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 == test_literal_param_size("fail") and (not memcmp(workload, test_literal_param("fail")))) { return GEARMAN_FAIL; } else if (result_size == test_literal_param_size("sleep") and (not memcmp(workload, test_literal_param("sleep")))) { libtest::dream(ECHO_OR_REACT_DREAM, 0); if (gearman_failed(gearman_job_send_data(job, test_literal_param("slept")))) { return GEARMAN_ERROR; } return GEARMAN_SUCCESS; } else if (result_size == test_literal_param_size("exception") and (not memcmp(workload, test_literal_param("exception")))) { gearman_return_t rc= gearman_job_send_exception(job, test_literal_param("test exception")); if (gearman_failed(rc)) { return GEARMAN_ERROR; } } else if (result_size == test_literal_param_size("warning") and (not memcmp(workload, test_literal_param("warning")))) { gearman_return_t rc= gearman_job_send_warning(job, test_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; } gearmand-1.0.6/tests/workers/v2/echo_or_react.h0000664000076400007640000000345412107145705021720 0ustar00brianbrian00000000000000/* 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 ECHO_OR_REACT_DREAM 20 LIBTEST_API gearman_return_t echo_or_react_worker_v2(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/unique.cc0000664000076400007640000000532512107145705020567 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "tests/workers/v2/unique.h" #include #include // 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_FAIL; } gearmand-1.0.6/tests/workers/v2/call_exception.h0000664000076400007640000000341312107145705022110 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 LIBTEST_API gearman_return_t call_exception_WORKER(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/count.h0000664000076400007640000000340212107145705020245 0ustar00brianbrian00000000000000/* 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 LIBTEST_API gearman_return_t count_worker(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/echo_or_react_chunk.cc0000664000076400007640000000707512107145705023251 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/echo_or_react_chunk.h" gearman_return_t echo_or_react_chunk_worker_v2(gearman_job_st *job, void *split_arg) { const char *workload= (const char *)gearman_job_workload(job); size_t workload_size= gearman_job_workload_size(job); bool fail= false; if (workload_size == test_literal_param_size("fail") and (not memcmp(workload, test_literal_param("fail")))) { fail= true; } else if (workload_size == test_literal_param_size("exception") and (not memcmp(workload, test_literal_param("exception")))) { if (gearman_failed(gearman_job_send_exception(job, test_literal_param("test exception")))) { return GEARMAN_ERROR; } } else if (workload_size == test_literal_param_size("warning") and (not memcmp(workload, test_literal_param("warning")))) { if (gearman_failed(gearman_job_send_warning(job, test_literal_param("test warning")))) { return GEARMAN_ERROR; } } size_t split_on= 1; if (split_arg) { size_t *tmp= (size_t*)split_arg; split_on= *tmp; } if (split_on > workload_size) { split_on= workload_size; } const char* workload_ptr= &workload[0]; size_t remaining= workload_size; for (size_t x= 0; x < workload_size; x+= split_on) { // Chunk if (gearman_failed(gearman_job_send_data(job, workload_ptr, split_on))) { return GEARMAN_ERROR; } remaining-= split_on; workload_ptr+= split_on; // report status { if (gearman_failed(gearman_job_send_status(job, (uint32_t)x, (uint32_t)workload_size))) { return GEARMAN_ERROR; } if (fail) { return GEARMAN_FAIL; } } } if (remaining) { if (gearman_failed(gearman_job_send_data(job, workload_ptr, remaining))) { return GEARMAN_ERROR; } } return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/v2/increment_reset.h0000664000076400007640000000341612107145705022310 0ustar00brianbrian00000000000000/* 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 LIBTEST_API gearman_return_t increment_reset_worker_v2(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/split.h0000664000076400007640000000341012107145705020247 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 LIBTEST_API gearman_return_t split_worker(gearman_job_st *job, void* /* context */); gearmand-1.0.6/tests/workers/v2/echo_or_react_chunk.h0000664000076400007640000000342212107145705023103 0ustar00brianbrian00000000000000/* 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 LIBTEST_API gearman_return_t echo_or_react_chunk_worker_v2(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/called.h0000664000076400007640000000434612107145705020351 0ustar00brianbrian00000000000000/* 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 class Called { public: Called() : _count(0) { pthread_mutex_init(&_lock, NULL); } ~Called() { pthread_mutex_destroy(&_lock); } void increment() { pthread_mutex_lock(&_lock); _count++; pthread_mutex_unlock(&_lock); } int32_t count() { int32_t tmp; pthread_mutex_lock(&_lock); tmp= _count; pthread_mutex_unlock(&_lock); return tmp; } private: int32_t _count; pthread_mutex_t _lock; }; LIBTEST_API gearman_return_t called_worker(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/sleep_return_random.h0000664000076400007640000000341012107145705023163 0ustar00brianbrian00000000000000/* 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 LIBTEST_API gearman_return_t sleep_return_random_worker(gearman_job_st *job, void *); gearmand-1.0.6/tests/workers/v2/unique.h0000664000076400007640000000340512107145705020426 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 LIBTEST_API gearman_return_t unique_worker_v2(gearman_job_st *job, void *context); gearmand-1.0.6/tests/workers/v2/count.cc0000664000076400007640000000422612107145705020410 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/count.h" #include 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_FAIL; } return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/v2/call_exception.cc0000664000076400007640000000414712107145705022253 0ustar00brianbrian00000000000000/* 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 "tests/workers/v2/call_exception.h" #include #include gearman_return_t call_exception_WORKER(gearman_job_st *job, void *) { gearman_return_t rc= gearman_job_send_exception(job, gearman_job_workload(job), gearman_job_workload_size(job)); if (gearman_failed(rc)) { return GEARMAN_ERROR; } return GEARMAN_SUCCESS; } gearmand-1.0.6/tests/workers/include.am0000664000076400007640000000503112137560620020357 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011-2012 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. noinst_HEADERS+= tests/workers/aggregator/cat.h noinst_HEADERS+= tests/workers/v1/echo_or_react.h noinst_HEADERS+= tests/workers/v1/echo_or_react_chunk.h noinst_HEADERS+= tests/workers/v1/increment_reset.h noinst_HEADERS+= tests/workers/v1/unique.h noinst_HEADERS+= tests/workers/v2/call_exception.h noinst_HEADERS+= tests/workers/v2/called.h noinst_HEADERS+= tests/workers/v2/count.h noinst_HEADERS+= tests/workers/v2/echo_or_react.h noinst_HEADERS+= tests/workers/v2/echo_or_react_chunk.h noinst_HEADERS+= tests/workers/v2/increment_reset.h noinst_HEADERS+= tests/workers/v2/sleep_return_random.h noinst_HEADERS+= tests/workers/v2/split.h noinst_HEADERS+= tests/workers/v2/unique.h check_LTLIBRARIES+= tests/libstartworker.la tests_libstartworker_la_CXXFLAGS= tests_libstartworker_la_LIBADD= tests_libstartworker_la_SOURCES= tests_libstartworker_la_CXXFLAGS+= $(BOOST_CPPFLAGS) tests_libstartworker_la_CXXFLAGS+= @PTHREAD_CFLAGS@ tests_libstartworker_la_LIBADD+= @PTHREAD_LIBS@ tests_libstartworker_la_LIBADD+= @RT_LIB@ tests_libstartworker_la_LIBADD+= libgearman/libgearman.la tests_libstartworker_la_LIBADD+= libtest/libtest.la tests_libstartworker_la_SOURCES+= tests/start_worker.cc tests_libstartworker_la_SOURCES+= util/instance.cc tests_libstartworker_la_SOURCES+= util/operation.cc tests_libstartworker_la_SOURCES+= tests/workers/aggregator/cat.cc tests_libstartworker_la_SOURCES+= tests/workers/v1/echo_or_react.cc tests_libstartworker_la_SOURCES+= tests/workers/v1/echo_or_react_chunk.cc tests_libstartworker_la_SOURCES+= tests/workers/v1/echo_or_react_chunk_worker.cc tests_libstartworker_la_SOURCES+= tests/workers/v1/increment_reset_worker.cc tests_libstartworker_la_SOURCES+= tests/workers/v1/unique.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/call_exception.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/called.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/count.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/echo_or_react.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/echo_or_react_chunk.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/increment_reset.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/sleep_return_random.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/split.cc tests_libstartworker_la_SOURCES+= tests/workers/v2/unique.cc gearmand-1.0.6/tests/workers/v1/0000775000076400007640000000000012142673675016757 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/workers/v1/echo_or_react.cc0000664000076400007640000000622512107145705022054 0ustar00brianbrian00000000000000/* 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 "tests/workers/v1/echo_or_react.h" #include #include 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 == test_literal_param_size("fail") and (not memcmp(workload, test_literal_param("fail")))) { *ret_ptr= GEARMAN_WORK_FAIL; return NULL; } else if (*result_size == test_literal_param_size("exception") and (not memcmp(workload, test_literal_param("exception")))) { gearman_return_t rc= gearman_job_send_exception(job, test_literal_param("test exception")); if (gearman_failed(rc)) { *ret_ptr= GEARMAN_WORK_FAIL; return NULL; } } else if (*result_size == test_literal_param_size("warning") and (not memcmp(workload, test_literal_param("warning")))) { gearman_return_t rc= gearman_job_send_warning(job, test_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; } gearmand-1.0.6/tests/workers/v1/echo_or_react.h0000664000076400007640000000350312107145705021712 0ustar00brianbrian00000000000000/* 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 LIBTEST_API void *echo_or_react_worker(gearman_job_st *job, void *, size_t *result_size, gearman_return_t *ret_ptr); gearmand-1.0.6/tests/workers/v1/unique.cc0000664000076400007640000000560712107145705020571 0ustar00brianbrian00000000000000/* 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 "tests/workers/v1/unique.h" #include #include // 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; } gearmand-1.0.6/tests/workers/v1/echo_or_react_chunk.cc0000664000076400007640000000702012107145705023236 0ustar00brianbrian00000000000000/* 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 "tests/workers/v1/echo_or_react_chunk.h" #include #include 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 == test_literal_param_size("fail") and (not memcmp(workload, test_literal_param("fail")))) { fail= true; } else if (workload_size == test_literal_param_size("exception") and (not memcmp(workload, test_literal_param("exception")))) { gearman_return_t rc= gearman_job_send_exception(job, test_literal_param("test exception")); if (gearman_failed(rc)) { *ret_ptr= GEARMAN_WORK_FAIL; return NULL; } } else if (workload_size == test_literal_param_size("warning") and (not memcmp(workload, test_literal_param("warning")))) { gearman_return_t rc= gearman_job_send_warning(job, test_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; } gearmand-1.0.6/tests/workers/v1/increment_reset.h0000664000076400007640000000345112107145705022306 0ustar00brianbrian00000000000000/* 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 LIBTEST_API void *increment_reset_worker(gearman_job_st *job, void *, size_t *result_size, gearman_return_t *ret_ptr); gearmand-1.0.6/tests/workers/v1/echo_or_react_chunk_worker.cc0000664000076400007640000000675312107145705024643 0ustar00brianbrian00000000000000/* 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 "tests/workers/v1/echo_or_react_chunk.h" 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 == test_literal_param_size("fail") and (not memcmp(workload, test_literal_param("fail")))) { fail= true; } else if (workload_size == test_literal_param_size("exception") and (not memcmp(workload, test_literal_param("exception")))) { gearman_return_t rc= gearman_job_send_exception(job, test_literal_param("test exception")); if (gearman_failed(rc)) { *ret_ptr= GEARMAN_WORK_FAIL; return NULL; } } else if (workload_size == test_literal_param_size("warning") and (not memcmp(workload, test_literal_param("warning")))) { gearman_return_t rc= gearman_job_send_warning(job, test_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; } gearmand-1.0.6/tests/workers/v1/echo_or_react_chunk.h0000664000076400007640000000352012107145705023101 0ustar00brianbrian00000000000000/* 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 LIBTEST_API void *echo_or_react_chunk_worker(gearman_job_st *job, void *, size_t *result_size, gearman_return_t *ret_ptr); gearmand-1.0.6/tests/workers/v1/unique.h0000664000076400007640000000352012107145705020423 0ustar00brianbrian00000000000000/* 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 LIBTEST_API // payload is unique value void *unique_worker(gearman_job_st *job, void *, size_t *result_size, gearman_return_t *ret_ptr); gearmand-1.0.6/tests/workers/v1/increment_reset_worker.cc0000664000076400007640000000671312107145705024041 0ustar00brianbrian00000000000000/* 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 "tests/workers/v1/increment_reset.h" #include 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) == test_literal_param_size("reset") and (not memcmp(workload, test_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, test_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, test_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; } gearmand-1.0.6/tests/workers/aggregator/0000775000076400007640000000000012142673675020553 5ustar00brianbrian00000000000000gearmand-1.0.6/tests/workers/aggregator/cat.cc0000664000076400007640000000471712107145705021627 0ustar00brianbrian00000000000000/* 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 using namespace libtest; #include #include "tests/workers/aggregator/cat.h" #include #include 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 (gearman_result_size(result_ptr) == 0) { 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; } gearmand-1.0.6/tests/workers/aggregator/cat.h0000664000076400007640000000346712107145705021472 0ustar00brianbrian00000000000000/* 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 LIBTEST_API gearman_return_t cat_aggregator_fn(gearman_aggregator_st *aggregator, gearman_task_st *task, gearman_result_st *result); gearmand-1.0.6/tests/gearman_client_do_job_handle.h0000664000076400007640000000347712107145705022705 0ustar00brianbrian00000000000000/* 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); gearmand-1.0.6/tests/drizzle_test.cc0000664000076400007640000000643412121213704017751 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include #define WORKER_FUNCTION "drizzle_queue_test" #if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE #include #endif static in_port_t drizzled_port= 0; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--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", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(drizzled_binary(), args, true)); return TEST_SUCCESS; } static test_return_t collection_init(void *object) { Context *test= (Context *)object; assert(test); #if defined(HAVE_DRIZZLED_BINARY) && HAVE_DRIZZLED_BINARY drizzled_port= libtest::get_free_port(); if (server_startup(test->_servers, "drizzled", drizzled_port, NULL) == false) { return TEST_SKIPPED; } #else drizzled_port= 0; #endif if (HAVE_LIBDRIZZLE) { if (libtest::ping_drizzled(drizzled_port) == false) { return TEST_FAILURE; } } char drizzled_server_string[1024]; int length= snprintf(drizzled_server_string, sizeof(drizzled_server_string), "--libdrizzle-port=%d", int(drizzled_port)); test_true(length > 0); const char *argv[]= { drizzled_server_string, "--queue-type=libdrizzle", 0 }; test_truth(test->initialize(argv)); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { SKIP_IF(HAVE_UUID_UUID_H != 1); SKIP_IF(has_drizzled() == false); return new Context(default_port(), servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"all options", 0, gearmand_basic_option_test }, {0, 0, 0} }; 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[] ={ {"drizzle queue", collection_init, collection_cleanup, tests}, {"regressions", collection_init, collection_cleanup, regressions}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/start_worker.cc0000664000076400007640000002131312120714126017751 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include #include #include #include #include #include #include #include #include #include #include #include using namespace libtest; using namespace datadifferential; #include "libgearman/worker.hpp" using namespace org::gearmand; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #define CONTEXT_MAGIC_MARKER 45 struct context_st { worker_handle_st *handle; in_port_t port; gearman_worker_options_t options; gearman_function_t worker_fn; std::string namespace_key; std::string function_name; void *context; int magic; int _timeout; libtest::thread::Barrier* _sync_point; context_st(worker_handle_st* handle_arg, const gearman_function_t& func_arg, in_port_t port_arg, const std::string& namespace_key_arg, const std::string& function_name_arg, void *context_arg, gearman_worker_options_t& options_arg, int timeout_arg) : handle(handle_arg), port(port_arg), options(options_arg), worker_fn(func_arg), namespace_key(namespace_key_arg), function_name(function_name_arg), context(context_arg), magic(CONTEXT_MAGIC_MARKER), _timeout(timeout_arg), _sync_point(handle_arg->sync_point()) { } void wait(void) { if (_sync_point) { _sync_point->wait(); _sync_point= NULL; } } void fail(void) { handle->failed_startup= true; wait(); } ~context_st() { } }; static void thread_runner(context_st* con) { std::auto_ptr context(con); assert(context.get()); assert(context.get() == con); if (context.get() == NULL) { Error << "context_st passed to function was NULL"; context->fail(); return; } assert (context->magic == CONTEXT_MAGIC_MARKER); if (context->magic != CONTEXT_MAGIC_MARKER) { Error << "context_st had bad magic"; context->fail(); return; } libgearman::Worker worker(context->port); if (&worker == NULL) { Error << "Failed to create Worker"; context->fail(); return; } assert(context->handle); if (context->handle == NULL) { Error << "Progammer error, no handle found"; context->fail(); return; } context->handle->set_worker_id(&worker); if (context->namespace_key.empty() == false) { gearman_worker_set_namespace(&worker, context->namespace_key.c_str(), context->namespace_key.length()); } // Check for a working server by "asking" it for an option { size_t count= 5; bool success= false; while (--count and success == false) { success= gearman_worker_set_server_option(&worker, test_literal_param("exceptions")); } if (success == false) { Out << "gearman_worker_set_server_option() failed"; context->fail(); return; } } if (gearman_failed(gearman_worker_define_function(&worker, context->function_name.c_str(), context->function_name.length(), context->worker_fn, context->_timeout, context->context))) { Error << "Failed to add function " << context->function_name << "(" << gearman_worker_error(&worker) << ")"; context->fail(); return; } if (context->options != gearman_worker_options_t()) { gearman_worker_add_options(&worker, context->options); } context->wait(); gearman_return_t ret= GEARMAN_SUCCESS; while (context->handle->is_shutdown() == false) { ret= gearman_worker_work(&worker); if (ret == GEARMAN_NO_REGISTERED_FUNCTIONS) { context->handle->set_shutdown(); continue; } if (ret == GEARMAN_SHUTDOWN) { if (gearman_failed(gearman_worker_unregister_all(&worker))) { Error << "Failed to unregister " << context->function_name; } continue; } if (ret != GEARMAN_SUCCESS and ret != GEARMAN_INVALID_ARGUMENT and ret != GEARMAN_WORK_FAIL) { #if 0 Error << context->function_name << ": " << gearman_strerror(ret) << ": " << gearman_worker_error(&worker); #endif } } } worker_handle_st *test_worker_start(in_port_t port, const char *namespace_key, const char *function_name, const gearman_function_t &worker_fn, void *context_arg, gearman_worker_options_t options, int timeout) { worker_handle_st *handle= new worker_handle_st(); fatal_assert(handle); context_st *context= new context_st(handle, worker_fn, port, namespace_key ? namespace_key : "", function_name, context_arg, options, timeout); fatal_assert(context); handle->_thread= boost::shared_ptr(new libtest::thread::Thread(thread_runner, context)); if (bool(handle->_thread) == false) { delete context; delete handle; return NULL; } handle->wait(); return handle; } libtest::thread::Barrier* worker_handle_st::sync_point() { return &_sync_point; } void worker_handle_st::set_worker_id(gearman_worker_st* worker) { _worker_id= gearman_worker_id(worker); } worker_handle_st::worker_handle_st() : failed_startup(false), _shutdown(false), _worker_id(gearman_id_t()), _sync_point(2) { } worker_handle_st::~worker_handle_st() { shutdown(); } void worker_handle_st::wait() { _sync_point.wait(); } void worker_handle_st::set_shutdown() { libtest::thread::ScopedLock l(_shutdown_lock); _shutdown= true; } bool worker_handle_st::is_shutdown() { libtest::thread::ScopedLock l(_shutdown_lock); return _shutdown; } bool worker_handle_st::shutdown() { if (is_shutdown()) { return true; } set_shutdown(); // This block issues an error, but the error is not fatal gearman_return_t rc; if (gearman_failed(rc= gearman_kill(_worker_id, GEARMAN_KILL))) { Error << "failed to shutdown " << rc; } _thread->join(); return true; } bool worker_handle_st::check() { gearman_return_t rc; if (gearman_failed(rc= gearman_kill(_worker_id, GEARMAN_KILL))) { return false; } return true; } worker_handles_st::worker_handles_st() { } worker_handles_st::~worker_handles_st() { reset(); } // Warning, this will not clean up memory void worker_handles_st::kill_all() { assert(valgrind_is_caller() == false); _workers.clear(); } void worker_handles_st::reset() { for (std::vector::iterator iter= _workers.begin(); iter != _workers.end(); ++iter) { delete *iter; } _workers.clear(); } void worker_handles_st::push(worker_handle_st *arg) { _workers.push_back(arg); } gearmand-1.0.6/tests/libmemcached.am0000664000076400007640000000226412107145705017642 0ustar00brianbrian00000000000000# 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_memcached_test_CXXFLAGS= tests_memcached_test_SOURCES= tests_memcached_test_LDADD= tests_memcached_test_SOURCES+= tests/basic.cc tests_memcached_test_SOURCES+= tests/memcached_test.cc tests_memcached_test_LDADD+= libgearman/libgearman.la tests_memcached_test_LDADD+= libtest/libtest.la tests_memcached_test_LDADD+= tests/libstartworker.la if HAVE_LIBMEMCACHED tests_memcached_test_CXXFLAGS+= $(LIBMEMCACHED_CFLAGS) tests_memcached_test_LDADD+= $(LIBMEMCACHED_UTIL_LIB) endif check_PROGRAMS+= tests/memcached_test noinst_PROGRAMS+= tests/memcached_test test-libmemcached: tests/memcached_test gearmand/gearmand @tests/memcached_test valgrind-libmemcached: tests/memcached_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/memcached_test gdb-libmemcached: tests/memcached_test gearmand/gearmand @$(GDB_COMMAND) tests/memcached_test gearmand-1.0.6/tests/limits.h0000664000076400007640000000341612107145705016400 0ustar00brianbrian00000000000000/* 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 function_name_limit_test(void*); test_return_t unique_name_limit_test(void*); gearmand-1.0.6/tests/basic.cc0000664000076400007640000001577512120667371016334 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include "libgearman/client.hpp" using namespace org::gearmand; #include "tests/workers/v2/called.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif test_return_t client_echo_fail_test(void *object) { Context *test= (Context *)object; test_truth(test); libgearman::Client client(in_port_t(20)); gearman_return_t rc= gearman_client_echo(&client, test_literal_param("This should never work")); test_true(gearman_failed(rc)); return TEST_SUCCESS; } test_return_t client_echo_test(void *object) { Context *test= (Context *)object; test_truth(test); libgearman::Client client(test->port()); ASSERT_EQ(gearman_client_echo(&client, test_literal_param("This is my echo test")), GEARMAN_SUCCESS); 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); ASSERT_EQ(gearman_worker_echo(worker, test_literal_param("This is my echo test")), GEARMAN_SUCCESS); 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, 3000); Called called; gearman_function_t counter_function= gearman_function_create(called_worker); ASSERT_EQ(gearman_worker_define_function(worker, test->worker_function_name(), strlen(test->worker_function_name()), counter_function, 5, &called), GEARMAN_SUCCESS); // Clean out any jobs that might still be in the queue from failed tests. while (GEARMAN_SUCCESS == gearman_worker_work(worker)) {}; return TEST_SUCCESS; } test_return_t queue_add(void *object) { Context *test= (Context *)object; test_truth(test); test->run_worker= false; libgearman::Client client(test->port()); { gearman_return_t rc= gearman_client_echo(&client, test_literal_param("echo test message")); ASSERT_EQ(rc, GEARMAN_SUCCESS); } { gearman_job_handle_t job_handle= {}; gearman_return_t ret= gearman_client_do_background(&client, test->worker_function_name(), NULL, test->worker_function_name(), strlen(test->worker_function_name()), job_handle); ASSERT_EQ(ret, GEARMAN_SUCCESS); test_truth(job_handle[0]); gearman_return_t rc; do { rc= gearman_client_job_status(&client, 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); } test->run_worker= true; return TEST_SUCCESS; } test_return_t queue_worker(void *object) { Context *test= (Context *)object; test_truth(test); // Setup job ASSERT_EQ(TEST_SUCCESS, queue_add(object)); gearman_worker_st *worker= test->worker; test_truth(worker); test_true(test->run_worker); Called counter; gearman_function_t counter_function= gearman_function_create(called_worker); ASSERT_EQ(gearman_worker_define_function(worker, test->worker_function_name(), strlen(test->worker_function_name()), counter_function, 0, &counter), GEARMAN_SUCCESS); gearman_return_t rc= gearman_worker_work(worker); ASSERT_EQ(rc, GEARMAN_SUCCESS); test_truth(counter.count()); 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)); libgearman::Client client(test->port()); ASSERT_EQ(gearman_client_echo(&client, value, sizeof(value)), GEARMAN_SUCCESS); for (uint32_t x= 0; x < NUMBER_OF_JOBS; x++) { gearman_job_handle_t job_handle= {}; ASSERT_EQ(gearman_client_do_background(&client, worker_function_name, NULL, value, sizeof(value), job_handle), GEARMAN_SUCCESS); test_truth(job_handle[0]); } struct worker_handle_st *worker_handle[NUMBER_OF_WORKERS]; Called called; gearman_function_t counter_function_fn= gearman_function_create(called_worker); 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, &called, gearman_worker_options_t()); test_true(worker_handle[x]); } while (called.count() < NUMBER_OF_JOBS) { libtest::dream(0, static_cast(gearman_timeout(&client) *1000)); } for (uint32_t x= 0; x < NUMBER_OF_WORKERS; x++) { worker_handle[x]->shutdown(); } for (uint32_t x= 0; x < NUMBER_OF_WORKERS; x++) { delete worker_handle[x]; } return TEST_SUCCESS; } gearmand-1.0.6/tests/cli.cc0000664000076400007640000003071612122444522016003 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Cycle the Gearmand server * * 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. * */ /* Test that we are cycling the servers we are creating during testing. */ #include "gear_config.h" #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include using namespace libtest; #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif #include #include "tests/workers/v2/echo_or_react.h" #define WORKER_FUNCTION_NAME "echo_function" namespace cli { struct Context { server_startup_st& servers; Context(server_startup_st& servers_arg) : servers(servers_arg) { } void push(worker_handle_st *worker_arg) { _workers.push_back(worker_arg); } void shutdown_workers() { for (std::vector::iterator iter= _workers.begin(); iter != _workers.end(); ++iter) { delete *iter; } _workers.clear(); } void clear() { shutdown_workers(); servers.clear(); } void port(in_port_t port_) { _port= port_; } in_port_t port() const { return _port; } ~Context() { clear(); } private: std::vector_workers; in_port_t _port; }; } static test_return_t gearman_help_test(void *) { const char *args[]= { "-H", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearman", args, true)); return TEST_SUCCESS; } static test_return_t gearman_verbose_TEST(void *) { const char *args[]= { "-H", "-v", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearman", args, true)); return TEST_SUCCESS; } static test_return_t gearman_unknown_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "-p %d", int(context->port())); const char *args[]= { buffer, "--unknown", 0 }; // The argument doesn't exist, so we should see an error ASSERT_EQ(EXIT_FAILURE, exec_cmdline("bin/gearman", args, true)); return TEST_SUCCESS; } static test_return_t gearman_client_background_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "-p %d", int(context->port())); const char *args[]= { buffer, "-f", WORKER_FUNCTION_NAME, "-b", "payload", 0 }; // The argument doesn't exist, so we should see an error ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearman", args, true)); return TEST_SUCCESS; } #define REGRESSION_FUNCTION_833394 "55_char_function_name_________________________________" static test_return_t regression_833394_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "-p %d", int(context->port())); const char *args[]= { buffer, "-f", REGRESSION_FUNCTION_833394, "-b", "payload", 0 }; // The argument doesn't exist, so we should see an error ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearman", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_help_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--help", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_shutdown_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--shutdown", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); Server *server= context->servers.pop_server(); test_true(server); // We will now quiet down the false error about it not being able to restart server->out_of_ban_killed(true); while (server->ping()) { // Wait out the death of the server } // Since we killed the server above, we need to reset it delete server; return TEST_SUCCESS; } static test_return_t gearadmin_version_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--server-version", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_verbose_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--server-verbose", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_status_TEST(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--status", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_status_with_jobs_TEST(void* object) { cli::Context *context= (cli::Context*)object; { libgearman::Client client(context->port()); for (size_t x= 0; x < 10000; ++x) { gearman_job_handle_t job_handle; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_do_background(&client, __func__, NULL, // unique NULL, 0, // workload job_handle)); } } char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--status", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_workers_test(void* object) { cli::Context *context= (cli::Context*)object; libgearman::Worker worker(context->port()); for (int x= 0; x < 100; ++x) { char function_name[1024]; snprintf(function_name, sizeof(function_name), "function_%u", x); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_register(&worker, function_name, 0)); } char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--workers", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_create_drop_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *create_args[]= { buffer, "--create-function=test_function", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", create_args, true)); const char *drop_args[]= { buffer, "--drop-function=test_function", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", drop_args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_getpid_test(void* object) { cli::Context *context= (cli::Context*)object; { libgearman::Client client(context->port()); for (size_t x= 0; x < 4; x++) { gearman_job_handle_t job_handle; ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_do_background(&client, __func__, // function NULL, // unique NULL, 0, // workload job_handle)); } } char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--getpid", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t gearadmin_unknown_test(void* object) { cli::Context *context= (cli::Context*)object; char buffer[1024]; snprintf(buffer, sizeof(buffer), "--port=%d", int(context->port())); const char *args[]= { buffer, "--unknown", 0 }; // The argument doesn't exist, so we should see an error ASSERT_EQ(EXIT_FAILURE, exec_cmdline("bin/gearadmin", args, true)); return TEST_SUCCESS; } static test_return_t init_SETUP(void* object) { cli::Context *context= (cli::Context*)object; context->port(libtest::get_free_port()); test_true(server_startup(context->servers, "gearmand", context->port(), NULL)); // Echo function gearman_function_t echo_react_fn_v2= gearman_function_create(echo_or_react_worker_v2); context->push(test_worker_start(context->port(), NULL, WORKER_FUNCTION_NAME, echo_react_fn_v2, NULL, gearman_worker_options_t())); context->push(test_worker_start(context->port(), NULL, REGRESSION_FUNCTION_833394, echo_react_fn_v2, NULL, gearman_worker_options_t())); return TEST_SUCCESS; } static test_return_t init_TEARDOWN(void* object) { cli::Context *context= (cli::Context*)object; context->clear(); return TEST_SUCCESS; } static test_return_t server_SETUP(void *object) { cli::Context *context= (cli::Context*)object; in_port_t new_port= libtest::get_free_port(); test_true(server_startup(context->servers, "gearmand", new_port, NULL)); return TEST_SUCCESS; } test_st gearman_tests[] ={ { "--help", 0, gearman_help_test }, { "-H", 0, gearman_help_test }, { "-v", 0, gearman_verbose_TEST }, { "--unknown", 0, gearman_unknown_test }, { "-f echo -b payload", 0, gearman_client_background_test }, { "lp:833394", 0, regression_833394_test }, { 0, 0, 0 } }; test_st gearadmin_tests[] ={ {"--help", 0, gearadmin_help_test}, {"--server-version", 0, gearadmin_version_test}, {"--server-verbose", 0, gearadmin_verbose_test}, {"--status", 0, gearadmin_status_TEST}, {"gearman_client_do_background(100) --status", 0, gearadmin_status_with_jobs_TEST}, {"--getpid", 0, gearadmin_getpid_test}, {"--workers", 0, gearadmin_workers_test}, {"--create-function and --drop-function", 0, gearadmin_create_drop_test}, {"--unknown", 0, gearadmin_unknown_test}, {0, 0, 0} }; test_st gearadmin_shutdown_tests[] ={ {"--shutdown", 0, gearadmin_shutdown_test}, // Must be run last since it shuts down the server {0, 0, 0} }; collection_st collection[] ={ {"gearman", init_SETUP, init_TEARDOWN, gearman_tests}, {"gearadmin", init_SETUP, init_TEARDOWN, gearadmin_tests}, {"gearadmin --shutdown", server_SETUP, init_TEARDOWN, gearadmin_shutdown_tests}, {0, 0, 0, 0} }; static void *world_create(server_startup_st& servers, test_return_t& error) { cli::Context *context= new cli::Context(servers); if (context == NULL) { error= TEST_FAILURE; return NULL; } return context; } static bool world_destroy(void *object) { cli::Context *context= (cli::Context*)object; delete context; return TEST_SUCCESS; } void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/runner.h0000664000076400007640000000726012121164150016400 0ustar00brianbrian00000000000000/* 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 "tests/libgearman-1.0/client_test.h" class GearmandRunner : public Runner { private: typedef test_return_t (*libgearman_test_prepost_callback_fn)(client_test_st *); typedef test_return_t (*libgearman_test_callback_fn)(gearman_client_st *); public: test_return_t run(test_callback_fn* func, void *object) { return _run(libgearman_test_callback_fn(func), (client_test_st*)object); } test_return_t pre(test_callback_fn* func, void *object) { return _setup(libgearman_test_prepost_callback_fn(func), (client_test_st*)object); } test_return_t post(test_callback_fn* func, void *object) { return _teardown(libgearman_test_prepost_callback_fn(func), (client_test_st*)object); } private: test_return_t _setup(libgearman_test_prepost_callback_fn func, client_test_st *container) { if (func) { return func(container); } return TEST_SUCCESS; } test_return_t _teardown(libgearman_test_prepost_callback_fn func, client_test_st *container) { if (func) { return func(container); } container->clear(); return TEST_SUCCESS; } test_return_t _run(libgearman_test_callback_fn func, client_test_st *container) { test_compare(GEARMAN_SUCCESS, gearman_client_echo(container->client(), test_literal_param("check"))); if (func) { test_return_t rc; { gearman_client_st *client= gearman_client_clone(NULL, container->client()); test_truth(client); gearman_client_set_context(client, (void *)container->worker_name()); if (container->session_namespace()) { gearman_client_set_namespace(client, container->session_namespace(),strlen(container->session_namespace())); } rc= func(client); if (rc == TEST_SUCCESS) { test_warn(client->task_list == NULL, "client has uncompleted tasks"); } gearman_client_free(client); } return rc; } return TEST_SUCCESS; } }; gearmand-1.0.6/tests/tokyocabinet.am0000664000076400007640000000153112107145705017734 0ustar00brianbrian00000000000000# 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_tokyocabinet_test_SOURCES= tests_tokyocabinet_test_LDADD= tests_tokyocabinet_test_LDADD+= $(CLIENT_LDADD) tests_tokyocabinet_test_SOURCES+= tests/tokyocabinet_test.cc tests_tokyocabinet_test_SOURCES+= tests/basic.cc check_PROGRAMS+= tests/tokyocabinet_test noinst_PROGRAMS+= tests/tokyocabinet_test test-tokyocabinet: tests/tokyocabinet_test gearmand/gearmand @tests/tokyocabinet_test valgrind-tokyocabinet: tests/tokyocabinet_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/tokyocabinet_test gearmand-1.0.6/tests/ephemeral_test.cc0000664000076400007640000000324112107145705020232 0ustar00brianbrian00000000000000/* 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. */ #include "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t collection_init(void *object) { Context *test= (Context *)object; test_true(test); test_truth(test->initialize(NULL)); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { return new Context(default_port(), servers); } static bool 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[] ={ {"ephemeral queue", collection_init, collection_cleanup, tests}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/vector.cc0000664000076400007640000004020612141162222016524 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Cycle the Gearmand server * * Copyright (C) 2013 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. * */ /* Test that we are cycling the servers we are creating during testing. */ #include "gear_config.h" #include using namespace libtest; #include "libgearman/vector.hpp" #include "libgearman/vector.h" static test_return_t declare_vector_TEST(void*) { gearman_vector_st vec; ASSERT_EQ(0, vec.size()); ASSERT_EQ(0, vec.capacity()); return TEST_SUCCESS; } static test_return_t new_vector_TEST(void*) { gearman_vector_st* vec= new gearman_vector_st; ASSERT_EQ(0, vec->size()); ASSERT_EQ(0, vec->capacity()); delete vec; return TEST_SUCCESS; } static test_return_t declare_vector_size_TEST(void*) { gearman_vector_st vec(2048); ASSERT_EQ(0, vec.size()); ASSERT_TRUE(vec.capacity() >= 2048); return TEST_SUCCESS; } static test_return_t new_vector_size_TEST(void*) { gearman_vector_st* vec= new gearman_vector_st(2023); ASSERT_EQ(0, vec->size()); ASSERT_TRUE(vec->capacity() >= 2023); delete vec; return TEST_SUCCESS; } static test_return_t gearman_string_create_NULL_NULL_TEST(void*) { ASSERT_EQ(NULL, gearman_string_create(NULL, NULL, 0)); return TEST_SUCCESS; } static test_return_t gearman_string_create_TEST(void*) { gearman_vector_st* vec= gearman_string_create(NULL, 0); ASSERT_EQ(0, vec->size()); ASSERT_EQ(0, vec->capacity()); gearman_string_free(vec); return TEST_SUCCESS; } static test_return_t gearman_string_create_string_redo_size_TEST(void*) { gearman_vector_st* vec= gearman_string_create(NULL, test_literal_param(__func__)); ASSERT_EQ(test_literal_param_size(__func__), vec->size()); ASSERT_TRUE(vec->capacity() >= test_literal_param_size(__func__)); vec= gearman_string_create(vec, test_literal_param("again")); ASSERT_EQ(test_literal_param_size("again"), vec->size()); ASSERT_TRUE(vec->capacity() >= test_literal_param_size("again")); gearman_string_free(vec); return TEST_SUCCESS; } static test_return_t gearman_string_create_string_size_TEST(void*) { gearman_vector_st* vec= gearman_string_create(NULL, test_literal_param(__func__)); ASSERT_EQ(test_literal_param_size(__func__), vec->size()); ASSERT_TRUE(vec->capacity() >= test_literal_param_size(__func__)); gearman_string_free(vec); return TEST_SUCCESS; } static test_return_t gearman_string_create_size_TEST(void*) { gearman_vector_st* vec= gearman_string_create(NULL, 2023); ASSERT_EQ(0, vec->size()); ASSERT_TRUE(vec->capacity() >= 2023); gearman_string_free(vec); return TEST_SUCCESS; } static test_return_t gearman_string_create_nonnull_size_TEST(void*) { gearman_vector_st vec(2048); gearman_vector_st* vec_ptr= gearman_string_create(&vec, 0); ASSERT_EQ(0, vec.size()); ASSERT_EQ(0, vec.capacity()); gearman_string_free(vec_ptr); return TEST_SUCCESS; } static test_return_t zero_resize_TEST(void*) { gearman_vector_st vec(89); ASSERT_EQ(0, vec.size()); ASSERT_TRUE(vec.capacity() >= 89); vec.resize(0); ASSERT_EQ(0, vec.size()); ASSERT_EQ(0, vec.capacity()); return TEST_SUCCESS; } static test_return_t smaller_resize_TEST(void*) { gearman_vector_st vec(89); ASSERT_EQ(0, vec.size()); ASSERT_TRUE(vec.capacity() >= 89); vec.resize(20); ASSERT_EQ(0, vec.size()); ASSERT_TRUE(vec.capacity() >= 20); return TEST_SUCCESS; } static test_return_t bigger_resize_TEST(void*) { gearman_vector_st vec(89); ASSERT_EQ(0, vec.size()); ASSERT_TRUE(vec.capacity() >= 89); vec.resize(181); ASSERT_EQ(0, vec.size()); ASSERT_TRUE(vec.capacity() >= 181); return TEST_SUCCESS; } static test_return_t INT64_MAX_resize_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_vector_st vec(random() % max_block); ASSERT_FALSE(vec.resize(INT64_MAX)); } return TEST_SUCCESS; } static test_return_t random_resize_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_vector_st vec(random() % max_block); ASSERT_TRUE(vec.capacity() >= vec.size()); vec.resize(random() % max_block); ASSERT_TRUE(vec.capacity() >= vec.size()); vec.resize(random() % max_block +GEARMAN_VECTOR_BLOCK_SIZE); ASSERT_TRUE(vec.capacity() >= vec.size()); } return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_printf_TEST(void*) { for (size_t x= 0; x < 20; x++) { gearman_vector_st vec; vec.vec_printf("%s", __func__); ASSERT_EQ(0, strcmp(__func__, vec.value())); ASSERT_EQ(strlen(__func__), vec.size()); } return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_printf_empty_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; libtest::vchar_t base_string; libtest::vchar::make(base_string, random() % max_block); gearman_vector_st base_vec(base_string.size()); ASSERT_TRUE(base_vec.store(vchar_param(base_string))); gearman_vector_st vec; ASSERT_TRUE(vec.store(base_vec)); vec.vec_printf(""); ASSERT_EQ(0, vec.size()); return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_append_printf_NULL_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; libtest::vchar_t base_string; libtest::vchar::make(base_string, random() % max_block); gearman_vector_st base_vec(base_string.size()); ASSERT_TRUE(base_vec.store(vchar_param(base_string))); gearman_vector_st vec; ASSERT_TRUE(vec.store(base_vec)); ASSERT_EQ(vec.size(), base_vec.size()); // We are just testing to see if we set off NULL vec.vec_append_printf("%s", NULL); ASSERT_TRUE(vec.size() >= base_vec.size()); return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_append_printf_empty_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; libtest::vchar_t base_string; libtest::vchar::make(base_string, random() % max_block); gearman_vector_st base_vec(base_string.size()); ASSERT_TRUE(base_vec.store(vchar_param(base_string))); gearman_vector_st vec; ASSERT_TRUE(vec.store(base_vec)); ASSERT_EQ(vec.size(), base_vec.size()); vec.vec_append_printf(""); ASSERT_EQ(vec.size(), base_vec.size()); return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_printf_NULL_TEST(void*) { gearman_vector_st vec; // We are just testing to see if we set off NULL vec.vec_printf("%s", NULL); return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_append_printf_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; libtest::vchar_t base_string; libtest::vchar::make(base_string, random() % max_block); gearman_vector_st base_vec(base_string.size()); ASSERT_TRUE(base_vec.store(vchar_param(base_string))); for (size_t x= 0; x < 20; x++) { gearman_vector_st vec; ASSERT_TRUE(vec.store(base_vec)); vec.vec_printf("%s", __func__); ASSERT_EQ(0, strcmp(__func__, vec.value())); ASSERT_EQ(strlen(__func__), vec.size()); } return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_append_printf_1_TEST(void*) { gearman_vector_st vec; for (size_t x= 0; x < 10000; x++) { vec.vec_append_printf("a"); ASSERT_EQ(x +1, vec.size()); } return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_printf_string2_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; libtest::vchar_t base_string; libtest::vchar::make(base_string, random() % max_block); gearman_vector_st base_vec(base_string.size()); ASSERT_TRUE(base_vec.store(vchar_param(base_string))); for (size_t x= 0; x < 20; x++) { gearman_vector_st vec; ASSERT_TRUE(vec.store(base_vec)); libtest::vchar_t random_string1; libtest::vchar::make(random_string1, random() % max_block); libtest::vchar_t random_string2; libtest::vchar::make(random_string2, random() % max_block); // We are just testing to see if we set off NULL int length= vec.vec_printf("%.*s %.*s", vchar_printf(random_string1), vchar_printf(random_string2)); ASSERT_EQ(length, int(random_string1.size() +random_string2.size() +1)); } return TEST_SUCCESS; } static test_return_t gearman_vector_st__vec_append_printf_string2_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; libtest::vchar_t base_string; libtest::vchar::make(base_string, random() % max_block); gearman_vector_st base_vec(base_string.size()); ASSERT_TRUE(base_vec.store(vchar_param(base_string))); for (size_t x= 0; x < 20; x++) { gearman_vector_st vec; ASSERT_TRUE(vec.store(base_vec)); libtest::vchar_t random_string1; libtest::vchar::make(random_string1, random() % max_block); libtest::vchar_t random_string2; libtest::vchar::make(random_string2, random() % max_block); // We are just testing to see if we set off NULL int length= vec.vec_append_printf("%.*s %.*s", vchar_printf(random_string1), vchar_printf(random_string2)); ASSERT_TRUE(length > 0); ASSERT_EQ(vec.size(), size_t(random_string1.size() +random_string2.size() +base_vec.size() +1)); } return TEST_SUCCESS; } static test_return_t gearman_vector_st__append_character_TEST(void*) { for (size_t x= 0; x < 20; x++) { char test_string[3]; gearman_vector_st vec; int a= libtest::random_alpha_num(); vec.append_character(a); int b= libtest::random_alpha_num(); vec.append_character(b); test_string[0]= a; test_string[1]= b; test_string[2]= 0; ASSERT_EQ(0, strcmp(test_string, vec.value())); } return TEST_SUCCESS; } static test_return_t gearman_string_append_character_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_vector_st vec(random() % max_block); ASSERT_TRUE(vec.capacity() >= vec.size()); gearman_string_append_character(&vec, libtest::random_alpha_num()); ASSERT_TRUE(vec.capacity() >= vec.size()); if (random() % 2) { vec.clear(); ASSERT_TRUE(vec.capacity() >= vec.size()); } } return TEST_SUCCESS; } static test_return_t gearman_string_append_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_vector_st vec(random() % max_block); libtest::vchar_t random_string; libtest::vchar::make(random_string, random() % max_block); gearman_string_append(&vec, &random_string[0], random_string.size()); if (random() % 2) { vec.clear(); } } return TEST_SUCCESS; } static test_return_t gearman_string_take_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_vector_st vec((random() % max_block) +1); // Now we insert a random string libtest::vchar_t random_string; libtest::vchar::make(random_string, random() % max_block); gearman_string_append(&vec, &random_string[0], random_string.size()); gearman_string_t temp= gearman_string_take_string(&vec); ASSERT_TRUE(gearman_c_str(temp)); free((void*)(gearman_c_str(temp))); } return TEST_SUCCESS; } static test_return_t gearman_string_allocate_take_TEST(void*) { const size_t max_block= 10 * GEARMAN_VECTOR_BLOCK_SIZE; for (size_t x= 0; x < 20; x++) { gearman_vector_st* vec= new gearman_vector_st((random() % max_block) +1); { // Now we insert a random string libtest::vchar_t random_string; libtest::vchar::make(random_string, random() % max_block); gearman_string_append(vec, &random_string[0], random_string.size()); } gearman_string_t temp= gearman_string_take_string(vec); ASSERT_TRUE(gearman_c_str(temp)); free((void*)(gearman_c_str(temp))); if (random() % 2) { // Now we insert a random string libtest::vchar_t random_string; libtest::vchar::make(random_string, random() % max_block); gearman_string_append(vec, &random_string[0], random_string.size()); } delete vec; } return TEST_SUCCESS; } test_st allocate_TESTS[] ={ { "declare vector", 0, declare_vector_TEST }, { "new vector", 0, new_vector_TEST }, { "declare vector(2048)", 0, declare_vector_size_TEST }, { "new vector(2023)", 0, new_vector_size_TEST }, { "gearman_string_create(NULL, 0)", 0, gearman_string_create_TEST }, { "gearman_string_create(NULL, NULL, 0)", 0, gearman_string_create_NULL_NULL_TEST }, { "gearman_string_create(NULL, literal)", 0, gearman_string_create_string_size_TEST }, { "gearman_string_create(NULL, literal)x2", 0, gearman_string_create_string_redo_size_TEST }, { "gearman_string_create(NULL, 2023)", 0, gearman_string_create_size_TEST }, { "gearman_string_create(vec, 2023)", 0, gearman_string_create_nonnull_size_TEST }, { 0, 0, 0 } }; test_st resize_TESTS[] ={ { "zero", 0, zero_resize_TEST }, { "smaller", 0, smaller_resize_TEST }, { "bigger", 0, bigger_resize_TEST }, { "random", 0, random_resize_TEST }, { "INT64_MAX", 0, INT64_MAX_resize_TEST }, { 0, 0, 0 } }; test_st append_TESTS[] ={ { "gearman_string_append_character()", 0, gearman_string_append_character_TEST }, { "gearman_string_append()", 0, gearman_string_append_TEST }, { "gearman_vector_st::append_character()", 0, gearman_vector_st__append_character_TEST }, { 0, 0, 0 } }; test_st take_TESTS[] ={ { "gearman_string_take_string()", 0, gearman_string_take_TEST }, { "new gearman_vector_st() gearman_string_take_string()", 0, gearman_string_allocate_take_TEST }, { 0, 0, 0 } }; test_st printf_TESTS[] ={ { "gearman_vector_st::vec_printf()", 0, gearman_vector_st__vec_printf_TEST }, { "gearman_vector_st::vec_printf(EMPTY)", 0, gearman_vector_st__vec_printf_empty_TEST }, { "gearman_vector_st::vec_printf(, NULL)", 0, gearman_vector_st__vec_printf_NULL_TEST }, { "gearman_vector_st::vec_printf(, string, string)", 0, gearman_vector_st__vec_printf_string2_TEST }, { 0, 0, 0 } }; test_st append_printf_TESTS[] ={ { "gearman_vector_st::vec_append_printf(1)", 0, gearman_vector_st__vec_append_printf_1_TEST }, { "gearman_vector_st::vec_append_printf()", 0, gearman_vector_st__vec_append_printf_TEST }, { "gearman_vector_st::vec_append_printf(EMPTY)", 0, gearman_vector_st__vec_append_printf_empty_TEST }, { "gearman_vector_st::vec_append_printf(, NULL)", 0, gearman_vector_st__vec_append_printf_NULL_TEST }, { "gearman_vector_st::vec_append_printf(, string, string)", 0, gearman_vector_st__vec_append_printf_string2_TEST }, { 0, 0, 0 } }; collection_st collection[] ={ {"allocate", NULL, NULL, allocate_TESTS }, {"resize", NULL, NULL, resize_TESTS }, {"append", NULL, NULL, append_TESTS }, {"take", NULL, NULL, take_TESTS }, {"printf", NULL, NULL, printf_TESTS }, {"append_printf", NULL, NULL, append_printf_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); } gearmand-1.0.6/tests/do_background.h0000664000076400007640000000357312107145705017704 0ustar00brianbrian00000000000000/* 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); gearmand-1.0.6/tests/httpd.am0000664000076400007640000000157412107145705016373 0ustar00brianbrian00000000000000# 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_test_SOURCES= tests_httpd_test_LDADD= tests_httpd_test_SOURCES+= tests/httpd_test.cc tests_httpd_test_LDADD+= $(CLIENT_LDADD) #check_PROGRAMS+= tests/httpd_test noinst_PROGRAMS+= tests/httpd_test test-httpd: tests/httpd_test gearmand/gearmand @tests/httpd_test gdb-httpd: tests/httpd_test gearmand/gearmand @$(GDB_COMMAND) tests/httpd_test helgrind-httpd: tests/httpd_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/httpd_test valgrind-httpd: tests/httpd_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/httpd_test gearmand-1.0.6/tests/cycle.cc0000664000076400007640000001401312121214042016312 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Cycle the Gearmand server * * 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. * */ /* Test that we are cycling the servers we are creating during testing. */ #include "gear_config.h" #include using namespace libtest; #include #include "tests/start_worker.h" struct cycle_context_st { cycle_context_st(libtest::server_startup_st& arg) : servers(arg), port(0) { reset(); } void reset() { servers.clear(); port= get_free_port(); } server_startup_st& servers; in_port_t port; }; static gearman_return_t success_fn(gearman_job_st*, void* /* context */) { return GEARMAN_SUCCESS; } static test_return_t single_cycle(void* object) { cycle_context_st *context= (cycle_context_st*)object; gearman_function_t success_function= gearman_function_create(success_fn); worker_handle_st *worker= test_worker_start(context->port, NULL, "success", success_function, NULL, gearman_worker_options_t()); test_true(worker); test_true(worker->shutdown()); delete worker; return TEST_SUCCESS; } static test_return_t kill_test(void *) { libtest::dream(2, 0); return TEST_SUCCESS; } static test_return_t __server_startup_TEST(cycle_context_st* context, const int count) { for (int x= 0; x < count; ++x) { test_skip(true, server_startup(context->servers, "gearmand", libtest::get_free_port(), NULL)); } ASSERT_EQ(true, context->servers.shutdown()); return TEST_SUCCESS; } static test_return_t server_startup_single_TEST(void *obj) { ASSERT_EQ(__server_startup_TEST((cycle_context_st*)obj, 1), TEST_SUCCESS); return TEST_SUCCESS; } static test_return_t server_startup_multiple_TEST(void *obj) { ASSERT_EQ(__server_startup_TEST((cycle_context_st*)obj, 20), TEST_SUCCESS); return TEST_SUCCESS; } // We can't really test for this just yet, because we don't know if the server // we attach to is really the one we expect to attach too. static test_return_t server_startup_conflict_TEST(void*) { #if 0 cycle_context_st *context= (cycle_context_st*)object; in_port_t bind_port= libtest::get_free_port(); ASSERT_EQ(true, server_startup(context->servers, "gearmand", bind_port, NULL, false)); ASSERT_EQ(false, server_startup(context->servers, "gearmand", bind_port, NULL, false)); #endif return TEST_SUCCESS; } static test_return_t shutdown_and_remove_TEST(void *obj) { cycle_context_st *context= (cycle_context_st*)obj; context->servers.clear(); return TEST_SUCCESS; } test_st server_startup_TESTS[] ={ {"server_startup(1)", false, (test_callback_fn*)server_startup_single_TEST }, {"server_startup(many)", false, (test_callback_fn*)server_startup_multiple_TEST }, {"shutdown_and_remove()", false, (test_callback_fn*)shutdown_and_remove_TEST }, {"server_startup(many)", false, (test_callback_fn*)server_startup_multiple_TEST }, {"server_startup() with bind() conflict", false, (test_callback_fn*)server_startup_conflict_TEST }, {0, 0, 0} }; test_st kill_tests[] ={ {"kill", true, (test_callback_fn*)kill_test }, {0, 0, 0} }; test_st worker_tests[] ={ {"single startup/shutdown", true, (test_callback_fn*)single_cycle }, {0, 0, 0} }; static test_return_t collection_INIT(void *object) { cycle_context_st *context= (cycle_context_st*)object; test_zero(context->servers.count()); context->reset(); test_skip(true, server_startup(context->servers, "gearmand", context->port, NULL)); return TEST_SUCCESS; } static test_return_t validate_sanity_INIT(void *object) { cycle_context_st *context= (cycle_context_st*)object; test_zero(context->servers.count()); context->reset(); return TEST_SUCCESS; } static test_return_t collection_FINAL(void *object) { cycle_context_st *context= (cycle_context_st*)object; context->reset(); return TEST_SUCCESS; } collection_st collection[] ={ {"kill", validate_sanity_INIT, collection_FINAL, kill_tests }, {"worker", collection_INIT, collection_FINAL, worker_tests }, {"server_startup()", validate_sanity_INIT, collection_FINAL, server_startup_TESTS }, {0, 0, 0, 0} }; static void *world_create(server_startup_st& servers, test_return_t& error) { if (jenkins_is_caller()) { error= TEST_SKIPPED; return NULL; } return new cycle_context_st(servers); } static bool world_destroy(void *object) { cycle_context_st *context= (cycle_context_st*)object; delete context; return TEST_SUCCESS; } void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/ephemeral.am0000664000076400007640000000177012107145705017210 0ustar00brianbrian00000000000000# 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_ephemeral_test_SOURCES= tests_ephemeral_test_CXXFLAGS= tests_ephemeral_test_LDADD= ${CLIENT_LDADD} tests_ephemeral_test_SOURCES+= tests/basic.cc tests_ephemeral_test_SOURCES+= tests/ephemeral_test.cc check_PROGRAMS += tests/ephemeral_test noinst_PROGRAMS += tests/ephemeral_test test-ephemeral: tests/ephemeral_test gearmand/gearmand @tests/ephemeral_test gdb-ephemeral: tests/ephemeral_test gearmand/gearmand @$(GDB_COMMAND) tests/ephemeral_test helgrind-ephemeral: tests/ephemeral_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/ephemeral_test valgrind-ephemeral: tests/ephemeral_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/ephemeral_test gearmand-1.0.6/tests/regression.h0000664000076400007640000000350412107145705017255 0ustar00brianbrian00000000000000/* 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 *); test_return_t regression_768317_test(void *); gearmand-1.0.6/tests/basic.h0000664000076400007640000000372012107145705016156 0ustar00brianbrian00000000000000/* 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 *); gearmand-1.0.6/tests/gearmand.cc0000664000076400007640000004270312120662371017013 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Cycle the Gearmand server * * 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. * */ /* Test that we are cycling the servers we are creating during testing. */ #include "gear_config.h" #include #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include using namespace libtest; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif static std::string executable; static test_return_t postion_TEST(void *) { const char *args[]= { "foo", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t partial_TEST(void *) { const char *args[]= { "--log", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t check_args_test(void *) { const char *args[]= { "--check-args", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_backlog_test(void *) { const char *args[]= { "--check-args", "--backlog=10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_backlog_test(void *) { const char *args[]= { "--check-args", "-b", "10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_daemon_test(void *) { const char *args[]= { "--check-args", "--daemon", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_coredump_TEST(void *) { const char *args[]= { "--check-args", "--coredump", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_daemon_test(void *) { const char *args[]= { "--check-args", "-d", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_file_descriptors_test(void *) { const char *args[]= { "--check-args", "--file-descriptors=10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_file_descriptors_test(void *) { const char *args[]= { "--check-args", "-f", "10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_help_test(void *) { const char *args[]= { "--check-args", "--help", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_help_test(void *) { const char *args[]= { "--check-args", "-h", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_log_file_test(void *) { const char *args[]= { "--check-args", "--log-file=\"tmp/foo\"", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_log_file_stderr_TEST(void *) { const char *args[]= { "--check-args", "--log-file=stderr", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_log_file_test(void *) { const char *args[]= { "--check-args", "-l", "\"tmp/foo\"", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_listen_test(void *) { const char *args[]= { "--check-args", "--listen=10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_listen_test(void *) { const char *args[]= { "--check-args", "-L", "10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_port_test(void *) { const char *args[]= { "--check-args", "--port=10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_port_test(void *) { const char *args[]= { "--check-args", "-p", "10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_pid_file_test(void *) { const char *args[]= { "--check-args", "--pid-file=\"tmp/gearmand.pid\"", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_pid_file_test(void *) { const char *args[]= { "--check-args", "-P", "\"tmp/gearmand.pid\"", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_round_robin_test(void *) { const char *args[]= { "--check-args", "--round-robin", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_round_robin_test(void *) { const char *args[]= { "--check-args", "-R", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_syslog_test(void *) { const char *args[]= { "--check-args", "--syslog", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_threads_test(void *) { const char *args[]= { "--check-args", "--threads=10", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_threads_test(void *) { const char *args[]= { "--check-args", "-t", "8", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_user_test(void *) { const char *args[]= { "--check-args", "--user=nobody", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_user_test(void *) { const char *args[]= { "--check-args", "-u", "nobody", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_version_test(void *) { const char *args[]= { "--check-args", "--version", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_version_test(void *) { const char *args[]= { "--check-args", "-V", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_bad_option_TEST(void *) { const char *args[]= { "--check-args", "--verbose=BAD", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_DEBUG_TEST(void *) { const char *args[]= { "--check-args", "--verbose=DEBUG", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_ERROR_TEST(void *) { const char *args[]= { "--check-args", "--verbose=ERROR", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_ALERT_TEST(void *) { const char *args[]= { "--check-args", "--verbose=ALERT", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_INFO_TEST(void *) { const char *args[]= { "--check-args", "--verbose=INFO", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_WARNING_TEST(void *) { const char *args[]= { "--check-args", "--verbose=WARNING", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_NOTICE_TEST(void *) { const char *args[]= { "--check-args", "--verbose=NOTICE", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_FATAL_TEST(void *) { const char *args[]= { "--check-args", "--verbose=FATAL", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_CRITICAL_TEST(void *) { const char *args[]= { "--check-args", "--verbose=CRITICAL", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t verbose_deprecated_TEST(void *) { const char *args[]= { "--check-args", "-vvv", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_worker_wakeup_test(void *) { const char *args[]= { "--check-args", "--worker-wakeup=4", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_worker_wakeup_test(void *) { const char *args[]= { "--check-args", "-V", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t protocol_test(void *) { const char *args[]= { "--check-args", "--protocol=http", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t queue_test(void *) { const char *args[]= { "--check-args", "--queue-type=builtin", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t long_job_retries_test(void *) { const char *args[]= { "--check-args", "--job-retries=4", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t job_handle_prefix_TEST(void *) { const char *args[]= { "--check-args", "--job-handle-prefix=my_own_private_handle", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t hashtable_buckets_TEST(void *) { const char *args[]= { "--check-args", "--hashtable-buckets=2000", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t short_job_retries_test(void *) { const char *args[]= { "--check-args", "-j", "6", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t http_port_test(void *) { const char *args[]= { "--check-args", "--protocol=http", "--http-port=8090", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t config_file_TEST(void *) { ASSERT_EQ(-1, access("etc/gearmand.conf", R_OK)); const char *args[]= { "--check-args", "--config-file=etc/gearmand.conf", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t config_file_DEFAULT_TEST(void *) { const char *args[]= { "--check-args", "--config-file", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t config_file_FAIL_TEST(void *) { const char *args[]= { "--check-args", "--config-file=etc/grmandfoo.conf", 0 }; ASSERT_EQ(EXIT_FAILURE, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t config_file_SIMPLE_TEST(void *) { in_port_t port= libtest::get_free_port(); char port_str[1024]; test_true(snprintf(port_str, sizeof(port_str), "%d", int32_t(port)) > 0); std::string config_file= "etc/gearmand.conf"; { char current_directory_buffer[1024]; char *current_directory= getcwd(current_directory_buffer, sizeof(current_directory_buffer)); std::string config_path; config_path+= current_directory; config_path+= "/"; config_path+= config_file; std::fstream file_stream; file_stream.open(config_path.c_str(), std::fstream::out | std::fstream::trunc); test_true(file_stream.good()); file_stream << "--port " << port_str << std::endl; test_true(file_stream.good()); file_stream.close(); } test_zero(access(config_file.c_str(), R_OK)); char args_buffer[1024]; snprintf(args_buffer, sizeof(args_buffer), "--config-file=%s", config_file.c_str()); const char *args[]= { "--check-args", args_buffer, 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); unlink(config_file.c_str()); return TEST_SUCCESS; } static test_return_t maxqueue_TEST(void *) { return TEST_SKIPPED; #if 0 in_port_t port= libtest::get_free_port(); Application gearmand(gearmand_binary(), true); char buffer[1024]; test_true(snprintf(buffer, sizeof(buffer), "%d", int32_t(port)) > 0); gearmand.add_long_option("--port=", buffer); ASSERT_EQ(Application::SUCCESS, gearmand.run()); Worker worker(port); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_register(&worker, __func__, 0)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_unregister(&worker, __func__)); ASSERT_EQ(Application::SUCCESS, gearmand.join()); return TEST_SUCCESS; #endif } test_st bad_option_TESTS[] ={ {"position argument", 0, postion_TEST }, {"partial argument", 0, partial_TEST }, {0, 0, 0} }; test_st gearmand_option_tests[] ={ {"--check-args", 0, check_args_test}, {"--backlog=", 0, long_backlog_test}, {"-b", 0, short_backlog_test}, {"--coredump", 0, long_coredump_TEST}, {"--daemon", 0, long_daemon_test}, {"-d", 0, short_daemon_test}, {"--file-descriptors=", 0, long_file_descriptors_test}, {"-f", 0, short_file_descriptors_test}, {"--help", 0, long_help_test}, {"-h", 0, short_help_test}, {"--log-file=", 0, long_log_file_test}, {"--log-file=stderr", 0, long_log_file_stderr_TEST}, {"-l", 0, short_log_file_test}, {"--listen=", 0, long_listen_test}, {"-L", 0, short_listen_test}, {"--port=", 0, long_port_test}, {"-p", 0, short_port_test}, {"--pid-file=", 0, long_pid_file_test}, {"-P", 0, short_pid_file_test}, {"--round-robin", 0, long_round_robin_test}, {"-R", 0, short_round_robin_test}, {"--syslog=", 0, long_syslog_test}, {"--threads=", 0, long_threads_test}, {"-T", 0, short_threads_test}, {"--user=", 0, long_user_test}, {"-u", 0, short_user_test}, {"--user=", 0, long_user_test}, {"-u", 0, short_user_test}, {"-vvv", 0, verbose_deprecated_TEST}, {"--verbose=FATAL", 0, verbose_FATAL_TEST}, {"--verbose=ALERT", 0, verbose_ALERT_TEST}, {"--verbose=CRITICAL", 0, verbose_CRITICAL_TEST}, {"--verbose=ERROR", 0, verbose_ERROR_TEST}, {"--verbose=WARNING", 0, verbose_WARNING_TEST}, {"--verbose=NOTICE", 0, verbose_NOTICE_TEST}, {"--verbose=INFO", 0, verbose_INFO_TEST}, {"--verbose=DEBUG", 0, verbose_DEBUG_TEST}, {"--verbose=BAD", 0, verbose_bad_option_TEST}, {"--version", 0, long_version_test}, {"-V", 0, short_version_test}, {"--worker_wakeup=", 0, long_worker_wakeup_test}, {"-w", 0, short_worker_wakeup_test}, {"--protocol=", 0, protocol_test}, {"--queue-type=", 0, queue_test}, {"--job-retries=", 0, long_job_retries_test}, {"-hashtable-buckets", 0, hashtable_buckets_TEST}, {"--job-handle-prefix=", 0, job_handle_prefix_TEST}, {"-j", 0, short_job_retries_test}, {"--config-file=etc/gearmand.conf no file present", 0, config_file_TEST }, {"--config-file", 0, config_file_DEFAULT_TEST }, {"--config-file=etc/grmandfoo.conf", 0, config_file_FAIL_TEST }, {"--config-file=etc/gearmand.conf", 0, config_file_SIMPLE_TEST }, {0, 0, 0} }; test_st gearmand_httpd_option_tests[] ={ {"--http-port=", 0, http_port_test}, {0, 0, 0} }; test_st maxqueue_TESTS[] ={ { "maxqueue=", 0, maxqueue_TEST }, {0, 0, 0} }; static test_return_t option_SETUP(void*) { unlink("etc/gearmand.conf"); return TEST_SUCCESS; } collection_st collection[] ={ { "bad options", 0, 0, bad_option_TESTS }, { "basic options", option_SETUP, 0, gearmand_option_tests }, { "httpd options", 0, 0, gearmand_httpd_option_tests }, { "maxqueue", 0, 0, maxqueue_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); } gearmand-1.0.6/tests/sqlite.am0000664000076400007640000000233212107145705016542 0ustar00brianbrian00000000000000# 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 # CLEANFILES+= tests/gearman.sql tests/gearman.sql-journal tests/gearmand.log* if HAVE_LIBSQLITE3 tests_sqlite_test_CFLAGS= tests_sqlite_test_CXXFLAGS= tests_sqlite_test_LDADD= tests_sqlite_test_SOURCES= tests_sqlite_test_CFLAGS+= @SQLITE3_CFLAGS@ tests_sqlite_test_CXXFLAGS+= @SQLITE3_CFLAGS@ tests_sqlite_test_LDADD+= @SQLITE3_LDFLAGS@ tests_sqlite_test_SOURCES+= tests/basic.cc tests_sqlite_test_SOURCES+= tests/sqlite_test.cc tests_sqlite_test_LDADD+= $(CLIENT_LDADD) check_PROGRAMS+= tests/sqlite_test noinst_PROGRAMS+= tests/sqlite_test test-sqlite: tests/sqlite_test gearmand/gearmand @tests/sqlite_test gdb-sqlite: tests/sqlite_test gearmand/gearmand @$(GDB_COMMAND) tests/sqlite_test helgrind-sqlite: tests/sqlite_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/sqlite_test valgrind-sqlite: tests/sqlite_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/sqlite_test endif gearmand-1.0.6/tests/postgres_test.cc0000664000076400007640000000753412107145705020147 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--check-args", "--queue-type=Postgres", "--libpq-conninfo=\"host=localhost port=5432 user=root dbname=gearman\"", "--libpq-table=gearman", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t collection_init(void *object) { const char *argv[]= { "--queue-type=Postgres", "--libpq-conninfo=\"host=localhost port=5432 user=root dbname=gearman\"", "--libpq-table=gearman", 0 }; Context *test= (Context *)object; fatal_assert(test); test_truth(test->initialize(argv)); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { SKIP_IF(HAVE_UUID_UUID_H != 1); SKIP_IF(has_postgres_support() == false); return new Context(default_port(), servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"all options", 0, gearmand_basic_option_test }, {0, 0, 0} }; 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[] ={ {"gearmand options", 0, 0, gearmand_basic_option_tests}, {"postgres queue", collection_init, collection_cleanup, tests}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/httpd_test.cc0000664000076400007640000001432012117577715017426 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include "tests/start_worker.h" #include #include #include #include #include #include #include #include #include #include "tests/workers/v2/echo_or_react.h" // Prototypes #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static char host_url[1024]= { 0 }; #define WORKER_FUNCTION_NAME "httpd_worker" static test_return_t curl_no_function_TEST(void *) { Application curl("/usr/bin/curl"); curl.add_option(host_url); ASSERT_EQ(Application::SUCCESS, curl.run()); ASSERT_EQ(Application::SUCCESS, curl.join()); return TEST_SUCCESS; } static test_return_t curl_function_no_body_TEST(void *) { Application curl("/usr/bin/curl"); char worker_url[1024]; snprintf(worker_url, sizeof(worker_url), "%s%s", host_url, WORKER_FUNCTION_NAME); curl.add_option(worker_url); curl.add_option("--header", "\"X-Gearman-Unique: curl_function_no_body_TEST\""); ASSERT_EQ(Application::SUCCESS, curl.run()); ASSERT_EQ(Application::SUCCESS, curl.join()); test_zero(curl.stdout_result_length()); return TEST_SUCCESS; } static test_return_t curl_function_TEST(void *) { // Cleanup previous run unlink("var/tmp/curl_function_TEST.out"); Application curl("/usr/bin/curl"); char worker_url[1024]; snprintf(worker_url, sizeof(worker_url), "%s%s", host_url, WORKER_FUNCTION_NAME); curl.add_option("--header", "\"X-Gearman-Unique: curl_function_TEST\""); curl.add_option("--data", "fubar"); curl.add_option("--silent"); curl.add_option("--show-error"); curl.add_option("--output", "var/tmp/curl_function_TEST.out"); curl.add_option("--connect-timeout", "1"); curl.add_option(worker_url); ASSERT_EQ(Application::SUCCESS, curl.run()); ASSERT_EQ(Application::SUCCESS, curl.join()); test_zero(curl.stdout_result_length()); struct stat stat_buffer; test_zero(stat("var/tmp/curl_function_TEST.out", &stat_buffer)); test_true(stat_buffer.st_size >= off_t(146)); test_zero(unlink("var/tmp/curl_function_TEST.out")); return TEST_SUCCESS; } static test_return_t GET_TEST(void *) { libtest::http::GET get(host_url); ASSERT_EQ(true, get.execute()); return TEST_SUCCESS; } static test_return_t HEAD_TEST(void *) { libtest::http::HEAD head(host_url); ASSERT_EQ(true, head.execute()); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t& error) { if (valgrind_is_caller()) { error= TEST_SKIPPED; return NULL; } in_port_t http_port= libtest::get_free_port(); int length= snprintf(host_url, sizeof(host_url), "http://localhost:%d/", int(http_port)); fatal_assert(length > 0 and sizeof(length) < sizeof(host_url)); char buffer[1024]; length= snprintf(buffer, sizeof(buffer), "--http-port=%d", int(http_port)); fatal_assert(length > 0 and sizeof(length) < sizeof(buffer)); const char *argv[]= { "--protocol=http", buffer, 0 }; if (server_startup(servers, "gearmand", libtest::default_port(), argv) == false) { error= TEST_SKIPPED; return NULL; } worker_handles_st *workers= new worker_handles_st(); gearman_function_t echo_react_fn= gearman_function_create(echo_or_react_worker_v2); workers->push(test_worker_start(libtest::default_port(), NULL, WORKER_FUNCTION_NAME, echo_react_fn, NULL, gearman_worker_options_t())); return workers; } static bool world_destroy(void *object) { worker_handles_st *workers= (worker_handles_st *)object; delete workers; return false; } static test_return_t check_for_libcurl(void *) { test_skip(true, HAVE_LIBCURL); return TEST_SUCCESS; } static test_return_t check_for_curl(void *) { test_skip(0, access("/usr/bin/curl", X_OK)); return TEST_SUCCESS; } test_st curl_TESTS[] ={ { "curl /", 0, curl_no_function_TEST }, { "curl /" WORKER_FUNCTION_NAME, 0, curl_function_no_body_TEST }, { "curl /" WORKER_FUNCTION_NAME " --data=fubar", 0, curl_function_TEST }, { 0, 0, 0 } }; test_st GET_TESTS[] ={ { "GET /", 0, GET_TEST }, { 0, 0, 0 } }; test_st HEAD_TESTS[] ={ { "HEAD /", 0, HEAD_TEST }, { 0, 0, 0 } }; test_st regression_TESTS[] ={ { 0, 0, 0 } }; collection_st collection[] ={ { "curl", check_for_curl, 0, curl_TESTS }, { "GET", check_for_libcurl, 0, GET_TESTS }, { "regression", 0, 0, regression_TESTS }, { 0, 0, 0, 0 } }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/task.h0000664000076400007640000000505012107145705016035 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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_check_exception_TEST(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*); test_return_t gearman_client_add_task_status_by_unique_TEST(void*); test_return_t gearman_client_add_task_status_by_unique_NOT_FOUND_TEST(void*); gearmand-1.0.6/tests/burnin.h0000664000076400007640000000346112107145705016374 0ustar00brianbrian00000000000000/* 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 burnin_TEST(void *object); test_return_t burnin_setup(void *object); test_return_t burnin_cleanup(void *object); gearmand-1.0.6/tests/server_options.h0000664000076400007640000000352112107145705020155 0ustar00brianbrian00000000000000/* 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); gearmand-1.0.6/tests/hostile.cc0000664000076400007640000003204612120670041016674 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include using namespace libtest; #include #include #include "libgearman/client.hpp" using namespace org::gearmand; #include "tests/start_worker.h" #include "tests/workers/v2/echo_or_react.h" #include #include #include #include #include #include #define WORKER_FUNCTION_NAME "foo" #ifndef SERVER_TARGET # define SERVER_TARGET "hostile-gearmand" #endif static bool has_hostile() { #if defined(HAVE_LIBHOSTILE) if (HAVE_LIBHOSTILE) { return true; } #endif return false; } static in_port_t hostile_server= 0; static in_port_t& current_server_= hostile_server; static void reset_server() { current_server_= hostile_server; } static in_port_t current_server() { return current_server_; } static void set_server(in_port_t& arg) { current_server_= arg; } struct client_thread_context_st { size_t count; size_t payload_size; client_thread_context_st() : count(0), payload_size(0) { } void increment() { count++; } }; extern "C" { static __attribute__((noreturn)) void *client_thread(void *object) { client_thread_context_st *success= (client_thread_context_st *)object; fatal_assert(success); fatal_assert(success->count == 0); libgearman::Client client(current_server()); { gearman_client_set_timeout(&client, 400); for (size_t x= 0; x < 100; x++) { int oldstate; pthread_setcanceltype(PTHREAD_CANCEL_DISABLE, &oldstate); libtest::vchar_t payload; payload.resize(success->payload_size); gearman_return_t rc; void *value= gearman_client_do(&client, WORKER_FUNCTION_NAME, NULL, &payload[0], payload.size() ? random() % payload.size() : 0, NULL, &rc); pthread_setcanceltype(oldstate, NULL); if (gearman_success(rc)) { success->increment(); } if (value) { free(value); } } } pthread_exit(0); } } namespace { #if defined(HAVE_PTHREAD_TIMEDJOIN_NP) && HAVE_PTHREAD_TIMEDJOIN_NP bool fill_timespec(struct timespec& ts) { #if defined(HAVE_LIBRT) && HAVE_LIBRT if (HAVE_LIBRT) // This won't be called on OSX, etc,... { if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { Error << "clock_gettime(CLOCK_REALTIME) " << strerror(errno); return false; } } #else { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { Error << "gettimeofday() " << strerror(errno); return false; } TIMEVAL_TO_TIMESPEC(&tv, &ts); } #endif return true; } #endif } // namespace static bool join_thread(pthread_t& thread_arg) { int error; if (HAVE_PTHREAD_TIMEDJOIN_NP) { #if defined(HAVE_PTHREAD_TIMEDJOIN_NP) && HAVE_PTHREAD_TIMEDJOIN_NP int limit= 2; while (--limit) { struct timespec ts; if (fill_timespec(ts)) { ts.tv_sec+= 30; switch ((error= pthread_timedjoin_np(thread_arg, NULL, &ts))) { case ETIMEDOUT: continue; case 0: return true; case ESRCH: return false; default: Error << "pthread_timedjoin_np() " << strerror(error); return false; } } } if ((error= pthread_cancel(thread_arg)) != 0) { Error << "pthread_cancel() " << strerror(error); return false; } #endif return true; } if ((error= pthread_join(thread_arg, NULL)) != 0) { Error << "pthread_join() " << strerror(error); return false; } return true; } static test_return_t send_random_port_data_TEST(void* ) { set_alarm(1200, 0); SimpleClient client("localhost", current_server()); for (size_t x= 0; x < 200; ++x) { libtest::vchar_t message_; libtest::vchar_t response_; libtest::vchar::make(message_, size_t(random() % 1024)); client.send_data(message_, response_); } return TEST_SUCCESS; } static test_return_t worker_ramp_exec(const size_t payload_size) { set_alarm(1200, 0); std::vector children; children.resize(number_of_cpus()); std::vector success; success.resize(children.size()); for (size_t x= 0; x < children.size(); x++) { success[x].payload_size= payload_size; pthread_create(&children[x], NULL, client_thread, &success[x]); } for (size_t x= 0; x < children.size(); x++) { pthread_t& thread= children[x]; bool join_success= false; int limit= 3; while (join_success == false and --limit) { join_success= join_thread(thread); } if (join_success == false) { pthread_cancel(thread); Error << "Something went very wrong, it is likely threads were not cleaned up"; } } return TEST_SUCCESS; } static test_return_t worker_ramp_TEST(void *) { return worker_ramp_exec(0); } static test_return_t worker_ramp_1K_TEST(void *) { return worker_ramp_exec(1024); } static test_return_t worker_ramp_10K_TEST(void *) { return worker_ramp_exec(1024*10); } static test_return_t skip_SETUP(void*) { SKIP_IF(true); return TEST_SUCCESS; } static test_return_t worker_ramp_SETUP(void *object) { test_skip_valgrind(); worker_handles_st *handles= (worker_handles_st*)object; gearman_function_t echo_react_fn= gearman_function_create(echo_or_react_worker_v2); for (uint32_t x= 0; x < 10; x++) { worker_handle_st *worker; if ((worker= test_worker_start(current_server(), NULL, WORKER_FUNCTION_NAME, echo_react_fn, NULL, gearman_worker_options_t())) == NULL) { return TEST_FAILURE; } handles->push(worker); } return TEST_SUCCESS; } static test_return_t worker_ramp_TEARDOWN(void* object) { worker_handles_st *handles= (worker_handles_st*)object; handles->reset(); reset_server(); return TEST_SUCCESS; } static test_return_t hostile_gearmand_SETUP(void* object) { test_skip(true, has_hostile()); test_skip_valgrind(); test_skip(true, libtest::is_massive()); // Programmer error assert(hostile_server); set_server(hostile_server); worker_ramp_SETUP(object); return TEST_SUCCESS; } static test_return_t recv_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_recv_close(true, 20, 20); return TEST_SUCCESS; } static test_return_t getaddrinfo_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_getaddrinfo_error(true, 20, 20); return TEST_SUCCESS; } static test_return_t recv_corrupt_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_recv_corrupt(true, 20, 20); return TEST_SUCCESS; } static test_return_t getaddrinfo_TEARDOWN(void* object) { set_getaddrinfo_error(true, 0, 0); worker_handles_st *handles= (worker_handles_st*)object; handles->kill_all(); reset_server(); return TEST_SUCCESS; } static test_return_t recv_TEARDOWN(void* object) { set_recv_close(true, 0, 0); worker_handles_st *handles= (worker_handles_st*)object; handles->kill_all(); reset_server(); return TEST_SUCCESS; } static test_return_t send_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_send_close(true, 20, 20); return TEST_SUCCESS; } static test_return_t accept_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_accept_close(true, 20, 20); return TEST_SUCCESS; } static test_return_t connect_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_connect_close(true, 20, 20); return TEST_SUCCESS; } static test_return_t poll_HOSTILE_POLL_CLOSED_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_poll_close(true, 4, 0, HOSTILE_POLL_CLOSED); return TEST_SUCCESS; } static test_return_t poll_HOSTILE_POLL_SHUT_WR_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_poll_close(true, 4, 0, HOSTILE_POLL_SHUT_WR); return TEST_SUCCESS; } static test_return_t poll_HOSTILE_POLL_SHUT_RD_SETUP(void* object) { test_skip_valgrind(); test_skip(true, libtest::is_massive()); worker_ramp_SETUP(object); set_poll_close(true, 4, 0, HOSTILE_POLL_SHUT_RD); return TEST_SUCCESS; } static test_return_t poll_TEARDOWN(void* object) { set_poll_close(false, 0, 0, HOSTILE_POLL_CLOSED); worker_handles_st *handles= (worker_handles_st*)object; handles->kill_all(); reset_server(); return TEST_SUCCESS; } static test_return_t send_TEARDOWN(void* object) { set_send_close(true, 0, 0); worker_handles_st *handles= (worker_handles_st*)object; handles->kill_all(); reset_server(); return TEST_SUCCESS; } static test_return_t accept_TEARDOWN(void* object) { set_accept_close(true, 0, 0); worker_handles_st *handles= (worker_handles_st*)object; handles->kill_all(); reset_server(); return TEST_SUCCESS; } static test_return_t connect_TEARDOWN(void* object) { set_connect_close(true, 0, 0); worker_handles_st *handles= (worker_handles_st*)object; handles->kill_all(); reset_server(); return TEST_SUCCESS; } /*********************** World functions **************************************/ static void *world_create(server_startup_st& servers, test_return_t&) { SKIP_IF(has_hostile() == false); hostile_server= libtest::get_free_port(); ASSERT_TRUE(server_startup(servers, SERVER_TARGET, hostile_server, NULL)); return new worker_handles_st; } static bool world_destroy(void *object) { worker_handles_st *handles= (worker_handles_st *)object; delete handles; return TEST_SUCCESS; } test_st dos_TESTS[] ={ {"send random port data", 0, send_random_port_data_TEST }, {0, 0, 0} }; test_st worker_TESTS[] ={ {"first pass", 0, worker_ramp_TEST }, {"second pass", 0, worker_ramp_TEST }, {"first pass 1K jobs", 0, worker_ramp_1K_TEST }, {"first pass 10K jobs", 0, worker_ramp_10K_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"dos", skip_SETUP, 0, dos_TESTS }, {"plain", worker_ramp_SETUP, worker_ramp_TEARDOWN, worker_TESTS }, {"plain against hostile server", hostile_gearmand_SETUP, worker_ramp_TEARDOWN, worker_TESTS }, {"hostile recv()", recv_SETUP, recv_TEARDOWN, worker_TESTS }, {"hostile recv() corrupt", recv_corrupt_SETUP, recv_TEARDOWN, worker_TESTS }, {"hostile send()", send_SETUP, send_TEARDOWN, worker_TESTS }, {"hostile accept()", accept_SETUP, accept_TEARDOWN, worker_TESTS }, {"hostile connect()", connect_SETUP, connect_TEARDOWN, worker_TESTS }, {"hostile poll(CLOSED)", poll_HOSTILE_POLL_CLOSED_SETUP, poll_TEARDOWN, worker_TESTS }, {"hostile poll(SHUT_RD)", poll_HOSTILE_POLL_SHUT_RD_SETUP, poll_TEARDOWN, worker_TESTS }, {"hostile poll(SHUT_WR)", poll_HOSTILE_POLL_SHUT_WR_SETUP, poll_TEARDOWN, worker_TESTS }, {"hostile getaddrinfo()", getaddrinfo_SETUP, getaddrinfo_TEARDOWN, worker_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/redis.cc0000664000076400007640000000437212107145705016345 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include #define WORKER_FUNCTION "hiredis_queue_test" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--check-args", "--redis-server=localhost", "--redis-port=6379", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t collection_init(void *object) { Context *test= (Context *)object; assert(test); const char *argv[]= { "--queue-type=redis", 0 }; test->initialize(argv); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { return new Context(default_port(), servers); } static bool world_destroy(void *object) { SKIP_IF(HAVE_UUID_UUID_H != 1); Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"all options", 0, gearmand_basic_option_test }, {0, 0, 0} }; 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[] ={ {"redis queue", collection_init, collection_cleanup, tests}, {"regressions", collection_init, collection_cleanup, regressions}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/sqlite_test.cc0000664000076400007640000003015212125243252017566 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include #include using namespace libtest; #include #include #include #include #include #include #define GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE "gearman_queue" #include #include #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/workers/v2/called.h" #include // Prototypes #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static int sql_print(void *, int argc, char **argv, char **) { (void)argc; (void)argv; assert(argc == 2); return 0; } static int sql_count(void * rows_, int argc, char **argv, char **) { if (argc) { int *rows= (int*)rows_; *rows= atoi(argv[0]); } return 0; } class Sqlite { public: Sqlite(const std::string& schema_) { if (sqlite3_open(schema_.c_str(), &_db) != SQLITE_OK) { FAIL(sqlite3_errmsg(_db)); } sqlite3_busy_timeout(_db, 6000); } ~Sqlite() { if (_db) { sqlite3_close(_db); _db= NULL; } } int vcount() { reset_error(); std::string count_query; count_query+= "SELECT count(*) FROM "; count_query+= GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE; int rows= 0; char *err= NULL; sqlite3_exec(_db, count_query.c_str(), sql_count, &rows, &err); if (err != NULL) { _error_string= err; sqlite3_free(err); return -1; } return rows; } void vprint_unique() { reset_error(); std::string count_query; count_query+= "SELECT unique_key, function_name FROM "; count_query+= GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE; char *err= NULL; sqlite3_exec(_db, count_query.c_str(), sql_print, NULL, &err); if (err != NULL) { _error_string= err; sqlite3_free(err); } } bool has_error() { return _error_string.size(); } const std::string& error_string() { return _error_string; } protected: void reset_error() { _error_string.clear(); } std::string _error_string; private: sqlite3 *_db; }; static bool test_for_HAVE_LIBSQLITE3() { if (HAVE_LIBSQLITE3) { return true; } return false; } static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--check-args", "--queue-type=libsqlite3", "--libsqlite3-db=var/tmp/gearman.sql", "--libsqlite3-table=var/tmp/table", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t gearmand_basic_option_without_table_test(void *) { std::string sql_file= libtest::create_tmpfile("sqlite"); char sql_buffer[1024]; snprintf(sql_buffer, sizeof(sql_buffer), "--libsqlite3-db=%.*s", int(sql_file.length()), sql_file.c_str()); const char *args[]= { "--check-args", "--queue-type=libsqlite3", sql_buffer, 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); ASSERT_EQ(-1, access(sql_file.c_str(), R_OK | W_OK )); return TEST_SUCCESS; } static test_return_t collection_init(void *object) { std::string sql_file= libtest::create_tmpfile("sqlite"); char sql_buffer[1024]; snprintf(sql_buffer, sizeof(sql_buffer), "--libsqlite3-db=%.*s", int(sql_file.length()), sql_file.c_str()); const char *argv[]= { "--queue-type=libsqlite3", sql_buffer, 0 }; Context *test= (Context *)object; test_true(test); test->reset(); test_truth(test->initialize(argv)); ASSERT_EQ(0, access(sql_file.c_str(), R_OK | W_OK )); test->extra_file(sql_file.c_str()); std::string sql_journal_file(sql_file); sql_journal_file+= "-journal"; test->extra_file(sql_journal_file); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); return TEST_SUCCESS; } #ifdef __clang__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wstack-protector" #endif // __clang__ static test_return_t queue_restart_TEST(Context const* test, const int32_t inserted_jobs, uint32_t timeout) { SKIP_IF(HAVE_UUID_UUID_H != 1); server_startup_st &servers= test->_servers; std::string sql_file= libtest::create_tmpfile("sqlite"); Sqlite sql_handle(sql_file); char sql_buffer[1024]; snprintf(sql_buffer, sizeof(sql_buffer), "--libsqlite3-db=%.*s", int(sql_file.length()), sql_file.c_str()); const char *argv[]= { "--queue-type=libsqlite3", sql_buffer, 0 }; { in_port_t first_port= libtest::get_free_port(); ASSERT_TRUE(server_startup(servers, "gearmand", first_port, argv)); ASSERT_EQ(0, access(sql_file.c_str(), R_OK | W_OK )); { libgearman::Worker worker(first_port); ASSERT_EQ(gearman_worker_register(&worker, __func__, 0), GEARMAN_SUCCESS); } { libgearman::Client client(first_port); ASSERT_EQ(gearman_client_echo(&client, test_literal_param("This is my echo test")), GEARMAN_SUCCESS); gearman_job_handle_t job_handle; for (int32_t x= 0; x < inserted_jobs; ++x) { switch (random() % 3) { case 0: ASSERT_EQ(gearman_client_do_background(&client, __func__, // func NULL, // unique test_literal_param("foo"), job_handle), GEARMAN_SUCCESS); break; case 1: ASSERT_EQ(gearman_client_do_low_background(&client, __func__, // func NULL, // unique test_literal_param("fudge"), job_handle), GEARMAN_SUCCESS); break; default: case 2: ASSERT_EQ(gearman_client_do_high_background(&client, __func__, // func NULL, // unique test_literal_param("history"), job_handle), GEARMAN_SUCCESS); break; } } } servers.clear(); } { if (sql_handle.vcount() != inserted_jobs) { ASSERT_EQ_(false, sql_handle.has_error(), "sqlite: %s", sql_handle.error_string().c_str()); Out << "sql_handle.vprint_unique()"; sql_handle.vprint_unique(); } ASSERT_EQ(sql_handle.vcount(), inserted_jobs); } ASSERT_EQ(0, access(sql_file.c_str(), R_OK | W_OK )); { in_port_t first_port= libtest::get_free_port(); test_true(server_startup(servers, "gearmand", first_port, argv)); if (timeout) { servers.last()->timeout(timeout); } { libgearman::Worker worker(first_port); Called called; gearman_function_t counter_function= gearman_function_create(called_worker); ASSERT_EQ(gearman_worker_define_function(&worker, test_literal_param(__func__), counter_function, 3000, &called), GEARMAN_SUCCESS); const int32_t max_timeout= 4; int32_t max_timeout_value= max_timeout; int32_t job_count= 0; gearman_return_t ret; do { ret= gearman_worker_work(&worker); if (gearman_success(ret)) { job_count++; max_timeout_value= max_timeout; if (job_count == inserted_jobs) { break; } } else if (ret == GEARMAN_TIMEOUT) { Error << " hit timeout"; if ((--max_timeout_value) < 0) { break; } } } while (ret == GEARMAN_TIMEOUT or ret == GEARMAN_SUCCESS); ASSERT_EQ(called.count(), inserted_jobs); } servers.clear(); } { if (sql_handle.vcount() != 0) { ASSERT_EQ_(false, sql_handle.has_error(), "sqlite: %s", sql_handle.error_string().c_str()); Out << "sql_handle.vprint_unique()"; sql_handle.vprint_unique(); } ASSERT_EQ(0, sql_handle.vcount()); } return TEST_SUCCESS; } #ifdef __clang__ # pragma GCC diagnostic pop #endif // __clang__ static test_return_t lp_1054377_TEST(void* object) { Context *test= (Context *)object; test_truth(test); return queue_restart_TEST(test, 8, 0); } static test_return_t lp_1054377x200_TEST(void* object) { test_skip(true, libtest::is_massive()); Context *test= (Context *)object; test_truth(test); return queue_restart_TEST(test, 200, 200); } static test_return_t skip_SETUP(void*) { SKIP_IF(true); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { SKIP_IF(HAVE_UUID_UUID_H != 1); SKIP_IF(test_for_HAVE_LIBSQLITE3() == false); return new Context(libtest::get_free_port(), servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"--libsqlite3-db=var/tmp/schema --libsqlite3-table=var/tmp/table", 0, gearmand_basic_option_test }, {"--libsqlite3-db=var/tmp/schema", 0, gearmand_basic_option_without_table_test }, {0, 0, 0} }; 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} }; test_st queue_restart_TESTS[] ={ {"lp:1054377", 0, lp_1054377_TEST }, {"lp:1054377 x 200", 0, lp_1054377x200_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"gearmand options", 0, 0, gearmand_basic_option_tests}, {"sqlite queue", collection_init, collection_cleanup, tests}, {"queue regression", collection_init, collection_cleanup, regressions}, {"queue restart", skip_SETUP, 0, queue_restart_TESTS}, #if 0 {"sqlite queue change table", collection_init, collection_cleanup, tests}, #endif {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/cpp_test.cc0000664000076400007640000000076312107145705017060 0ustar00brianbrian00000000000000/* 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. */ /* * @brief C++ dummy test, aka testing C++ linking, etc */ #include // For EXIT_SUCCESS #include int main(void) { gearman_client_st client; gearman_client_create(&client); gearman_client_free(&client); return EXIT_SUCCESS; } gearmand-1.0.6/tests/round_robin.cc0000664000076400007640000002141512120666422017553 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/start_worker.h" struct Context { bool run_worker; in_port_t _port; uint32_t _retries; server_startup_st& servers; Context(server_startup_st& arg, in_port_t port_arg) : run_worker(false), _port(port_arg), _retries(0), servers(arg) { } uint32_t retries() { return _retries; } uint32_t retries(const uint32_t arg) { return _retries= arg; } in_port_t port() const { return _port; } ~Context() { reset(); } void reset() { servers.clear(); _port= libtest::get_free_port(); _retries= 0; } }; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif /* append test for worker */ static gearman_return_t append_function_WORKER(gearman_job_st* job, void *context_arg) { /* this will will set the last char in the context (buffer) to the */ /* first char of the work */ char *buf = (char *)context_arg; assert(buf); char *work = (char *)gearman_job_workload(job); buf+= strlen(buf); *buf= *work; return GEARMAN_SUCCESS; } static test_return_t queue_add(void *object) { Context *context= (Context *)object; test_truth(context); libgearman::Client client(context->port()); char job_handle[GEARMAN_JOB_HANDLE_SIZE]; uint8_t *value= (uint8_t *)malloc(1); *value= uint8_t('0'); size_t value_length= 1; context->run_worker= false; /* 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++) { ASSERT_EQ(GEARMAN_SUCCESS, gearman_client_do_background(&client, (x % 2) ? "queue1" : "queue2", NULL, value, value_length, job_handle)); *value = (uint8_t)(*value +1); } free(value); context->run_worker= true; return TEST_SUCCESS; } static test_return_t queue_worker(void *object) { Context *context= (Context *)object; test_truth(context); libgearman::Worker worker(context->port()); char buffer[11]; memset(buffer, 0, sizeof(buffer)); test_truth(context->run_worker); gearman_function_t append_function_FN= gearman_function_create(append_function_WORKER); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_define_function(&worker, test_literal_param("queue1"), append_function_FN, 0, buffer)); ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_define_function(&worker, test_literal_param("queue2"), append_function_FN, 0, buffer)); for (uint32_t x= 0; x < 10; x++) { ASSERT_EQ(GEARMAN_SUCCESS, gearman_worker_work(&worker)); } // expect buffer to be reassembled in a predictable round robin order test_strcmp("1032547698", buffer); return TEST_SUCCESS; } struct Limit { uint32_t _count; uint32_t _expected; bool _limit; Limit(uint32_t expected_arg, bool limit_arg= false) : _count(0), _expected(expected_arg), _limit(limit_arg) { } void increment() { _count++; } void reset() { _count= 0; } uint32_t count() { return _count; } uint32_t expected() { return _expected; } gearman_return_t response() const { if (_limit) { return GEARMAN_SUCCESS; } return GEARMAN_FATAL; } bool complete() { if (_limit and _count == _expected) { return true; } return false; } }; // The idea is to return GEARMAN_ERROR until we hit limit, then return // GEARMAN_SUCCESS static gearman_return_t job_retry_WORKER(gearman_job_st* job, void *context_arg) { (void)(job); assert(gearman_job_workload_size(job) == 0); assert(gearman_job_workload(job) == NULL); Limit *limit= (Limit*)context_arg; if (limit->complete()) { return GEARMAN_SUCCESS; } limit->increment(); return GEARMAN_ERROR; } static test_return_t _job_retry_TEST(Context *context, Limit& limit) { gearman_function_t job_retry_FN= gearman_function_create(job_retry_WORKER); std::auto_ptr handle(test_worker_start(context->port(), NULL, __func__, job_retry_FN, &limit, gearman_worker_options_t(), 0)); // timeout libgearman::Client client(context->port()); gearman_return_t rc; test_null(gearman_client_do(&client, __func__, NULL, // unique NULL, 0, // workload NULL, // result size &rc)); ASSERT_EQ(uint32_t(limit.expected()), uint32_t(limit.count())); ASSERT_EQ(limit.response(), rc); return TEST_SUCCESS; } static test_return_t job_retry_GEARMAN_SUCCESS_TEST(void *object) { Context *context= (Context *)object; Limit limit(context->retries() -1, true); return _job_retry_TEST(context, limit); } static test_return_t job_retry_limit_GEARMAN_SUCCESS_TEST(void *object) { Context *context= (Context *)object; if (context->retries() < 2) { return TEST_SKIPPED; } for (uint32_t x= 1; x < context->retries(); x++) { Limit limit(uint32_t(x -1), true); ASSERT_EQ(TEST_SUCCESS, _job_retry_TEST(context, limit)); } return TEST_SUCCESS; } static test_return_t job_retry_GEARMAN_FATAL_TEST(void *object) { Context *context= (Context *)object; Limit limit(context->retries()); return _job_retry_TEST(context, limit); } static test_return_t round_robin_SETUP(void *object) { Context *context= (Context *)object; const char *argv[]= { "--round-robin", 0 }; if (server_startup(context->servers, "gearmand", context->port(), argv)) { return TEST_SUCCESS; } return TEST_FAILURE; } static test_return_t _job_retries_SETUP(Context *context) { char buffer[1024]; snprintf(buffer, sizeof(buffer), "--job-retries=%u", uint32_t(context->retries())); const char *argv[]= { buffer, 0}; if (server_startup(context->servers, "gearmand", context->port(), argv)) { return TEST_SUCCESS; } return TEST_FAILURE; } static test_return_t job_retries_once_SETUP(void *object) { Context *context= (Context *)object; context->retries(1); return _job_retries_SETUP(context); } static test_return_t job_retries_twice_SETUP(void *object) { Context *context= (Context *)object; context->retries(2); return _job_retries_SETUP(context); } static test_return_t job_retries_ten_SETUP(void *object) { Context *context= (Context *)object; context->retries(10); return _job_retries_SETUP(context); } static test_return_t _TEARDOWN(void *object) { Context *context= (Context *)object; context->reset(); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { Context *context= new Context(servers, libtest::get_free_port()); return context; } static bool world_destroy(void *object) { Context *context= (Context *)object; delete context; return TEST_SUCCESS; } test_st round_robin_TESTS[] ={ {"add", 0, queue_add }, {"worker", 0, queue_worker }, {0, 0, 0} }; test_st job_retry_TESTS[] ={ {"GEARMAN_FATAL", 0, job_retry_GEARMAN_FATAL_TEST }, {"GEARMAN_SUCCESS", 0, job_retry_GEARMAN_SUCCESS_TEST }, {"limit", 0, job_retry_limit_GEARMAN_SUCCESS_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"round_robin", round_robin_SETUP, _TEARDOWN, round_robin_TESTS }, {"--job-retries=1", job_retries_once_SETUP, _TEARDOWN, job_retry_TESTS }, {"--job-retries=2", job_retries_twice_SETUP, _TEARDOWN, job_retry_TESTS }, {"--job-retries=10", job_retries_ten_SETUP, _TEARDOWN, job_retry_TESTS }, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/protocol.h0000664000076400007640000000334112107145705016735 0ustar00brianbrian00000000000000/* 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 *); gearmand-1.0.6/tests/mysql.am0000664000076400007640000000155112107145705016410 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011-2012 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_mysql_test_SOURCES= tests_mysql_test_CXXFLAGS= tests_mysql_test_LDADD= tests_mysql_test_SOURCES+= tests/basic.cc tests_mysql_test_SOURCES+= tests/mysql_test.cc tests_mysql_test_LDADD+= ${CLIENT_LDADD} check_PROGRAMS+= tests/mysql_test noinst_PROGRAMS+= tests/mysql_test test-mysql: tests/mysql_test gearmand/gearmand @tests/mysql_test gdb-mysql: tests/mysql_test gearmand/gearmand @$(GDB_COMMAND) tests/mysql_test valgrind-mysql: tests/mysql_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/mysql_test gearmand-1.0.6/tests/stress.am0000664000076400007640000000123412107145705016564 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2012 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_stress_CFLAGS= tests_stress_CXXFLAGS= tests_stress_LDADD= tests_stress_SOURCES= tests_stress_SOURCES+= tests/burnin.cc tests_stress_LDADD+= libgearman/libgearman.la tests_stress_LDADD+= libtest/libtest.la tests_stress_LDADD+= tests/libstartworker.la check_PROGRAMS+=tests/stress noinst_PROGRAMS+=tests/stress gearmand-1.0.6/tests/memcached_test.cc0000664000076400007640000001762012120714114020173 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Test Libmemcached, memcached for Gearman * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ * Copyright (C) 2008 Brian Aker, Eric Day * * 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED # include # if defined(HAVE_LIBMEMCACHED_UTIL_H) && HAVE_LIBMEMCACHED_UTIL_H # include # endif #endif #include #include #include #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/workers/v2/called.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static in_port_t memcached_port= 0; static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--check-args", "--queue-type=libmemcached", "--libmemcached-servers=localhost:1024", 0 }; ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t lp_1054377_TEST(void *object) { Context *test= (Context *)object; test_truth(test); server_startup_st &servers= test->_servers; memcached_port= libtest::get_free_port(); test_true(server_startup(servers, "memcached", memcached_port, NULL)); char memcached_server_string[1024]; int length= snprintf(memcached_server_string, sizeof(memcached_server_string), "--libmemcached-servers=localhost:%d", int(memcached_port)); test_true(size_t(length) < sizeof(memcached_server_string)); #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED # if defined(HAVE_LIBMEMCACHED_UTIL_H) && HAVE_LIBMEMCACHED_UTIL_H test_true(libmemcached_util_ping("localhost", memcached_port, NULL)); # endif #endif const char *argv[]= { "--queue-type=libmemcached", memcached_server_string, 0 }; const int32_t inserted_jobs= 3; { in_port_t first_port= libtest::get_free_port(); test_true(server_startup(servers, "gearmand", first_port, argv)); #if 0 libtest::Server* server= servers.pop_server(); #endif { libgearman::Worker worker(first_port); ASSERT_EQ(gearman_worker_register(&worker, __func__, 0), GEARMAN_SUCCESS); } { libgearman::Client client(first_port); ASSERT_EQ(gearman_client_echo(&client, test_literal_param("This is my echo test")), GEARMAN_SUCCESS); gearman_job_handle_t job_handle; for (int32_t x= 0; x < inserted_jobs; ++x) { ASSERT_EQ(gearman_client_do_background(&client, __func__, // func NULL, // unique test_literal_param("foo"), job_handle), GEARMAN_SUCCESS); } } #if 0 delete server; #endif } { in_port_t first_port= libtest::get_free_port(); test_true(server_startup(servers, "gearmand", first_port, argv)); { libgearman::Worker worker(first_port); Called called; gearman_function_t counter_function= gearman_function_create(called_worker); ASSERT_EQ(gearman_worker_define_function(&worker, test_literal_param(__func__), counter_function, 3000, &called), GEARMAN_SUCCESS); const int32_t max_timeout= 4; int32_t max_timeout_value= max_timeout; int32_t job_count= 0; gearman_return_t ret; do { ret= gearman_worker_work(&worker); if (gearman_success(ret)) { job_count++; max_timeout_value= max_timeout; if (job_count == inserted_jobs) { break; } } else if (ret == GEARMAN_TIMEOUT) { if ((--max_timeout_value) < 0) { break; } } } while (ret == GEARMAN_TIMEOUT or ret == GEARMAN_SUCCESS); ASSERT_EQ(called.count(), inserted_jobs); } } return TEST_SUCCESS; } static test_return_t collection_init(void *object) { Context *test= (Context *)object; assert(test); memcached_port= libtest::get_free_port(); test_true(server_startup(test->_servers, "memcached", memcached_port, NULL)); char memcached_server_string[1024]; int length= snprintf(memcached_server_string, sizeof(memcached_server_string), "--libmemcached-servers=localhost:%d", int(memcached_port)); test_true(size_t(length) < sizeof(memcached_server_string)); const char *argv[]= { memcached_server_string, "--queue-type=libmemcached", 0 }; test_truth(test->initialize(argv)); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); memcached_port= 0; return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t& error) { if (has_memcached() == false or has_libmemcached() == false) { error= TEST_SKIPPED; return NULL; } return new Context(libtest::get_free_port(), servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"--queue-type=libmemcached --libmemcached-servers=", 0, gearmand_basic_option_test }, {0, 0, 0} }; 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 queue_restart_TESTS[] ={ {"lp:1054377", 0, lp_1054377_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"gearmand options", 0, 0, gearmand_basic_option_tests}, {"memcached queue", collection_init, collection_cleanup, tests}, {"queue restart", 0, collection_cleanup, queue_restart_TESTS}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/tokyocabinet_test.cc0000664000076400007640000001545612120670423020771 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include using namespace libtest; #include #include #include #include #include #include #include "tests/basic.h" #include "tests/context.h" #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "tests/workers/v2/called.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static test_return_t gearmand_basic_option_test(void *) { const char *args[]= { "--check-args", "--queue-type=libtokyocabinet", "--libtokyocabinet-file=var/tmp/gearman_basic.tcb", "--libtokyocabinet-optimize", 0 }; unlink("var/tmp/gearman.tcb"); ASSERT_EQ(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true)); return TEST_SUCCESS; } static test_return_t collection_init(void *object) { const char *argv[]= { "--libtokyocabinet-file=var/tmp/gearman.tcb", "--queue-type=libtokyocabinet", 0 }; unlink("var/tmp/gearman.tcb"); Context *test= (Context *)object; assert(test); test_truth(test->initialize(argv)); return TEST_SUCCESS; } static test_return_t lp_1054377_TEST(void *object) { Context *test= (Context *)object; test_truth(test); server_startup_st &servers= test->_servers; unlink("var/tmp/gearman.tcb"); const char *argv[]= { "--libtokyocabinet-file=var/tmp/gearman.tcb", "--queue-type=libtokyocabinet", 0 }; const int32_t inserted_jobs= 8; { in_port_t first_port= libtest::get_free_port(); test_true(server_startup(servers, "gearmand", first_port, argv)); { libgearman::Worker worker(first_port); ASSERT_EQ(gearman_worker_register(&worker, __func__, 0), GEARMAN_SUCCESS); } { libgearman::Client client(first_port); ASSERT_EQ(gearman_client_echo(&client, test_literal_param("This is my echo test")), GEARMAN_SUCCESS); gearman_job_handle_t job_handle; for (int32_t x= 0; x < inserted_jobs; ++x) { ASSERT_EQ(gearman_client_do_background(&client, __func__, // func NULL, // unique test_literal_param("foo"), job_handle), GEARMAN_SUCCESS); } } servers.clear(); } { in_port_t first_port= libtest::get_free_port(); test_true(server_startup(servers, "gearmand", first_port, argv)); { libgearman::Worker worker(first_port); Called called; gearman_function_t counter_function= gearman_function_create(called_worker); ASSERT_EQ(gearman_worker_define_function(&worker, test_literal_param(__func__), counter_function, 3000, &called), GEARMAN_SUCCESS); const int32_t max_timeout= 4; int32_t max_timeout_value= max_timeout; int32_t job_count= 0; gearman_return_t ret; do { ret= gearman_worker_work(&worker); if (gearman_success(ret)) { job_count++; max_timeout_value= max_timeout; if (job_count == inserted_jobs) { break; } } else if (ret == GEARMAN_TIMEOUT) { if ((--max_timeout_value) < 0) { break; } } } while (ret == GEARMAN_TIMEOUT or ret == GEARMAN_SUCCESS); ASSERT_EQ(called.count(), inserted_jobs); } } unlink("var/tmp/gearman.tcb"); return TEST_SUCCESS; } static test_return_t collection_cleanup(void *object) { Context *test= (Context *)object; test->reset(); unlink("var/tmp/gearman.tcb"); return TEST_SUCCESS; } static void *world_create(server_startup_st& servers, test_return_t&) { SKIP_IF(HAVE_UUID_UUID_H != 1); SKIP_IF(HAVE_TOKYOCABINET != 1); unlink("var/tmp/gearman.tcb"); return new Context(libtest::default_port(), servers); } static bool world_destroy(void *object) { Context *test= (Context *)object; unlink("var/tmp/gearman.tcb"); delete test; return TEST_SUCCESS; } test_st gearmand_basic_option_tests[] ={ {"--libtokyocabinet-file=var/tmp/gearman_basic.tcb --libtokyocabinet-optimize", 0, gearmand_basic_option_test }, {0, 0, 0} }; 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 queue_restart_TESTS[] ={ {"lp:1054377", 0, lp_1054377_TEST }, {0, 0, 0} }; collection_st collection[] ={ {"gearmand options", 0, 0, gearmand_basic_option_tests}, {"tokyocabinet queue", collection_init, collection_cleanup, tests}, {"queue restart", 0, 0, queue_restart_TESTS}, {0, 0, 0, 0} }; void get_world(libtest::Framework *world) { world->collections(collection); world->create(world_create); world->destroy(world_destroy); } gearmand-1.0.6/tests/context.h0000664000076400007640000000613512107145705016564 0ustar00brianbrian00000000000000/* 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 class Context { public: gearman_worker_st *worker; in_port_t _port; std::string _worker_function_name; server_startup_st &_servers; bool run_worker; std::vector _extra_files; Context(in_port_t port_arg, server_startup_st &server_arg): worker(NULL), _port(port_arg), _worker_function_name("queue_test"), _servers(server_arg), run_worker(false) { } ~Context() { extra_clear(); _servers.clear(); } const char *worker_function_name() const { return _worker_function_name.c_str(); } in_port_t port() const { return _port; } bool initialize(const char *argv[]) { if (server_startup(_servers, "gearmand", _port, argv) == false) { return false; } if ((worker= gearman_worker_create(NULL)) == NULL) { return false; } if (gearman_failed(gearman_worker_add_server(worker, NULL, _port))) { return false; } return true; } void extra_file(const std::string& extra_file_) { _extra_files.push_back(extra_file_); } void extra_clear() { for (std::vector::iterator iter= _extra_files.begin(); iter != _extra_files.end(); ++iter) { unlink((*iter).c_str()); } _extra_files.clear(); } void reset() { _servers.clear(); gearman_worker_free(worker); worker= NULL; extra_clear(); } }; gearmand-1.0.6/tests/hostile.am0000664000076400007640000000514112107145705016711 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2012 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_hostile_gearmand_CFLAGS= tests_hostile_gearmand_CXXFLAGS= tests_hostile_gearmand_LDADD= tests_hostile_gearmand_SOURCES= tests_hostile_gearmand_CXXFLAGS+= -DHAVE_LIBHOSTILE=1 tests_hostile_gearmand_CFLAGS+= -DHAVE_LIBHOSTILE=1 tests_hostile_gearmand_LDADD+= libhostile/libhostile.la if TARGET_LINUX tests_hostile_gearmand_LDADD+= @DL_LIB@ tests_hostile_gearmand_LDADD+= @RT_LIB@ endif tests_hostile_gearmand_SOURCES+= tests/hostile.cc tests_hostile_gearmand_LDADD+= libgearman/libgearman.la tests_hostile_gearmand_LDADD+= libtest/libtest.la tests_hostile_gearmand_LDADD+= tests/libstartworker.la check_PROGRAMS+=tests/hostile_gearmand noinst_PROGRAMS+=tests/hostile_gearmand test-hostile-gearmand: tests/hostile_gearmand gearmand/gearmand gearmand/hostile_gearmand @tests/hostile_gearmand valgrind-hostile-gearmand: tests/hostile_gearmand gearmand/gearmand gearmand/hostile_gearmand @$(VALGRIND_COMMAND) tests/hostile_gearmand gdb-hostile-gearmand: tests/hostile_gearmand gearmand/gearmand gearmand/hostile_gearmand @$(GDB_COMMAND) tests/hostile_gearmand tests_hostile_libgearman_CFLAGS= tests_hostile_libgearman_CXXFLAGS= tests_hostile_libgearman_LDADD= tests_hostile_libgearman_SOURCES= tests_hostile_libgearman_CXXFLAGS+= -DHAVE_LIBHOSTILE=1 tests_hostile_libgearman_CFLAGS+= -DHAVE_LIBHOSTILE=1 tests_hostile_libgearman_CXXFLAGS+= -DSERVER_TARGET="\"gearmand\"" tests_hostile_libgearman_CFLAGS+= -DSERVER_TARGET="\"gearmand\"" tests_hostile_libgearman_LDADD+= libhostile/libhostile.la if TARGET_LINUX tests_hostile_libgearman_LDADD+= @DL_LIB@ tests_hostile_libgearman_LDADD+= @RT_LIB@ endif tests_hostile_libgearman_SOURCES+= tests/hostile.cc tests_hostile_libgearman_LDADD+= libgearman/libgearman-hostile.la tests_hostile_libgearman_LDADD+= libtest/libtest.la tests_hostile_libgearman_LDADD+= tests/libstartworker.la # check_PROGRAMS+=tests/hostile_libgearman noinst_PROGRAMS+=tests/hostile_libgearman test-hostile_libgearman: tests/hostile_libgearman gearmand/gearmand @tests/hostile_libgearman valgrind-hostile_libgearman: tests/hostile_libgearman gearmand/gearmand @$(VALGRIND_COMMAND) tests/hostile_libgearman gdb-hostile_libgearman: tests/hostile_libgearman gearmand/gearmand @$(GDB_COMMAND) tests/hostile_libgearman hostile: test-hostile-gearmand test-hostile_libgearman gearmand-1.0.6/tests/unique.h0000664000076400007640000000413412107145705016403 0ustar00brianbrian00000000000000/* 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_SETUP(void *); test_return_t unique_compare_test(void *); test_return_t coalescence_TEST(void*); test_return_t coalescence_by_data_hash_TEST(void*); test_return_t coalescence_by_data_TEST(void*); test_return_t coalescence_by_data_FAIL_TEST(void*); test_return_t gearman_client_unique_status_TEST(void*); test_return_t gearman_client_unique_status_NOT_FOUND_TEST(void *object); gearmand-1.0.6/tests/libdrizzle.am0000664000076400007640000000232112107145705017411 0ustar00brianbrian00000000000000# 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_drizzle_test_CXXFLAGS= tests_drizzle_test_SOURCES= tests_drizzle_test_LDADD= tests_drizzle_test_LDFLAGS= tests_drizzle_test_SOURCES+= tests/basic.cc tests_drizzle_test_SOURCES+= tests/drizzle_test.cc tests_drizzle_test_LDADD+= libgearman/libgearman.la tests_drizzle_test_LDADD+= libtest/libtest.la tests_drizzle_test_LDADD+= tests/libstartworker.la tests_drizzle_test_LDFLAGS+= @LIBDRIZZLE_LDFLAGS@ tests_drizzle_test_LDADD+= @LIBDRIZZLE_LIB@ check_PROGRAMS += tests/drizzle_test noinst_PROGRAMS += tests/drizzle_test test-drizzle: tests/drizzle_test gearmand/gearmand @tests/drizzle_test gdb-drizzle: tests/drizzle_test gearmand/gearmand @$(GDB_COMMAND) tests/drizzle_test helgrind-drizzle: tests/drizzle_test gearmand/gearmand @$(HELGRIND_COMMAND) tests/drizzle_test valgrind-drizzle: tests/drizzle_test gearmand/gearmand @$(VALGRIND_COMMAND) tests/drizzle_test gearmand-1.0.6/tests/gearman_execute_partition.h0000664000076400007640000000417312107145705022325 0ustar00brianbrian00000000000000/* 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 partition_SETUP(void *); test_return_t partition_free_SETUP(void *); 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 *); gearmand-1.0.6/gear_config.in0000664000076400007640000004310612142673670016365 0ustar00brianbrian00000000000000/* gear_config.in. Generated from configure.ac by autoheader. */ #pragma once /* _SYS_FEATURE_TESTS_H is Solaris, _FEATURES_H is GCC */ #if defined( _SYS_FEATURE_TESTS_H) || defined(_FEATURES_H) #error "You should include gear_config.h as your first include file" #endif /* Build libhostile */ #undef BUILD_LIBHOSTILE /* 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 /* Define to 1 to enable debugging code. */ #undef DEBUG /* Name of the drizzled binary used in make test */ #undef DRIZZLED_BINARY /* Another magical number */ #undef EAI_SYSTEM /* machine is big-endian */ #undef ENDIAN_BIG /* machine is little-endian */ #undef ENDIAN_LITTLE /* Name of the gearmand binary used in make test */ #undef GEARMAND_BINARY /* Have Gearman Blobslap Worker */ #undef GEARMAND_BLOBSLAP_WORKER /* Define to 1 if you have the `accept4' function. */ #undef HAVE_ACCEPT4 /* 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 `atexit' function. */ #undef HAVE_ATEXIT /* 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 /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if CYASSL is found */ #undef HAVE_CYASSL /* 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 `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if DL is found */ #undef HAVE_DL /* Have dladdr */ #undef HAVE_DLADDR /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Have dlopen */ #undef HAVE_DLOPEN /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* If Memcached binary is available */ #undef HAVE_DRIZZLED_BINARY /* 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 /* Define to 1 if you have the header file. */ #undef HAVE_EXECINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FEATURES_H /* Define to 1 if you have the header file. */ #undef HAVE_FNMATCH_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* define if the compiler supports GCC C++ ABI name demangling */ #undef HAVE_GCC_ABI_DEMANGLE /* gearmand binary was found */ #undef HAVE_GEARMAND_BINARY /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* 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 HIREDIS is found */ #undef HAVE_HIREDIS /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `bind' library (-lbind). */ #undef HAVE_LIBBIND /* Define to 1 if LIBCURL is found */ #undef HAVE_LIBCURL /* Have dlopen */ #undef HAVE_LIBDL /* Have libdrizzle */ #undef HAVE_LIBDRIZZLE /* Define if event_init is present in event.h. */ #undef HAVE_LIBEVENT /* libgearman support */ #undef HAVE_LIBGEARMAN /* Enable libmemcached support */ #undef HAVE_LIBMEMCACHED /* Define to 1 if you have the header file. */ #undef HAVE_LIBMEMCACHED_1_0_TYPES_RETURN_H /* Have libmemcached-1.0/memcached.h */ #undef HAVE_LIBMEMCACHED_MEMCACHED_H /* Have libmemcachedutil-1.0/util.h */ #undef HAVE_LIBMEMCACHED_UTIL_H /* Define to 1 if MySQL libraries are available */ #undef HAVE_LIBMYSQL_BUILD /* Enable libpq support */ #undef HAVE_LIBPQ /* Have clock_gettime */ #undef HAVE_LIBRT /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Have the SQLITE3 library */ #undef HAVE_LIBSQLITE3 /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MACH_MACH_H /* 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 MCHECK is found */ #undef HAVE_MCHECK /* If Memcached binary is available */ #undef HAVE_MEMCACHED_BINARY /* 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_MORE */ #undef HAVE_MSG_MORE /* Define to 1 if you have a MSG_NOSIGNAL */ #undef HAVE_MSG_NOSIGNAL /* Define to 1 if MySQL libraries are available */ #undef HAVE_MYSQL /* Define to 1 if MySQLD binary is available */ #undef HAVE_MYSQLD_BUILD /* 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 /* Define to 1 if you have O_CLOEXEC defined */ #undef HAVE_O_CLOEXEC /* Define to 1 if you have the `pipe' function. */ #undef HAVE_PIPE /* Define to 1 if you have the `pipe2' function. */ #undef HAVE_PIPE2 /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H /* Define to 1 if PostgreSQL libraries are available */ #undef HAVE_POSTGRESQL /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT /* Define if pthread_timedjoin_np is present in pthread.h. */ #undef HAVE_PTHREAD_TIMEDJOIN_NP /* 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 /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Enable code which requires shared library support. Like backtrace(). */ #undef HAVE_SHARED_ENABLED /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_SPAWN_H /* Have the SQLITE3 library */ #undef HAVE_SQLITE3 /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* 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 /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* 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 `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* 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 the header file. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if TOKYOCABINET is found */ #undef HAVE_TOKYOCABINET /* 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 if uuid_generate_time_safe is present in uuid/uuid.h. */ #undef HAVE_UUID_GENERATE_TIME_SAFE /* Have uuid/uuid.h */ #undef HAVE_UUID_UUID_H /* 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 header file. */ #undef HAVE_WINSOCK2_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 /* OS of Build System */ #undef HOST_OS /* Vendor of Build System */ #undef HOST_VENDOR /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of the memcached binary used in make test */ #undef MEMCACHED_BINARY /* Memcached binary version */ #undef MEMCACHED_VERSION /* Name of the mysqld binary used in make test */ #undef MYSQLD_BINARY /* Define to 1 to disable assert'ing code. */ #undef NDEBUG /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* 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 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 /* OS of Target System */ #undef TARGET_OS /* Whether we are building for FreeBSD */ #undef TARGET_OS_FREEBSD /* Whether we build for Linux */ #undef TARGET_OS_LINUX /* 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 /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if the code was built from VCS. */ #undef VCS_CHECKOUT /* VCS system */ #undef VCS_SYSTEM /* Version number of package */ #undef VERSION /* machine is big-endian */ #undef WORDS_BIGENDIAN /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* 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 /* Define to 500 only on HP-UX. */ #undef _XOPEN_SOURCE /* Workaround for bug in FreeBSD headers */ #undef __APPLE_CC__ /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* 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 the type of a signed integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef int64_t /* Define to a type if does not define. */ #undef mbstate_t /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* 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 /* This seems to be required for older compilers @note http://stackoverflow.com/questions/8132399/how-to-printf-uint64-t */ #ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS #endif #if defined(__cplusplus) # include CINTTYPES_H #else # 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 #define closesocket(a) close(a) #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 gearmand-1.0.6/aclocal.m40000664000076400007640000011510312142673554015430 0ustar00brianbrian00000000000000# generated automatically by aclocal 1.12.2 -*- Autoconf -*- # Copyright (C) 1996-2012 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. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. 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'.])]) # Copyright (C) 2002-2012 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. # serial 8 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.12' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.12.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.12.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2012 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. # serial 2 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2012 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. # serial 10 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2012 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. # serial 17 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [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". rm -rf conftest.dir 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_$1_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 m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [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 10 /bin/sh. echo '/* dummy */' > 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 ;; msvc7 | msvc7msys | 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_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2012 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. # serial 6 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2012 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. # serial 19 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated. For more info, see: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl dnl Support for Objective C++ was only introduced in Autoconf 2.65, dnl but we still cater to Autoconf 2.62. m4_ifdef([AC_PROG_OBJCXX], [AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2012 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. # serial 8 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2012 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2012 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. # serial 5 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2012 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. # serial 7 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2012 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. # serial 6 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 2001-2012 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. # serial 1 # 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-2012 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. # serial 9 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # 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". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2012 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. # serial 3 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2012 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. # serial 2 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2012 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. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2012 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. # serial 3 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_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 AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -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 $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -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_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_add_am_macro.m4]) m4_include([m4/ax_am_jobserver.m4]) m4_include([m4/ax_am_macros.m4]) m4_include([m4/ax_append_compile_flags.m4]) m4_include([m4/ax_append_flag.m4]) m4_include([m4/ax_append_link_flags.m4]) m4_include([m4/ax_append_to_file.m4]) m4_include([m4/ax_assert.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_library.m4]) m4_include([m4/ax_check_link_flag.m4]) m4_include([m4/ax_compare_version.m4]) m4_include([m4/ax_compiler_vendor.m4]) m4_include([m4/ax_compiler_version.m4]) m4_include([m4/ax_count_cpus.m4]) m4_include([m4/ax_cxx_gcc_abi_demangle.m4]) m4_include([m4/ax_debug.m4]) m4_include([m4/ax_dlopen.m4]) m4_include([m4/ax_endian.m4]) m4_include([m4/ax_file_escapes.m4]) m4_include([m4/ax_harden_compiler_flags.m4]) m4_include([m4/ax_hex_version.m4]) m4_include([m4/ax_lib_curl.m4]) m4_include([m4/ax_lib_postgresql.m4]) m4_include([m4/ax_lib_sqlite3.m4]) m4_include([m4/ax_libevent.m4]) m4_include([m4/ax_libmemcached.m4]) m4_include([m4/ax_memcached.m4]) m4_include([m4/ax_path_generic.m4]) m4_include([m4/ax_platform.m4]) m4_include([m4/ax_print_to_file.m4]) m4_include([m4/ax_prog_sphinx_build.m4]) m4_include([m4/ax_pthread.m4]) m4_include([m4/ax_pthread_timedjoin_np.m4]) m4_include([m4/ax_restore_flags.m4]) m4_include([m4/ax_save_flags.m4]) m4_include([m4/ax_uuid.m4]) m4_include([m4/ax_vcs_checkout.m4]) m4_include([m4/ax_with_prog.m4]) m4_include([m4/boost.m4]) m4_include([m4/bottom.m4]) m4_include([m4/extensions.m4]) m4_include([m4/fcntl_flags.m4]) m4_include([m4/have_cinttypes.m4]) m4_include([m4/have_cstdint.m4]) m4_include([m4/have_libpq.m4]) m4_include([m4/hiredis.m4]) m4_include([m4/libdrizzle.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/pandora_enable_dtrace.m4]) m4_include([m4/pandora_have_libtokyocabinet.m4]) m4_include([m4/socket_send_flags.m4]) m4_include([m4/visibility.m4]) gearmand-1.0.6/libgearman-server/0000775000076400007640000000000012142673674017177 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/common.h0000664000076400007640000001514612111357406020633 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 System Include Files */ #pragma once #include #include #include "libgearman/assert.hpp" #ifdef HAVE_FCNTL_H # include #endif #ifdef HAVE_PTHREAD # include #endif #ifdef HAVE_STDARG_H # include #endif #ifdef HAVE_STDDEF_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_UTSNAME_H # include #endif #ifdef HAVE_NETINET_TCP_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 #ifdef __cplusplus extern "C" { #endif #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) #define likely(__x) if((__x)) #define unlikely(__x) if((__x)) #else #define likely(__x) if(__builtin_expect((__x), 1)) #define unlikely(__x) if(__builtin_expect((__x), 0)) #endif /** * Add an object to a list. * @ingroup gearman_constants */ #define GEARMAN_LIST_ADD(__list, __obj, __prefix) { \ if (__list ## _list != NULL) \ __list ## _list->__prefix ## prev= __obj; \ __obj->__prefix ## next= __list ## _list; \ __obj->__prefix ## prev= NULL; \ __list ## _list= __obj; \ __list ## _count++; \ } #define GEARMAN_LIST__ADD(__list, __obj) { \ if (__list ## _list != NULL) \ __list ## _list->prev= __obj; \ __obj->next= __list ## _list; \ __obj->prev= NULL; \ __list ## _list= __obj; \ __list ## _count++; \ } /** * Delete an object from a list. * @ingroup gearman_constants */ #define GEARMAN_LIST_DEL(__list, __obj, __prefix) { \ if (__list ## _list == __obj) \ __list ## _list= __obj->__prefix ## next; \ if (__obj->__prefix ## prev != NULL) \ __obj->__prefix ## prev->__prefix ## next= __obj->__prefix ## next; \ if (__obj->__prefix ## next != NULL) \ __obj->__prefix ## next->__prefix ## prev= __obj->__prefix ## prev; \ __list ## _count--; \ } #define GEARMAN_LIST__DEL(__list, __obj) { \ if (__list ## _list == __obj) \ __list ## _list= __obj->next; \ if (__obj->prev != NULL) \ __obj->prev->next= __obj->next; \ if (__obj->next != NULL) \ __obj->next->prev= __obj->prev; \ __list ## _count--; \ } /** * Add an object to a fifo list. * @ingroup gearman_constants */ #define GEARMAN_FIFO_ADD(__list, __obj, __prefix) { \ if (__list ## _end == NULL) \ __list ## _list= __obj; \ else \ __list ## _end->__prefix ## next= __obj; \ __list ## _end= __obj; \ __list ## _count++; \ } #define GEARMAN_FIFO__ADD(__list, __obj) { \ if (__list ## _end == NULL) \ __list ## _list= __obj; \ else \ __list ## _end->next= __obj; \ __list ## _end= __obj; \ __list ## _count++; \ } /** * Delete an object from a fifo list. * @ingroup gearman_constants */ #define GEARMAN_FIFO_DEL(__list, __obj, __prefix) { \ __list ## _list= __obj->__prefix ## next; \ if (__list ## _list == NULL) \ __list ## _end= NULL; \ __list ## _count--; \ } #define GEARMAN_FIFO__DEL(__list, __obj) { \ __list ## _list= __obj->next; \ if (__list ## _list == NULL) \ __list ## _end= NULL; \ __list ## _count--; \ } /** * Add an object to a hash. * @ingroup gearman_constants */ #define GEARMAN_HASH_ADD(__hash, __key, __obj, __prefix) { \ if (__hash ## _hash[__key] != NULL) \ __hash ## _hash[__key]->__prefix ## prev= __obj; \ __obj->__prefix ## next= __hash ## _hash[__key]; \ __obj->__prefix ## prev= NULL; \ __hash ## _hash[__key]= __obj; \ __hash ## _count++; \ } #define GEARMAN_HASH__ADD(__hash, __key, __obj) { \ if (__hash ## _hash[__key] != NULL) \ __hash ## _hash[__key]->prev= __obj; \ __obj->next= __hash ## _hash[__key]; \ __obj->prev= NULL; \ __hash ## _hash[__key]= __obj; \ __hash ## _count++; \ } /** * Delete an object from a hash. * @ingroup gearman_constants */ #define GEARMAN_HASH_DEL(__hash, __key, __obj, __prefix) { \ if (__hash ## _hash[__key] == __obj) \ __hash ## _hash[__key]= __obj->__prefix ## next; \ if (__obj->__prefix ## prev != NULL) \ __obj->__prefix ## prev->__prefix ## next= __obj->__prefix ## next; \ if (__obj->__prefix ## next != NULL) \ __obj->__prefix ## next->__prefix ## prev= __obj->__prefix ## prev; \ __hash ## _count--; \ } #define GEARMAN_HASH__DEL(__hash, __key, __obj) { \ if (__hash ## _hash[__key] == __obj) \ __hash ## _hash[__key]= __obj->next; \ if (__obj->prev != NULL) \ __obj->prev->next= __obj->next; \ if (__obj->next != NULL) \ __obj->next->prev= __obj->prev; \ __hash ## _count--; \ } #define gearmand_array_size(__object) (sizeof((__object)) / sizeof(*(__object))) #ifdef __cplusplus } #endif #ifdef NI_MAXHOST #define GEARMAND_NI_MAXHOST NI_MAXHOST #else #define GEARMAND_NI_MAXHOST 1025 #endif #ifdef NI_MAXSERV #define GEARMAND_NI_MAXSERV NI_MAXSERV #else #define GEARMAND_NI_MAXSERV 32 #endif gearmand-1.0.6/libgearman-server/timer.cc0000664000076400007640000000757112141152600020614 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include "libgearman-server/common.h" #include #include #include #include #include #include #include #include static pthread_once_t start_key_once= PTHREAD_ONCE_INIT; static pthread_t thread_id; static struct timeval current_epoch; static int wakeup_fd[2]; static __attribute__((noreturn)) void* current_epoch_handler(void*) { gearmand_debug("staring up Epoch thread"); pollfd fds[2]; while (true) { memset(fds, 0, sizeof(pollfd)); fds[0].fd= -1; //STDIN_FILENO; fds[0].events= POLLIN; fds[0].revents= 0; fds[1].fd= wakeup_fd[0]; // wakeup fd fds[1].events= POLLIN; fds[1].revents= 0; int active_fd; if ((active_fd= poll(fds, 2, 1000)) == -1) { gearmand_perror(errno, "poll"); } else { if (fds[1].revents) { pthread_exit(NULL); } gettimeofday(¤t_epoch, NULL); } } pthread_exit(NULL); } namespace libgearman { namespace server { static void startup(void) { wakeup_fd[0]= -1; wakeup_fd[1]= -1; if (setup_shutdown_pipe(wakeup_fd) == false) { fprintf(stderr, "Could not setup pipe\n"); exit(1); } gettimeofday(¤t_epoch, NULL); int error; if ((error= pthread_create(&thread_id, NULL, current_epoch_handler, NULL))) { fprintf(stderr, "pthread_create() failed: %s\n", strerror(error)); exit(1); } } Epoch::Epoch() { (void) pthread_once(&start_key_once, startup); } Epoch::~Epoch() { gearmand_debug("shutting down Epoch thread"); int count= 5; for (size_t x= 0; x < 2; x++) { while (--count) { if (close(wakeup_fd[x]) == -1) { switch(errno) { case EAGAIN: continue; default: break; } } break; // close() } } #if 0 int error; if ((error= pthread_kill(thread_id, SIGPIPE)) != 0) { gearmand_perror(error, "pthread_kill(thread_id, SIGTERM)"); } #endif pthread_join(thread_id, 0); gearmand_debug("shutdown of Epoch completed"); } struct timeval Epoch::current() { return current_epoch; } } // server } // libgearman gearmand-1.0.6/libgearman-server/byteorder.cc0000664000076400007640000000453612107145705021503 0ustar00brianbrian00000000000000/* Taken from libmemcached. */ /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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. * */ #include "gear_config.h" #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; for (uint8_t 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); } gearmand-1.0.6/libgearman-server/struct/0000775000076400007640000000000012142673673020522 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/struct/include.am0000664000076400007640000000145612107145705022461 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011 Data Differential noinst_HEADERS+= \ libgearman-server/struct/client.h \ libgearman-server/struct/connection_list.h \ libgearman-server/struct/function.h \ libgearman-server/struct/gearmand.h \ libgearman-server/struct/gearmand_con.h \ libgearman-server/struct/gearmand_thread.h \ libgearman-server/struct/io.h \ libgearman-server/struct/job.h \ libgearman-server/struct/packet.h \ libgearman-server/struct/port.h \ libgearman-server/struct/server.h \ libgearman-server/struct/thread.h \ libgearman-server/struct/worker.h gearmand-1.0.6/libgearman-server/struct/thread.h0000664000076400007640000000466312107145705022142 0ustar00brianbrian00000000000000/* 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_server_thread_st { uint32_t con_count; uint32_t io_count; uint32_t proc_count; uint32_t to_be_freed_count; uint32_t free_con_count; uint32_t free_packet_count; gearmand_connection_list_st *gearman; gearman_server_thread_st *next; gearman_server_thread_st *prev; 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; gearman_server_con_st *io_list; gearman_server_con_st *proc_list; gearman_server_con_st *free_con_list; gearman_server_con_st *to_be_freed_list; gearman_server_packet_st *free_packet_list; gearmand_connection_list_st gearmand_connection_list_static; pthread_mutex_t lock; }; gearmand-1.0.6/libgearman-server/struct/connection_list.h0000664000076400007640000000411112111602475024046 0ustar00brianbrian00000000000000/* 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_connection_list_st { uint32_t ready_con_count; gearmand_io_st *ready_con_list; 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; gearmand_connection_list_st(); void list_free(); void init(gearmand_event_watch_fn *watch_fn, void *watch_context); }; gearmand-1.0.6/libgearman-server/struct/io.h0000664000076400007640000001127312111602475021272 0ustar00brianbrian00000000000000/* 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 "libgearman-server/plugins/base.h" 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_io_st *ready_next; gearmand_io_st *ready_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]; }; namespace gearmand { namespace protocol {class Context; } } /* Free list for these are stored in gearman_server_thread_st[], otherwise they are owned by gearmand_con_st[] */ struct gearman_server_con_st { gearmand_io_st con; bool is_sleeping; bool is_exceptions; bool is_dead; bool is_noop_sent; bool is_cleaned_up; gearmand_error_t ret; bool io_list; bool proc_list; bool proc_removed; bool to_be_freed_list; uint32_t io_packet_count; uint32_t proc_packet_count; uint32_t worker_count; uint32_t client_count; gearman_server_thread_st *thread; gearman_server_con_st *next; gearman_server_con_st *prev; gearman_server_packet_st *packet; gearman_server_packet_st *io_packet_list; gearman_server_packet_st *io_packet_end; gearman_server_packet_st *proc_packet_list; gearman_server_packet_st *proc_packet_end; gearman_server_con_st *io_next; gearman_server_con_st *io_prev; gearman_server_con_st *proc_next; gearman_server_con_st *proc_prev; gearman_server_con_st *to_be_freed_next; gearman_server_con_st *to_be_freed_prev; 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]; gearmand::protocol::Context* protocol; struct event *timeout_event; gearman_server_con_st() { } ~gearman_server_con_st() { } void set_protocol(gearmand::protocol::Context* arg) { protocol= arg; } void protocol_release() { if (protocol) { protocol->notify(this); if (protocol->is_owner()) { delete protocol; protocol= NULL; } protocol= NULL; } } }; gearmand-1.0.6/libgearman-server/struct/packet.h0000664000076400007640000000467312114264153022140 0ustar00brianbrian00000000000000/* 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 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; enum 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]; void reset(enum gearman_magic_t, gearman_command_t); }; struct gearman_server_packet_st { gearmand_packet_st packet; gearman_server_packet_st *next; }; gearmand-1.0.6/libgearman-server/struct/job.h0000664000076400007640000000475412107145705021446 0ustar00brianbrian00000000000000/* 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_server_job_st { uint8_t retries; gearman_job_priority_t priority; bool ignore_job; bool job_queued; uint32_t job_handle_key; uint32_t unique_key; uint32_t client_count; uint32_t numerator; uint32_t denominator; size_t data_size; int64_t when; gearman_server_job_st *next; gearman_server_job_st *prev; gearman_server_job_st *unique_next; gearman_server_job_st *unique_prev; gearman_server_job_st *worker_next; gearman_server_job_st *worker_prev; gearman_server_function_st *function; gearman_server_job_st *function_next; const void *data; gearman_server_client_st *client_list; gearman_server_worker_st *worker; char job_handle[GEARMAND_JOB_HANDLE_SIZE]; size_t unique_length; char unique[GEARMAN_MAX_UNIQUE_SIZE]; char reducer[GEARMAN_FUNCTION_MAX_SIZE]; }; gearmand-1.0.6/libgearman-server/struct/port.h0000664000076400007640000000420112107145705021643 0ustar00brianbrian00000000000000/* 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_port_st { char port[NI_MAXSERV]; uint32_t listen_count; gearmand_connection_add_fn *add_fn; int *listen_fd; struct event *listen_event; gearmand_port_st() : listen_count(0), add_fn(NULL), listen_fd(NULL), listen_event(NULL) { port[0]= 0; } ~gearmand_port_st() { if (listen_fd) { free(listen_fd); } if (listen_event) { free(listen_event); } } }; gearmand-1.0.6/libgearman-server/struct/gearmand_con.h0000664000076400007640000000372112107145705023302 0ustar00brianbrian00000000000000/* 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_con_st { short last_events; int fd; gearmand_thread_st *thread; gearmand_con_st *next; gearmand_con_st *prev; gearman_server_con_st *server_con; gearmand_connection_add_fn *add_fn; struct event event; char host[NI_MAXHOST]; char port[NI_MAXSERV]; }; gearmand-1.0.6/libgearman-server/struct/worker.h0000664000076400007640000000404112107145705022172 0ustar00brianbrian00000000000000/* 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_server_worker_st { uint32_t job_count; long timeout; // struct timeval.tv_sec gearman_server_con_st *con; gearman_server_worker_st *con_next; gearman_server_worker_st *con_prev; gearman_server_function_st *function; gearman_server_worker_st *function_next; gearman_server_worker_st *function_prev; gearman_server_job_st *job_list; }; gearmand-1.0.6/libgearman-server/struct/gearmand_thread.h0000664000076400007640000000466512107145705024002 0ustar00brianbrian00000000000000/* 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_thread_st { bool is_thread_lock; bool is_wakeup_event; uint32_t count; uint32_t dcon_count; uint32_t dcon_add_count; uint32_t free_dcon_count; int wakeup_fd[2]; gearmand_thread_st *next; gearmand_thread_st *prev; struct event_base *base; gearmand_con_st *dcon_list; gearmand_con_st *dcon_add_list; gearmand_con_st *free_dcon_list; gearman_server_thread_st server_thread; struct event wakeup_event; pthread_t id; pthread_mutex_t lock; gearmand_thread_st(): is_thread_lock(false), is_wakeup_event(false), count(0), dcon_count(0), dcon_add_count(0), free_dcon_count(0), next(NULL), prev(NULL), base(NULL), dcon_list(NULL), dcon_add_list(NULL), free_dcon_list(0) { } }; gearmand-1.0.6/libgearman-server/struct/gearmand.h0000664000076400007640000000641112113572446022445 0ustar00brianbrian00000000000000/* 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 "libgearman-server/struct/server.h" #include "libgearman-server/struct/port.h" #include #include struct gearmand_st { gearmand_verbose_t verbose; gearmand_error_t ret; int backlog; // Set socket backlog for listening connection bool is_listen_event; bool is_wakeup_event; bool _exceptions; int timeout; uint32_t threads; uint32_t thread_count; uint32_t free_dcon_count; uint32_t max_thread_free_dcon_count; int wakeup_fd[2]; char *host; gearmand_log_fn *log_fn; void *log_context; struct event_base *base; gearmand_thread_st *thread_list; gearmand_thread_st *thread_add_next; gearmand_con_st *free_dcon_list; gearman_server_st server; struct event wakeup_event; std::vector _port_list; gearmand_st(const char *host_, uint32_t threads_, int backlog_, const gearmand_verbose_t verbose_, bool exceptions_) : verbose(verbose_), ret(GEARMAN_SUCCESS), backlog(backlog_), is_listen_event(false), is_wakeup_event(false), _exceptions(exceptions_), timeout(-1), threads(threads_), thread_count(0), free_dcon_count(0), max_thread_free_dcon_count(0), host(NULL), log_fn(NULL), log_context(NULL), base(NULL), thread_list(NULL), thread_add_next(NULL), free_dcon_list(NULL) { if (host_) { host= strdup(host_); } wakeup_fd[0]= -1; wakeup_fd[1]= -1; } ~gearmand_st() { if (host) { free(host); } } bool exceptions() const { return _exceptions; } }; gearmand-1.0.6/libgearman-server/struct/client.h0000664000076400007640000000412012114264153022132 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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_server_client_st { gearman_server_con_st *con; gearman_server_client_st *con_next; gearman_server_client_st *con_prev; gearman_server_job_st *job; gearman_server_client_st *job_next; gearman_server_client_st *job_prev; void init(gearman_server_con_st* con_) { con= con_; con_next= NULL; con_prev= NULL; job= NULL; job_next= NULL; job_prev= NULL; } }; gearmand-1.0.6/libgearman-server/struct/function.h0000664000076400007640000000422112107145705022506 0ustar00brianbrian00000000000000/* 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_server_function_st { uint32_t worker_count; uint32_t job_count; uint32_t job_total; uint32_t job_running; uint32_t max_queue_size[GEARMAN_JOB_PRIORITY_MAX]; size_t function_name_size; gearman_server_function_st *next; gearman_server_function_st *prev; char *function_name; gearman_server_worker_st *worker_list; struct gearman_server_job_st *job_list[GEARMAN_JOB_PRIORITY_MAX]; gearman_server_job_st *job_end[GEARMAN_JOB_PRIORITY_MAX]; }; gearmand-1.0.6/libgearman-server/struct/server.h0000664000076400007640000000721612111602475022173 0ustar00brianbrian00000000000000/* 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 queue_st { 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_st() : _context(NULL), _add_fn(NULL), _flush_fn(NULL), _done_fn(NULL), _replay_fn(NULL) { } }; enum queue_version_t { QUEUE_VERSION_NONE, QUEUE_VERSION_FUNCTION, QUEUE_VERSION_CLASS }; namespace gearmand { namespace queue { class Context; } } struct Queue_st { struct queue_st* functions; gearmand::queue::Context* object; }; struct gearman_server_st { struct Flags { /* 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; struct State { bool queue_startup; } state; bool shutdown; bool shutdown_graceful; bool proc_wakeup; bool proc_shutdown; uint32_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; uint32_t job_count; uint32_t unique_count; uint32_t free_packet_count; uint32_t free_job_count; uint32_t free_client_count; uint32_t free_worker_count; gearman_server_thread_st *thread_list; gearman_server_function_st **function_hash; 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; enum queue_version_t queue_version; struct Queue_st queue; pthread_mutex_t proc_lock; pthread_cond_t proc_cond; pthread_t proc_id; char job_handle_prefix[GEARMAND_JOB_HANDLE_SIZE]; uint32_t hashtable_buckets; gearman_server_job_st **job_hash; gearman_server_job_st **unique_hash; gearman_server_st() { } ~gearman_server_st() { } }; gearmand-1.0.6/libgearman-server/include.am0000664000076400007640000000703412122444522021127 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day # Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor # 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 # libgearman_server_libgearman_server_la_CFLAGS= libgearman_server_libgearman_server_la_CXXFLAGS= libgearman_server_libgearman_server_la_LDFLAGS= libgearman_server_libgearman_server_la_LIBADD= libgearman_server_libgearman_server_la_SOURCES= include libgearman-server/struct/include.am include libgearman-server/error/include.am include libgearman-server/plugins/include.am noinst_LTLIBRARIES+= libgearman-server/libgearman-server.la noinst_HEADERS+= libgearman-server/connection.hpp noinst_HEADERS+= libgearman-server/queue.h noinst_HEADERS+= libgearman-server/queue.hpp noinst_HEADERS+= libgearman-server/text.h noinst_HEADERS+= \ libgearman-server/byte.h \ libgearman-server/byteorder.h \ libgearman-server/client.h \ libgearman-server/common.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/io.h \ libgearman-server/job.h \ libgearman-server/log.h \ libgearman-server/packet.h \ libgearman-server/plugins.h \ libgearman-server/server.h \ libgearman-server/struct/port.h \ libgearman-server/thread.h \ libgearman-server/timer.h \ libgearman-server/verbose.h \ libgearman-server/wakeup.h \ libgearman-server/worker.h libgearman_server_libgearman_server_la_SOURCES+= libgearman/backtrace.cc libgearman_server_libgearman_server_la_SOURCES+= libgearman/pipe.cc libgearman_server_libgearman_server_la_SOURCES+= libgearman/vector.cc libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/text.cc libgearman_server_libgearman_server_la_SOURCES+= \ libgearman-server/byteorder.cc \ libgearman-server/client.cc \ libgearman-server/connection.cc \ libgearman-server/function.cc \ libgearman-server/gearmand.cc \ libgearman-server/gearmand_con.cc \ libgearman-server/gearmand_thread.cc \ libgearman-server/io.cc \ libgearman-server/job.cc \ libgearman-server/log.cc \ libgearman-server/packet.cc \ libgearman-server/plugins.cc \ libgearman-server/queue.cc \ libgearman-server/server.cc \ libgearman-server/thread.cc \ libgearman-server/timer.cc \ libgearman-server/wakeup.cc \ libgearman-server/worker.cc \ libgearman/command.cc \ libgearman/strcommand.cc libgearman_server_libgearman_server_la_CFLAGS+= @PTHREAD_CFLAGS@ libgearman_server_libgearman_server_la_CFLAGS+= -DBUILDING_LIBGEARMAN libgearman_server_libgearman_server_la_CXXFLAGS+= @BOOST_CPPFLAGS@ libgearman_server_libgearman_server_la_CXXFLAGS+= @PTHREAD_CFLAGS@ libgearman_server_libgearman_server_la_CXXFLAGS+= -DBUILDING_LIBGEARMAN libgearman_server_libgearman_server_la_LIBADD+= @LIBEVENT_LIB@ libgearman_server_libgearman_server_la_LIBADD+= @PTHREAD_LIBS@ libgearman_server_libgearman_server_la_LIBADD+= $(BOOST_PROGRAM_OPTIONS_LIBS) libgearman_server_libgearman_server_la_LIBADD+= @LIBM@ libgearman_server_libgearman_server_la_LIBADD+= @DL_LIB@ libgearman_server_libgearman_server_la_LIBADD+= @RT_LIB@ gearmand-1.0.6/libgearman-server/plugins/0000775000076400007640000000000012142673674020660 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/include.am0000664000076400007640000000066012107145705022612 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011 Data Differential noinst_HEADERS+= libgearman-server/plugins/base.h noinst_HEADERS+= libgearman-server/plugins/protocol.h noinst_HEADERS+= libgearman-server/plugins/queue.h libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/base.cc include libgearman-server/plugins/protocol/include.am include libgearman-server/plugins/queue/include.am gearmand-1.0.6/libgearman-server/plugins/protocol/0000775000076400007640000000000012142673673022520 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/protocol/include.am0000664000076400007640000000063412107145705024454 0ustar00brianbrian00000000000000# 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 include libgearman-server/plugins/protocol/gear/include.am gearmand-1.0.6/libgearman-server/plugins/protocol/gear/0000775000076400007640000000000012142673674023437 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/protocol/gear/include.am0000664000076400007640000000072012107145705025366 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman # Copyright (C) 2012 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/gear/protocol.h libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/protocol/gear/protocol.cc gearmand-1.0.6/libgearman-server/plugins/protocol/gear/protocol.h0000664000076400007640000000376512107145705025452 0ustar00brianbrian00000000000000 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 Data Differential, gear://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 gearmand { namespace protocol { class Gear : public gearmand::Plugin { private: public: Gear(); ~Gear(); gearmand_error_t start(gearmand_st *gearmand); private: std::string _port; }; } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/gear/protocol.cc0000664000076400007640000002330712107145705025602 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 Gear Protocol Definitions */ #include "gear_config.h" #include #include #include #include #include #include #include "libgearman/command.h" static gearmand_error_t gearmand_packet_unpack_header(gearmand_packet_st *packet) { uint32_t tmp; if (memcmp(packet->args, "\0REQ", 4) == 0) { packet->magic= GEARMAN_MAGIC_REQUEST; } else if (memcmp(packet->args, "\0RES", 4) == 0) { packet->magic= GEARMAN_MAGIC_RESPONSE; } else { gearmand_warning("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; } class Geartext : public gearmand::protocol::Context { public: ~Geartext() { } bool is_owner() { return false; } void notify(gearman_server_con_st *) { gearmand_info("Gear connection disconnected"); } size_t unpack(gearmand_packet_st *packet, gearman_server_con_st *, const void *data, const size_t data_size, gearmand_error_t& ret_ptr) { size_t used_size; gearmand_info("Gear unpack"); if (packet->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 (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= gearmand_packet_create(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); if (gearmand_failed(ret_ptr= gearmand_packet_unpack_header(packet))) { 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) or gearman_command_info(packet->command)->data) { uint8_t* ptr= (uint8_t *)memchr(((uint8_t *)data) +used_size, 0, data_size -used_size); if (ptr == NULL) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Possible protocol error for %s, received 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; if (gearmand_failed((ret_ptr= gearmand_packet_create(packet, ((uint8_t *)data) + used_size, arg_size)))) { 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= gearmand_packet_create(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; } } if (packet->command == GEARMAN_COMMAND_ECHO_RES) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "GEAR length: %" PRIu64 " gearmand_command_t: %s echo: %.*s", uint64_t(packet->data_size), gearman_strcommand(packet->command), int(packet->data_size), packet->data); } else if (packet->command == GEARMAN_COMMAND_TEXT) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "GEAR length: %" PRIu64 " gearmand_command_t: %s text: %.*s", uint64_t(packet->data_size), gearman_strcommand(packet->command), int(packet->data_size), packet->data); } else { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "GEAR length: %" PRIu64 " gearmand_command_t: %s", uint64_t(packet->data_size), gearman_strcommand(packet->command)); } ret_ptr= GEARMAN_SUCCESS; return used_size; } size_t pack(const gearmand_packet_st *packet, gearman_server_con_st*, void *data, const size_t data_size, gearmand_error_t& ret_ptr) { if (packet->command == GEARMAN_COMMAND_ECHO_RES) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "GEAR length: %" PRIu64 " gearmand_command_t: %s echo: %.*", uint64_t(packet->data_size), gearman_strcommand(packet->command), int(packet->data_size), packet->data); } else { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "GEAR length: %" PRIu64 " gearmand_command_t: %s", uint64_t(packet->data_size), gearman_strcommand(packet->command)); } 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; } private: }; static Geartext gear_context; static gearmand_error_t _gear_con_add(gearman_server_con_st *connection) { gearmand_info("Gear connection made"); connection->set_protocol(&gear_context); return GEARMAN_SUCCESS; } namespace gearmand { namespace protocol { Gear::Gear() : Plugin("Gear") { command_line_options().add_options() ("port,p", boost::program_options::value(&_port)->default_value(GEARMAN_DEFAULT_TCP_PORT_STRING), "Port the server should listen on."); } Gear::~Gear() { } gearmand_error_t Gear::start(gearmand_st *gearmand) { gearmand_info("Initializing Gear"); gearmand_error_t rc; if (_port.empty()) { struct servent *gearman_servent= getservbyname(GEARMAN_DEFAULT_TCP_SERVICE, NULL); if (gearman_servent and gearman_servent->s_name) { rc= gearmand_port_add(gearmand, gearman_servent->s_name, _gear_con_add); } else { rc= gearmand_port_add(gearmand, GEARMAN_DEFAULT_TCP_PORT_STRING, _gear_con_add); } } else { rc= gearmand_port_add(gearmand, _port.c_str(), _gear_con_add); } return rc; } } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/http/0000775000076400007640000000000012142673674023500 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/protocol/http/include.am0000664000076400007640000000145712107145705025437 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman # Copyright (C) 2011-2012 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 noinst_HEADERS+= libgearman-server/plugins/protocol/http/method.h noinst_HEADERS+= libgearman-server/plugins/protocol/http/response_codes.h libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/protocol/http/protocol.cc libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/protocol/http/response_codes.cc libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/protocol/http/method.cc gearmand-1.0.6/libgearman-server/plugins/protocol/http/response_codes.h0000664000076400007640000000756412107145705026666 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 protocol { namespace httpd { enum response_t { HTTP_CONTINUE= 100, HTTP_SWITCHING_PROTOCOLS= 101, HTTP_PROCESSING= 102, HTTP_OK= 200, HTTP_CREATED= 201, HTTP_ACCEPTED= 202, HTTP_NON_AUTHORITATIVE= 203, HTTP_NO_CONTENT= 204, HTTP_RESET_CONTENT= 205, HTTP_PARTIAL_CONTENT= 206, HTTP_MULTI_STATUS= 207, HTTP_MULTIPLE_CHOICES= 300, HTTP_MOVED_PERMANENTLY= 301, HTTP_MOVED_TEMPORARILY= 302, HTTP_SEE_OTHER= 303, HTTP_NOT_MODIFIED= 304, HTTP_USE_PROXY= 305, HTTP_TEMPORARY_REDIRECT= 307, HTTP_BAD_REQUEST= 400, HTTP_UNAUTHORIZED= 401, HTTP_PAYMENT_REQUIRED= 402, HTTP_FORBIDDEN= 403, HTTP_NOT_FOUND= 404, HTTP_METHOD_NOT_ALLOWED= 405, HTTP_NOT_ACCEPTABLE= 406, HTTP_PROXY_AUTHENTICATION_REQUIRED=407, HTTP_REQUEST_TIME_OUT= 408, HTTP_CONFLICT= 409, HTTP_GONE= 410, HTTP_LENGTH_REQUIRED= 411, HTTP_PRECONDITION_FAILED= 412, HTTP_REQUEST_ENTITY_TOO_LARGE= 413, HTTP_REQUEST_URI_TOO_LARGE= 414, HTTP_UNSUPPORTED_MEDIA_TYPE= 415, HTTP_RANGE_NOT_SATISFIABLE= 416, HTTP_EXPECTATION_FAILED= 417, HTTP_UNPROCESSABLE_ENTITY= 422, HTTP_LOCKED= 423, HTTP_FAILED_DEPENDENCY= 424, HTTP_UPGRADE_REQUIRED= 426, HTTP_INTERNAL_SERVER_ERROR= 500, HTTP_NOT_IMPLEMENTED= 501, HTTP_BAD_GATEWAY= 502, HTTP_SERVICE_UNAVAILABLE= 503, HTTP_GATEWAY_TIME_OUT= 504, HTTP_VERSION_NOT_SUPPORTED= 505, HTTP_VARIANT_ALSO_VARIES= 506, HTTP_INSUFFICIENT_STORAGE= 507, HTTP_NOT_EXTENDED= 510 }; const char *response(response_t); } // namespace http } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/http/method.h0000664000076400007640000000362112107145705025121 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 protocol { namespace httpd { enum method_t { HEAD, GET, PUT, POST, TRACE }; const char *str_method(method_t); } // namespace http } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/http/method.cc0000664000076400007640000000417612107145705025265 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 namespace gearmand { namespace protocol { namespace httpd { const char *str_method(method_t arg) { switch (arg) { case HEAD: return "HEAD"; case GET: return "GET"; case PUT: return "PUT"; case POST: return "POST"; case TRACE: return "TRACE"; default: break; } return "UNKNOWN"; } } // namespace http } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/http/protocol.h0000664000076400007640000000432212107145705025501 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 HTTP Protocol Declarations */ #pragma once #include #include #include struct gearmand_st; namespace gearmand { namespace protocol { class HTTP : public gearmand::Plugin { public: HTTP(); ~HTTP(); gearmand_error_t start(gearmand_st *gearmand); private: std::string _port; }; } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/http/response_codes.cc0000664000076400007640000001113212107145705027006 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include namespace gearmand { namespace protocol { namespace httpd { const char *response(response_t arg) { switch (arg) { case HTTP_CONTINUE: return "CONTINUE"; case HTTP_SWITCHING_PROTOCOLS: return "SWITCHING_PROTOCOLS"; case HTTP_PROCESSING: return "PROCESSING"; case HTTP_OK: return "OK"; case HTTP_CREATED: return "CREATED"; case HTTP_ACCEPTED: return "ACCEPTED"; case HTTP_NON_AUTHORITATIVE: return "NON_AUTHORITATIVE"; case HTTP_NO_CONTENT: return "NO_CONTENT"; case HTTP_RESET_CONTENT: return "RESET_CONTENT"; case HTTP_PARTIAL_CONTENT: return "PARTIAL_CONTENT"; case HTTP_MULTI_STATUS: return "MULTI_STATUS"; case HTTP_MULTIPLE_CHOICES: return "MULTIPLE_CHOICES"; case HTTP_MOVED_PERMANENTLY: return "MOVED_PERMANENTLY"; case HTTP_MOVED_TEMPORARILY: return "MOVED_TEMPORARILY"; case HTTP_SEE_OTHER: return "SEE_OTHER"; case HTTP_NOT_MODIFIED: return "NOT_MODIFIED"; case HTTP_USE_PROXY: return "USE_PROXY"; case HTTP_TEMPORARY_REDIRECT: return "TEMPORARY_REDIRECT"; case HTTP_BAD_REQUEST: return "BAD_REQUEST"; case HTTP_UNAUTHORIZED: return "UNAUTHORIZED"; case HTTP_PAYMENT_REQUIRED: return "PAYMENT_REQUIRED"; case HTTP_FORBIDDEN: return "FORBIDDEN"; case HTTP_NOT_FOUND: return "NOT_FOUND"; case HTTP_METHOD_NOT_ALLOWED: return "METHOD_NOT_ALLOWED"; case HTTP_NOT_ACCEPTABLE: return "NOT_ACCEPTABLE"; case HTTP_PROXY_AUTHENTICATION_REQUIRED: return "PROXY_AUTHENTICATION_REQUIRED"; case HTTP_REQUEST_TIME_OUT: return "REQUEST_TIME_OUT"; case HTTP_CONFLICT: return "CONFLICT"; case HTTP_GONE: return "GONE"; case HTTP_LENGTH_REQUIRED: return "LENGTH_REQUIRED"; case HTTP_PRECONDITION_FAILED: return "PRECONDITION_FAILED"; case HTTP_REQUEST_ENTITY_TOO_LARGE: return "REQUEST_ENTITY_TOO_LARGE"; case HTTP_REQUEST_URI_TOO_LARGE: return "REQUEST_URI_TOO_LARGE"; case HTTP_UNSUPPORTED_MEDIA_TYPE: return "UNSUPPORTED_MEDIA_TYPE"; case HTTP_RANGE_NOT_SATISFIABLE: return "RANGE_NOT_SATISFIABLE"; case HTTP_EXPECTATION_FAILED: return "EXPECTATION_FAILED"; case HTTP_UNPROCESSABLE_ENTITY: return "UNPROCESSABLE_ENTITY"; case HTTP_LOCKED: return "LOCKED"; case HTTP_FAILED_DEPENDENCY: return "FAILED_DEPENDENCY"; case HTTP_UPGRADE_REQUIRED: return "UPGRADE_REQUIRED"; case HTTP_NOT_IMPLEMENTED: return "NOT_IMPLEMENTED"; case HTTP_BAD_GATEWAY: return "BAD_GATEWAY"; case HTTP_SERVICE_UNAVAILABLE: return "SERVICE_UNAVAILABLE"; case HTTP_GATEWAY_TIME_OUT: return "GATEWAY_TIME_OUT"; case HTTP_VERSION_NOT_SUPPORTED: return "VERSION_NOT_SUPPORTED"; case HTTP_VARIANT_ALSO_VARIES: return "VARIANT_ALSO_VARIES"; case HTTP_INSUFFICIENT_STORAGE: return "INSUFFICIENT_STORAGE"; case HTTP_NOT_EXTENDED: return "NOT_EXTENDED"; case HTTP_INTERNAL_SERVER_ERROR: default: break; } return "INTERNAL_SERVER_ERROR"; } } // namespace http } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol/http/protocol.cc0000664000076400007640000005004112117576613025645 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 HTTP Protocol Definitions */ #include #include #include #include #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" class HTTPtext; /* Protocol callback functions. */ class HTTPtext : public gearmand::protocol::Context { public: HTTPtext() : _method(gearmand::protocol::httpd::TRACE), _sent_header(false), _background(false), _keep_alive(false), _http_response(gearmand::protocol::httpd::HTTP_OK) { } ~HTTPtext() { } void notify(gearman_server_con_st*) { gearmand_debug("HTTP connection disconnected"); } size_t pack(const gearmand_packet_st *packet, gearman_server_con_st *connection, void *send_buffer, const size_t send_buffer_size, gearmand_error_t& ret_ptr) { switch (packet->command) { case GEARMAN_COMMAND_WORK_DATA: { for (const char *ptr= packet->data; ptr <= (packet->data +packet->data_size) -2; ptr++) { content.push_back(*ptr); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "HTTP gearmand_command_t: GEARMAN_COMMAND_WORK_DATA length:%" PRIu64, uint64_t(content.size())); ret_ptr= GEARMAN_IGNORE_PACKET; return 0; } default: case GEARMAN_COMMAND_TEXT: case GEARMAN_COMMAND_CAN_DO: case GEARMAN_COMMAND_CANT_DO: case GEARMAN_COMMAND_RESET_ABILITIES: case GEARMAN_COMMAND_PRE_SLEEP: case GEARMAN_COMMAND_UNUSED: case GEARMAN_COMMAND_NOOP: case GEARMAN_COMMAND_SUBMIT_JOB: case GEARMAN_COMMAND_GRAB_JOB: case GEARMAN_COMMAND_NO_JOB: case GEARMAN_COMMAND_JOB_ASSIGN: case GEARMAN_COMMAND_WORK_STATUS: case GEARMAN_COMMAND_GET_STATUS: case GEARMAN_COMMAND_ECHO_REQ: case GEARMAN_COMMAND_SUBMIT_JOB_BG: case GEARMAN_COMMAND_ERROR: case GEARMAN_COMMAND_STATUS_RES: case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: case GEARMAN_COMMAND_SET_CLIENT_ID: case GEARMAN_COMMAND_CAN_DO_TIMEOUT: case GEARMAN_COMMAND_ALL_YOURS: case GEARMAN_COMMAND_WORK_EXCEPTION: case GEARMAN_COMMAND_OPTION_REQ: case GEARMAN_COMMAND_OPTION_RES: case GEARMAN_COMMAND_WORK_WARNING: case GEARMAN_COMMAND_GRAB_JOB_UNIQ: case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: 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_SCHED: case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: case GEARMAN_COMMAND_GRAB_JOB_ALL: case GEARMAN_COMMAND_JOB_ASSIGN_ALL: case GEARMAN_COMMAND_GET_STATUS_UNIQUE: case GEARMAN_COMMAND_STATUS_RES_UNIQUE: case GEARMAN_COMMAND_MAX: gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Bad packet command: gearmand_command_t:%s", gearman_strcommand(packet->command)); assert(0); case GEARMAN_COMMAND_WORK_FAIL: case GEARMAN_COMMAND_ECHO_RES: case GEARMAN_COMMAND_WORK_COMPLETE: break; case GEARMAN_COMMAND_JOB_CREATED: { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Sending HTTP told to ignore packet: gearmand_command_t:%s", gearman_strcommand(packet->command)); ret_ptr= GEARMAN_IGNORE_PACKET; return 0; } } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Sending HTTP response: Content-length:%" PRIu64 " data_size:%" PRIu64 " gearmand_command_t:%s response:%s", uint64_t(content.size()), uint64_t(packet->data_size), gearman_strcommand(packet->command), gearmand::protocol::httpd::response(response())); size_t pack_size= 0; if (_sent_header == false) { if (response() != gearmand::protocol::httpd::HTTP_OK) { pack_size= (size_t)snprintf((char *)send_buffer, send_buffer_size, "HTTP/1.0 %u %s\r\n" "Server: Gearman/" PACKAGE_VERSION "\r\n" "Content-Length: 0\r\n" "\r\n", int(response()), gearmand::protocol::httpd::response(response())); } else if (method() == gearmand::protocol::httpd::HEAD) { pack_size= (size_t)snprintf((char *)send_buffer, send_buffer_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); } else if (method() == gearmand::protocol::httpd::TRACE) { pack_size= (size_t)snprintf((char *)send_buffer, send_buffer_size, "HTTP/1.0 200 OK\r\n" "Server: Gearman/" PACKAGE_VERSION "\r\n" "Connection: close\r\n" "Content-Type: message/http\r\n" "\r\n"); } else if (method() == gearmand::protocol::httpd::POST) { pack_size= (size_t)snprintf((char *)send_buffer, send_buffer_size, "HTTP/1.0 200 OK\r\n" "X-Gearman-Job-Handle: %.*s\r\n" "X-Gearman-Command: %s\r\n" "Content-Length: %d\r\n" "Server: Gearman/" PACKAGE_VERSION "\r\n" "\r\n%.*s", packet->command == GEARMAN_COMMAND_JOB_CREATED ? int(packet->arg_size[0]) : int(packet->arg_size[0] - 1), (const char *)packet->arg[0], // Job handle gearman_strcommand(packet->command), int(content.size()), // Content-length int(content.size()), &content[0]); } else { pack_size= (size_t)snprintf((char *)send_buffer, send_buffer_size, "HTTP/1.0 200 OK\r\n" "X-Gearman-Job-Handle: %.*s\r\n" "X-Gearman-Command: %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], gearman_strcommand(packet->command), uint64_t(content.size())); } _sent_header= true; } if (pack_size > send_buffer_size) { gearmand_debug("Sending HTTP had to flush"); ret_ptr= GEARMAN_FLUSH_DATA; return 0; } memcpy(send_buffer, &content[0], content.size()); pack_size+= content.size(); #if 0 if (keep_alive() == false) #endif { gearman_io_set_option(&connection->con, GEARMAND_CON_CLOSE_AFTER_FLUSH, true); } ret_ptr= GEARMAN_SUCCESS; return pack_size; } size_t unpack(gearmand_packet_st *packet, gearman_server_con_st *, //connection const void *data, const size_t data_size, gearmand_error_t& ret_ptr) { const char *unique= "-"; size_t unique_size= 2; gearman_job_priority_t priority= GEARMAN_JOB_PRIORITY_NORMAL; gearmand_info("Receiving HTTP response"); /* Get the request line first. */ size_t request_size; size_t offset= 0; const char *request= parse_line(data, data_size, request_size, offset); if (request == NULL or request_size == 0) { gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Zero length request made"); ret_ptr= GEARMAN_IO_WAIT; return offset; } reset(); /* Parse out the method, URI, and HTTP version from the request line. */ const char *uri= (const char *)memchr(request, ' ', request_size); if (uri == NULL) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad request line: %.*s", (uint32_t)request_size, request); set_response(gearmand::protocol::httpd::HTTP_NOT_FOUND); ret_ptr= GEARMAN_SUCCESS; return 0; } { const char *method_str= request; ptrdiff_t method_size= uri -request; if (method_size == 3 and strncmp(method_str, "GET", 3) == 0) { set_method(gearmand::protocol::httpd::GET); } else if (method_size == 3 and strncmp(method_str, "PUT", 3) == 0) { set_method(gearmand::protocol::httpd::PUT); } else if (method_size == 4 and strncmp(method_str, "POST", 4) == 0) { set_method(gearmand::protocol::httpd::POST); } else if (method_size == 4 and strncmp(method_str, "HEAD", 4) == 0) { set_method(gearmand::protocol::httpd::HEAD); } else if (method_size == 5 and strncmp(method_str, "TRACE", 5) == 0) { set_method(gearmand::protocol::httpd::TRACE); } else { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad method: %.*s", (uint32_t)method_size, method_str); set_response(gearmand::protocol::httpd::HTTP_METHOD_NOT_ALLOWED); ret_ptr= GEARMAN_SUCCESS; return 0; } } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "HTTP METHOD: %s", str_method(method())); while (*uri == ' ') { uri++; } // Remove leading / while (*uri == '/') { uri++; } const char *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; } ptrdiff_t uri_size= version -uri; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "HTTP URI: \"%.*s\"", (int)uri_size, uri); switch (method()) { case gearmand::protocol::httpd::POST: case gearmand::protocol::httpd::PUT: case gearmand::protocol::httpd::GET: if (uri_size == 0) { gearmand_error("must give function name in URI"); set_response(gearmand::protocol::httpd::HTTP_NOT_FOUND); } case gearmand::protocol::httpd::TRACE: case gearmand::protocol::httpd::HEAD: break; } while (*version == ' ') { version++; } size_t version_size= request_size - size_t(version - request); if (version_size == 8 and strncmp(version, "HTTP/1.1", 8) == 0) { set_keep_alive(true); } else if (version_size == 8 and strncmp(version, "HTTP/1.0", 8) == 0) { } else { 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. */ const char *header; size_t header_size; while ((header= parse_line(data, data_size, header_size, offset)) != NULL) { if (header_size == 0) { break; } if (header_size > 16 and strncasecmp(header, "Content-Length: ", 16) == 0) { if (method() == gearmand::protocol::httpd::PUT or method() == gearmand::protocol::httpd::POST) { char content_length[11]; /* 11 bytes to fit max display length of uint32_t */ snprintf(content_length, sizeof(content_length), "%.*s", (int)header_size - 16, header + 16); packet->data_size= size_t(atoi(content_length)); } } else if (header_size == 22 and strncasecmp(header, "Connection: Keep-Alive", 22) == 0) { set_keep_alive(true); } else if (header_size > 18 and strncasecmp(header, "X-Gearman-Unique: ", 18) == 0) { unique= header + 18; unique_size= header_size -18; } else if (header_size == 26 and strncasecmp(header, "X-Gearman-Background: true", 26) == 0) { set_background(true); } else if (header_size == 24 and strncasecmp(header, "X-Gearman-Priority: high", 24) == 0) { priority= GEARMAN_JOB_PRIORITY_HIGH; } else if (header_size == 23 and strncasecmp(header, "X-Gearman-Priority: low", 23) == 0) { priority= GEARMAN_JOB_PRIORITY_LOW; } } /* Make sure we received the end of headers. */ if (header == NULL and response() == gearmand::protocol::httpd::HTTP_OK) { gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "No headers were found"); 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 (response() != gearmand::protocol::httpd::HTTP_OK) { packet->command= GEARMAN_COMMAND_ECHO_REQ; if ((ret_ptr= gearmand_packet_pack_header(packet)) != GEARMAN_SUCCESS) { return 0; } packet->data_size= 0; packet->data= NULL; } else if (method() == gearmand::protocol::httpd::TRACE) { packet->command= GEARMAN_COMMAND_ECHO_REQ; if ((ret_ptr= gearmand_packet_pack_header(packet)) != GEARMAN_SUCCESS) { return 0; } packet->data_size= data_size; packet->data= (const char*)data; } else if (method() == gearmand::protocol::httpd::HEAD and uri_size == 0) { packet->command= GEARMAN_COMMAND_ECHO_REQ; if ((ret_ptr= gearmand_packet_pack_header(packet)) != GEARMAN_SUCCESS) { return 0; } } else { if (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; } } if ((ret_ptr= gearmand_packet_pack_header(packet)) != GEARMAN_SUCCESS) { return 0; } if ((ret_ptr= gearmand_packet_create(packet, uri, (size_t)uri_size +1)) != GEARMAN_SUCCESS) { return 0; } if ((ret_ptr= gearmand_packet_create(packet, unique, unique_size +1)) != 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; } gearmand_info("Receiving HTTP response(finished)"); return offset; } bool background() { return _background; } void set_background(bool arg) { _background= arg; } bool keep_alive() { return _keep_alive; } void set_keep_alive(bool arg) { _keep_alive= arg; } void set_response(gearmand::protocol::httpd::response_t arg) { _http_response= arg; } gearmand::protocol::httpd::response_t response() const { return _http_response; } gearmand::protocol::httpd::method_t method() { return _method; } void set_method(gearmand::protocol::httpd::method_t arg) { _method= arg; } void reset() { _sent_header= false; _background= false; _keep_alive= false; content.clear(); _method= gearmand::protocol::httpd::TRACE; _http_response= gearmand::protocol::httpd::HTTP_OK; } const char *parse_line(const void *data, const size_t data_size, size_t& line_size, size_t& offset) { const char *start= (const char *)data +offset; const char *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; } private: gearmand::protocol::httpd::method_t _method; bool _sent_header; bool _background; bool _keep_alive; std::string global_port; gearmand::protocol::httpd::response_t _http_response; std::vector content; }; static gearmand_error_t _http_con_add(gearman_server_con_st *connection) { gearmand_info("HTTP connection made"); HTTPtext *http= new (std::nothrow) HTTPtext; if (http == NULL) { gearmand_error("new"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } connection->set_protocol(http); return GEARMAN_SUCCESS; } namespace gearmand { namespace protocol { HTTP::HTTP() : Plugin("HTTP") { command_line_options().add_options() ("http-port", boost::program_options::value(&_port)->default_value(GEARMAN_PROTOCOL_HTTP_DEFAULT_PORT), "Port to listen on."); } HTTP::~HTTP() { } gearmand_error_t HTTP::start(gearmand_st *gearmand) { gearmand_info("Initializing HTTP"); return gearmand_port_add(gearmand, _port.c_str(), _http_con_add); } } // namespace protocol } // namespace gearmand /** @} */ gearmand-1.0.6/libgearman-server/plugins/queue/0000775000076400007640000000000012142673674022004 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/default/0000775000076400007640000000000012142673674023430 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/default/include.am0000664000076400007640000000071212107145705025360 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman # Copyright (C) 2012 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/default/queue.h libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/default/queue.cc gearmand-1.0.6/libgearman-server/plugins/queue/default/queue.h0000664000076400007640000000351612107145705024720 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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_default(); } // namespace queue } // namespace plugin } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/default/queue.cc0000664000076400007640000001107512107145705025055 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 default Queue Storage Definitions */ #include #include #include #include /** * @addtogroup gearman_queue_default_static Static default Queue Storage Definitions * @ingroup gearman_queue_default * @{ */ namespace gearmand { namespace plugins { namespace queue { class Default; }}} #pragma GCC diagnostic ignored "-Wold-style-cast" /* Queue callback functions. */ static gearmand_error_t __add(gearman_server_st *server __attribute__((unused)), void *context __attribute__((unused)), const char *unique __attribute__((unused)), size_t unique_size __attribute__((unused)), const char *function_name __attribute__((unused)), size_t function_name_size __attribute__((unused)), const void *data __attribute__((unused)), size_t data_size __attribute__((unused)), gearman_job_priority_t priority __attribute__((unused)), int64_t when __attribute__((unused))) { gearmand_debug(__func__); return GEARMAN_SUCCESS; } static gearmand_error_t __flush(gearman_server_st *server __attribute__((unused)), void *context __attribute__((unused))) { gearmand_debug(__func__); return GEARMAN_SUCCESS; } static gearmand_error_t __done(gearman_server_st *server __attribute__((unused)), void *context __attribute__((unused)), const char *unique __attribute__((unused)), size_t unique_size __attribute__((unused)), const char *function_name __attribute__((unused)), size_t function_name_size __attribute__((unused))) { gearmand_debug(__func__); return GEARMAN_SUCCESS; } static gearmand_error_t __replay(gearman_server_st *server __attribute__((unused)), void *context __attribute__((unused)), gearman_queue_add_fn *add_fn __attribute__((unused)), void *add_context __attribute__((unused))) { gearmand_debug(__func__); return GEARMAN_SUCCESS; } namespace gearmand { namespace plugins { namespace queue { class Default : public gearmand::plugins::Queue { public: Default(); ~Default(); gearmand_error_t initialize(); private: }; Default::Default() : Queue("builtin") { } Default::~Default() { } gearmand_error_t Default::initialize() { gearman_server_set_queue(Gearmand()->server, this, __add, __flush, __done, __replay); return GEARMAN_SUCCESS; } void initialize_default() { static Default local_instance; } } // namespace queue } // namespace plugins } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/include.am0000664000076400007640000000162712107145705023742 0ustar00brianbrian00000000000000# 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 libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/base.cc include libgearman-server/plugins/queue/default/include.am 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/redis/include.am include libgearman-server/plugins/queue/sqlite/include.am include libgearman-server/plugins/queue/tokyocabinet/include.am include libgearman-server/plugins/queue/mysql/include.am gearmand-1.0.6/libgearman-server/plugins/queue/drizzle/0000775000076400007640000000000012142673674023467 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/drizzle/include.am0000664000076400007640000000125312107145705025420 0ustar00brianbrian00000000000000# 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/drizzle/queue.h libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/drizzle/queue.cc libgearman_server_libgearman_server_la_LIBADD+= @LIBDRIZZLE_LDFLAGS@ libgearman_server_libgearman_server_la_LIBADD+= @LIBDRIZZLE_LIB@ gearmand_gearmand_LDADD+= @LIBDRIZZLE_LDFLAGS@ gearmand_gearmand_LDADD+= @LIBDRIZZLE_LIB@ gearmand-1.0.6/libgearman-server/plugins/queue/drizzle/queue.h0000664000076400007640000000351612107145705024757 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/plugins/queue/drizzle/queue.cc0000664000076400007640000006257312117600701025116 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 libdrizzle Queue Storage Definitions */ #include #include #include #include #include #include #include #include #include #include #if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE # 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 static bool libdrizzle_failed(drizzle_return_t arg) { return arg != DRIZZLE_RETURN_OK; } typedef std::vector vchar_t; ssize_t escape_string(vchar_t &destination, const char *from, size_t from_size) { if (from_size == 0) { return 0; } destination.reserve(from_size * 2); char newchar; const char *end; for (end= from + from_size; from < end; from++) { newchar= 0; /* All multi-byte UTF8 characters have the high bit set for all bytes. */ if (!(*from & 0x80)) { switch (*from) { case 0: newchar= '0'; break; case '\n': newchar= 'n'; break; case '\r': newchar= 'r'; break; case '\032': newchar= 'Z'; break; case '\\': newchar= '\\'; break; case '\'': newchar= '\''; break; case '"': newchar= '"'; break; default: break; } } if (newchar != '\0') { destination.push_back('\\'); destination.push_back(newchar); } else { destination.push_back(*from); } } return destination.size(); } 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_st *insert_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), insert_con(NULL), _result(NULL), _query(), username(""), mysql_protocol(false), port(DRIZZLE_DEFAULT_TCP_PORT), _epoch_support(true) { command_line_options().add_options() ("libdrizzle-host", boost::program_options::value(&host)->default_value(DRIZZLE_DEFAULT_TCP_HOST), "Host of server.") ("libdrizzle-port", boost::program_options::value(&port)->default_value(DRIZZLE_DEFAULT_TCP_PORT), "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_set_timeout(drizzle, -1); assert(drizzle_timeout(drizzle) == -1); } Drizzle::~Drizzle() { drizzle_quit(insert_con); drizzle_quit(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 /* * thin wrapper around drizzle_query to handle the server going away * this happens usually because of a low wait_timeout value * we attempt to connect back only once */ static drizzle_result_st *_libdrizzle_query_with_retry(drizzle_st* con, const char *query, size_t query_size, drizzle_return_t& ret_ptr) { drizzle_result_st *query_result= NULL; ret_ptr= DRIZZLE_RETURN_LOST_CONNECTION; for (int retry= 0; (ret_ptr == DRIZZLE_RETURN_LOST_CONNECTION) && (retry < 2); ++retry) { query_result= drizzle_query(con, query, query_size, &ret_ptr); } if (libdrizzle_failed(ret_ptr)) { if (ret_ptr == 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_host(con), int(drizzle_port(con)), drizzle_user(con), drizzle_db(con), drizzle_error(con)); } else { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "libdrizled error '%s' executing '%.*s'", drizzle_error(con), query_size, query); } } return query_result; } /** * Query handling function. */ static drizzle_return_t _libdrizzle_query(plugins::queue::Drizzle *queue, const char *query, size_t query_size) { drizzle_return_t ret; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libdrizzle query: %.*s", (uint32_t)query_size, query); drizzle_result_st *result= _libdrizzle_query_with_retry(queue->drizzle, query, query_size, ret); if (libdrizzle_failed(ret)) { return ret; } (void)result; return DRIZZLE_RETURN_OK; } static drizzle_return_t _libdrizzle_insert(plugins::queue::Drizzle *queue, const vchar_t& query) { drizzle_return_t ret; drizzle_result_st *result= _libdrizzle_query_with_retry(queue->insert_con, &query[0], query.size() -1, ret); if (libdrizzle_failed(ret)) { return ret; } ret= drizzle_result_buffer(result); drizzle_result_free(result); return ret; } /* 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, gearman_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 0 if (queue->mysql_protocol) { drizzle_set_options(queue->drizzle, DRIZZLE_CON_MYSQL); drizzle_set_options(queue->insert_con, DRIZZLE_CON_MYSQL); } #endif if (queue->uds.empty()) { queue->drizzle= drizzle_create(queue->host.c_str(), queue->port, queue->user.c_str(), queue->password.c_str(), "INFORMATION_SCHEMA", 0); queue->insert_con= drizzle_create(queue->host.c_str(), queue->port, queue->user.c_str(), queue->password.c_str(), "INFORMATION_SCHEMA", 0); } else { queue->drizzle= drizzle_create(queue->uds.c_str(), 0, queue->user.c_str(), queue->password.c_str(), "INFORMATION_SCHEMA", 0); queue->insert_con= drizzle_create(queue->uds.c_str(), 0, queue->user.c_str(), queue->password.c_str(), "INFORMATION_SCHEMA", 0); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Using '%s' as the username", queue->user.c_str()); std::string query; { query.clear(); query+= "CREATE SCHEMA IF NOT EXISTS " +queue->schema; 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_all(queue->result()))) { drizzle_result_free(queue->result()); return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); } drizzle_result_free(queue->result()); } // Look for schema { query.clear(); 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 (drizzle_result_row_count(queue->result()) == 0) { return gearmand_gerror("Error occurred while search for gearman queue schema", GEARMAN_QUEUE_ERROR); } drizzle_result_free(queue->result()); } drizzle_return_t ret; ret= drizzle_select_db(queue->drizzle, queue->schema.c_str()); if (libdrizzle_failed(ret)) { return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); } ret= drizzle_select_db(queue->insert_con, queue->schema.c_str()); if (libdrizzle_failed(ret)) { return gearmand_gerror(drizzle_error(queue->insert_con), GEARMAN_QUEUE_ERROR); } // 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 (create_table == false) { gearmand_log_info("libdrizzle module creating table '%s.%s'", drizzle_db(queue->drizzle), queue->table.c_str()); query.clear(); query+= "CREATE TABLE " +queue->schema + "." +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_all(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_db(queue->drizzle), 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 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); } if (drizzle_result_row_count(queue->result()) == 0) { 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 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, gearman_job_priority_t priority, int64_t when) { plugins::queue::Drizzle *queue= (plugins::queue::Drizzle *)context; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libdrizzle add: %.*s, %.*s(%u bytes)", uint32_t(function_name_size), function_name, uint32_t(unique_size), (char *)unique, uint32_t(data_size)); if (when and queue->epoch_support() == false) { return gearmand_gerror("Table lacks when_to_run field", GEARMAN_QUEUE_ERROR); } vchar_t escaped_unique_name; vchar_t escaped_function_name; (void)escape_string(escaped_unique_name, (const char *)unique, unique_size); (void)escape_string(escaped_function_name, (const char *)function_name, function_name_size); // @todo test for overallocation failure size_t query_size; char query_buffer[GEARMAN_QUEUE_QUERY_BUFFER +(GEARMAN_MAX_UNIQUE_SIZE*2) +(GEARMAN_FUNCTION_MAX_SIZE*2)]; if (queue->epoch_support()) { query_size= (size_t)snprintf(query_buffer, sizeof(query_buffer), "INSERT INTO %.*s.%.*s SET priority=%u,when_to_run=%lld,unique_key='%.*s',function_name='%.*s',data='", int(queue->schema.size()), queue->schema.c_str(), int(queue->table.size()), queue->table.c_str(), uint32_t(priority), (long long unsigned int)when, int(escaped_unique_name.size()), &escaped_unique_name[0], int(escaped_function_name.size()), &escaped_function_name[0] ); } else { query_size= (size_t)snprintf(query_buffer, sizeof(query_buffer), "INSERT INTO %.*s.%.*s SET priority=%u,unique_key='%.*s',function_name='%.*s',data='", int(queue->schema.size()), queue->schema.c_str(), int(queue->table.size()), queue->table.c_str(), uint32_t(priority), int(escaped_unique_name.size()), &escaped_unique_name[0], int(escaped_function_name.size()), &escaped_function_name[0] ); } vchar_t query; query.resize(query_size); memcpy(&query[0], query_buffer, query_size); query_size+= size_t(escape_string(query, (const char *)data, data_size)); query.push_back('\''); query.resize(query.size() +1); gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "%.*s", query.size() -1, &query[0]); if (libdrizzle_failed(_libdrizzle_insert(queue, query))) { return gearmand_gerror(drizzle_error(queue->drizzle), GEARMAN_QUEUE_ERROR); } 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; 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); vchar_t escaped_unique_name; vchar_t escaped_function_name; (void)escape_string(escaped_unique_name, (const char *)unique, unique_size); (void)escape_string(escaped_function_name, (const char *)function_name, function_name_size); vchar_t query; query.resize(escaped_unique_name.size() +escaped_function_name.size() +queue->schema.size() +queue->table.size() +GEARMAN_QUEUE_QUERY_BUFFER); int query_size= snprintf(&query[0], query.size(), "DELETE FROM %.*s.%.*s WHERE unique_key='%.*s' and function_name= '%.*s'", int(queue->schema.size()), queue->schema.c_str(), int(queue->table.size()), queue->table.c_str(), int(escaped_unique_name.size()), &escaped_unique_name[0], int(escaped_function_name.size()), &escaped_function_name[0] ); if (query_size < 0 or size_t(query_size) > query.size()) { return gearmand_gerror("snprintf(DELETE)", GEARMAN_MEMORY_ALLOCATION_FAILURE); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "%.*", query_size, &query[0]); if (libdrizzle_failed(_libdrizzle_query(queue, &query[0], query_size))) { return gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Error occured from %.*s", query_size, &query[0]); } 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_all:%s", drizzle_error(queue->drizzle)); return GEARMAN_QUEUE_ERROR; } if (drizzle_column_skip_all(queue->result()) != DRIZZLE_RETURN_OK) { drizzle_result_free(queue->result()); gearmand_log_error("drizzle_column_skip_all:%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 "; query+= queue->schema; query+= "."; query+= queue->table; } else { query+= "SELECT unique_key,function_name,priority,data FROM "; query+= queue->schema; query+= "."; query+= 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_column_buffer(queue->result()))) { 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 (libdrizzle_failed(ret)) { drizzle_result_free(queue->result()); return gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "drizzle_row_buffer:%s", drizzle_error(queue->drizzle)); } 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(errno, "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, (gearman_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; } #else // if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE namespace gearmand { namespace plugins { namespace queue { void initialize_drizzle() { } } // namespace queue } // namespace plugins } // namespace gearmand #endif // if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE gearmand-1.0.6/libgearman-server/plugins/queue/libmemcached/0000775000076400007640000000000012142673674024401 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/libmemcached/include.am0000664000076400007640000000125412107145705026333 0ustar00brianbrian00000000000000# 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/libmemcached/queue.h if HAVE_LIBMEMCACHED 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_LIB) gearmand_gearmand_LDADD+= $(LIBMEMCACHED_LIB) endif gearmand-1.0.6/libgearman-server/plugins/queue/libmemcached/queue.h0000664000076400007640000000352312107145705025667 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/plugins/queue/libmemcached/queue.cc0000664000076400007640000002665012137131133026024 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 libmemcached Queue Storage Definitions */ #include "gear_config.h" #include #include #include #include #include "libgearman-server/log.h" #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; }}} namespace gearmand { namespace queue { class LibmemcachedQueue : public gearmand::queue::Context { public: LibmemcachedQueue(plugins::queue::Libmemcached*, memcached_server_st* servers) : memc_(NULL) { memc_= memcached_create(NULL); memcached_server_push(memc_, servers); } bool init() { return bool(bool(memc_) and memcached_server_count(memc_)); } ~LibmemcachedQueue() { memcached_free(memc_); memc_= NULL; } gearmand_error_t add(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when); gearmand_error_t flush(gearman_server_st *server); gearmand_error_t done(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size); gearmand_error_t replay(gearman_server_st *server); private: memcached_st* memc_; }; } // namespace queue } // namespace gearmand namespace gearmand { namespace plugins { namespace queue { class Libmemcached : public gearmand::plugins::Queue { public: Libmemcached (); ~Libmemcached (); gearmand_error_t initialize(); std::string server_list; private: }; Libmemcached::Libmemcached() : Queue("libmemcached") { command_line_options().add_options() ("libmemcached-servers", boost::program_options::value(&server_list), "List of Memcached servers to use."); } Libmemcached::~Libmemcached() { } gearmand_error_t Libmemcached::initialize() { gearmand_info("Initializing libmemcached module"); memcached_server_st *servers= memcached_servers_parse(server_list.c_str()); if (servers == NULL) { return gearmand_gerror("memcached_servers_parse", GEARMAN_QUEUE_ERROR); } gearmand::queue::LibmemcachedQueue* exec_queue= new gearmand::queue::LibmemcachedQueue(this, servers); if (exec_queue and exec_queue->init()) { gearman_server_set_queue(Gearmand()->server, exec_queue); memcached_server_list_free(servers); return GEARMAN_SUCCESS; } return gearmand_gerror("Libmemcached::initialize()", GEARMAN_QUEUE_ERROR); } void initialize_libmemcached() { static Libmemcached local_instance; } } // namespace queue } // namespace plugins } // namespace gearmand /* Queue callback functions. */ namespace gearmand { namespace queue { gearmand_error_t LibmemcachedQueue::add(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when) { if (when) // No support for EPOCH jobs { return gearmand_gerror("libmemcached queue does not support epoch jobs", GEARMAN_QUEUE_ERROR); } (void)server; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libmemcached add: %.*s", (uint32_t)unique_size, (char *)unique); char key[MEMCACHED_MAX_KEY]; size_t 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); memcached_return rc= memcached_set(memc_, (const char *)key, key_length, (const char *)data, data_size, 0, (uint32_t)priority); if (rc != MEMCACHED_SUCCESS) { return gearmand_gerror(memcached_last_error_message(memc_), GEARMAN_QUEUE_ERROR); } return GEARMAN_SUCCESS; } gearmand_error_t LibmemcachedQueue::flush(gearman_server_st *) { gearmand_debug("libmemcached flush"); return GEARMAN_SUCCESS; } gearmand_error_t LibmemcachedQueue::done(gearman_server_st*, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size) { char key[MEMCACHED_MAX_KEY]; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libmemcached done: %.*s", (uint32_t)unique_size, (char *)unique); size_t 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 */ memcached_return rc= memcached_delete(memc_, (const char *)key, key_length, 0); if (rc != MEMCACHED_SUCCESS) { return gearmand_gerror(memcached_last_error_message(memc_), GEARMAN_QUEUE_ERROR); } return GEARMAN_SUCCESS; } class Replay { public: Replay(gearman_server_st* server_arg, memcached_st* _memc) : server_(server_arg), memc_(NULL) { memc_= memcached_clone(NULL, _memc); } ~Replay() { memcached_free(memc_); memc_= NULL; } bool init() { return bool(memc_); } memcached_st* memc() { assert(memc_); return memc_; } gearman_server_st* server() { return server_; } private: gearman_server_st* server_; memcached_st* memc_; }; static memcached_return callback_loader(const memcached_st*, memcached_result_st* result, void *context) { Replay* replay= (Replay*)context; const char *key= memcached_result_key_value(result); if (strncmp(key, GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX, strlen(GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX)) != 0) { gearmand_debug("memcached key did not match GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX"); return MEMCACHED_SUCCESS; } const char* function= key +strlen(GEARMAN_QUEUE_LIBMEMCACHED_DEFAULT_PREFIX); const char* unique= index(function, '-'); if (unique == NULL) { gearmand_debug("memcached key was malformed was not found"); return MEMCACHED_SUCCESS; } size_t function_len= size_t(unique -function); unique++; size_t unique_size= strlen(unique); assert(unique); assert(unique_size); assert(function); assert(function_len); /* need to make a copy here ... gearman_server_job_free will free it later */ char* data= (char*)malloc(memcached_result_length(result)); if (data == NULL) { gearmand_perror(errno, "malloc"); return MEMCACHED_MEMORY_ALLOCATION_FAILURE; } memcpy(data, memcached_result_value(result), memcached_result_length(result)); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libmemcached replay_add: %.*s", (uint32_t)unique_size, (char *)unique); /* Currently not looking at failure cases */ LibmemcachedQueue::replay_add(replay->server(), NULL, unique, unique_size, function, function_len, data, memcached_result_length(result), static_cast(memcached_result_flags(result)), int64_t(0)); return MEMCACHED_SUCCESS; } /* Grab the object and load it into the loader */ static memcached_return callback_for_key(const memcached_st*, const char *key, size_t key_length, void *context) { Replay* replay= (Replay*)context; memcached_execute_function callbacks[1]; char *passable[1]; callbacks[0]= (memcached_execute_fn)&callback_loader; passable[0]= (char *)key; if (memcached_success(memcached_mget(replay->memc(), passable, &key_length, 1))) { gearmand_debug(memcached_last_error_message(replay->memc())); } /* Just void errors for the moment, since other treads might have picked up the object. */ (void)memcached_fetch_execute(replay->memc(), callbacks, replay, 1); return MEMCACHED_SUCCESS; } /* If we have any failures for loading values back into replay we just ignore them. */ gearmand_error_t LibmemcachedQueue::replay(gearman_server_st *server) { memcached_dump_func callbacks[1]; callbacks[0]= (memcached_dump_fn)&callback_for_key; gearmand_debug("libmemcached replay start"); memcached_st* local_clone= memcached_clone(NULL, memc_); if (local_clone) { Replay replay_exec(server, memc_); if (replay_exec.init()) { (void)memcached_dump(local_clone, callbacks, (void *)&replay_exec, 1); } else { gearmand_debug("libmemcached failed to init() Replay"); } memcached_free(local_clone); local_clone= NULL; } gearmand_debug("libmemcached replay stop"); return GEARMAN_SUCCESS; } } // queue } // gearmand gearmand-1.0.6/libgearman-server/plugins/queue/tokyocabinet/0000775000076400007640000000000012142673674024477 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/tokyocabinet/include.am0000664000076400007640000000106612107145705026432 0ustar00brianbrian00000000000000# 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/tokyocabinet/queue.h if HAVE_TOKYOCABINET libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/tokyocabinet/queue.cc libgearman_server_libgearman_server_la_LIBADD+= @TOKYOCABINET_LIB@ endif gearmand-1.0.6/libgearman-server/plugins/queue/tokyocabinet/queue.h0000664000076400007640000000352312107145705025765 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/plugins/queue/tokyocabinet/queue.cc0000664000076400007640000003330012107145705026117 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2008 Brian Moon * 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 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(); void destroy() { if (db) { tcadbdel(db); db= NULL; } } 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]"); } TokyoCabinet::~TokyoCabinet() { destroy(); } 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, gearman_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) { if (db) { switch (tcadbomode(db)) { case ADBOHDB: return tcerrmsg(tchdbecode((TCHDB *)tcadbreveal(db))); case ADBOBDB: return tcerrmsg(tcbdbecode((TCBDB *)tcadbreveal(db))); default: return tcerrmsg(TCEMISC); } } return "no TCADB file"; } 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 (tcadbopen(queue->db, queue->filename.c_str()) == 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "tcadbopen(%s): %s", queue->filename.c_str(), _libtokyocabinet_tcaerrmsg(queue->db)); queue->destroy(); return GEARMAN_QUEUE_ERROR; } if (queue->optimize) { gearmand_info("libtokyocabinet optimizing database file"); if (tcadboptimize(queue->db, NULL) == 0) { queue->destroy(); 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*, 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, gearman_job_priority_t priority, int64_t when) { gearmand::plugins::queue::TokyoCabinet *queue= (gearmand::plugins::queue::TokyoCabinet *)context; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet add: %.*s at %" PRId64, (uint32_t)unique_size, (char *)unique, 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); gearmand_error_t ret= GEARMAN_QUEUE_ERROR; TCXSTR* key; if ((key= tcxstrnew())) { tcxstrcat(key, key_str, (int)key_length); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet key: %.*s", (int)key_length, key_str); TCXSTR* job_data= tcxstrnew(); if ((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"); } // get int64_t as string char timestr[32]; snprintf(timestr, sizeof(timestr), "%" PRId64, 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); if (tcadbput(queue->db, tcxstrptr(key), tcxstrsize(key), tcxstrptr(job_data), tcxstrsize(job_data))) { ret= GEARMAN_SUCCESS; } tcxstrdel(job_data); } tcxstrdel(key); } return ret; } 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 (tcadbsync(queue->db) == 0) { 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; 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); TCXSTR* 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) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "replaying: %s", (char *) tcxstrptr(key)); char* data_cstr= (char *)tcxstrptr(data); size_t data_cstr_size= (size_t)tcxstrsize(data); const char* function= data_cstr; size_t function_len= strlen(function); char* unique= data_cstr +function_len +1; size_t 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 gearman_job_priority_t 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; // out ptr for strtoul char *new_data_cstr= NULL; // parse time from record int64_t 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_MEMORY_ALLOCATION_FAILURE; } memcpy(data_ptr, data_cstr, data_cstr_size); return (*add_fn)(server, add_context, unique, unique_len, function, function_len, data_ptr, data_cstr_size, priority, when); } 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; gearmand_info("libtokyocabinet replay start"); if (tcadbiterinit(queue->db) == 0) { return GEARMAN_QUEUE_ERROR; } TCXSTR* key= tcxstrnew(); TCXSTR* data= tcxstrnew(); gearmand_error_t gret= GEARMAN_SUCCESS; void *iter= NULL; uint64_t x= 0; int iter_size= 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 == NULL) { gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "libtokyocabinet replay key disappeared: %s", (char *)tcxstrptr(key)); continue; } tcxstrcat(data, iter, iter_size); free(iter); if (_callback_for_record(server, key, data, add_fn, add_context) != 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; } gearmand-1.0.6/libgearman-server/plugins/queue/redis/0000775000076400007640000000000012142673674023112 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/redis/include.am0000664000076400007640000000100512107145705025036 0ustar00brianbrian00000000000000# 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/redis/queue.h libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/redis/queue.cc libgearman_server_libgearman_server_la_LIBADD+= @HIREDIS_LIB@ gearmand-1.0.6/libgearman-server/plugins/queue/redis/queue.h0000664000076400007640000000351412107145705024400 0ustar00brianbrian00000000000000/* 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_redis(); } // namespace queue } // namespace plugin } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/redis/queue.cc0000664000076400007640000002402212107145705024533 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Redis Queue Storage Definitions */ #include #include #include #include #if defined(HAVE_HIREDIS) && HAVE_HIREDIS #include /* Queue callback functions. */ static gearmand_error_t _hiredis_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, gearman_job_priority_t priority, int64_t when); static gearmand_error_t _hiredis_flush(gearman_server_st *server, void *context); static gearmand_error_t _hiredis_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 _hiredis_replay(gearman_server_st *server, void *context, gearman_queue_add_fn *add_fn, void *add_context); namespace gearmand { namespace plugins { namespace queue { class Hiredis; }}} namespace gearmand { namespace plugins { namespace queue { class Hiredis : public Queue { public: Hiredis(); ~Hiredis(); gearmand_error_t initialize(); redisContext* redis() { return _redis; } std::string server; std::string service; private: redisContext *_redis; }; Hiredis::Hiredis() : Queue("redis"), server("127.0.0.1"), service("6379"), _redis(NULL) { command_line_options().add_options() ("redis-server", boost::program_options::value(&server), "Redis server") ("redis-port", boost::program_options::value(&service), "Redis server port/service"); } Hiredis::~Hiredis() { } gearmand_error_t Hiredis::initialize() { int service_port= atoi(service.c_str()); if ((_redis= redisConnect("127.0.0.1", service_port)) == NULL) { return gearmand_gerror("Could not connect to redis server", GEARMAN_QUEUE_ERROR); } gearmand_info("Initializing hiredis module"); gearman_server_set_queue(Gearmand()->server, this, _hiredis_add, _hiredis_flush, _hiredis_done, _hiredis_replay); return GEARMAN_SUCCESS; } void initialize_redis() { static Hiredis local_instance; } } // namespace queue } // namespace plugins } // namespace gearmand typedef std::vector vchar_t; #define GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX "_gear_" #define GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX_SIZE sizeof(GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX) #define GEARMAN_KEY_LITERAL "%s-%.*s-%*s" static size_t build_key(vchar_t &key, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size) { key.resize(function_name_size +unique_size +GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX_SIZE +4); int key_size= snprintf(&key[0], key.size(), GEARMAN_KEY_LITERAL, GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX, (int)function_name_size, function_name, (int)unique_size, unique); if (size_t(key_size) >= key.size() or key_size <= 0) { assert(0); return -1; } return key.size(); } /** * @addtogroup gearman_queue_hiredis hiredis Queue Storage Functions * @ingroup gearman_queue * @{ */ /* * Private declarations */ #pragma GCC diagnostic ignored "-Wold-style-cast" /* * Private definitions */ static gearmand_error_t _hiredis_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, gearman_job_priority_t, int64_t when) { gearmand::plugins::queue::Hiredis *queue= (gearmand::plugins::queue::Hiredis *)context; if (when) // No support for EPOCH jobs { return GEARMAN_QUEUE_ERROR; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "hires add: %.*s", (uint32_t)unique_size, (char *)unique); std::vector key; build_key(key, unique, unique_size, function_name, function_name_size); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "hires key: %u", (uint32_t)key.size()); redisReply *reply= (redisReply*)redisCommand(queue->redis(), "SET %b %b", &key[0], key.size(), data, data_size); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "got reply"); if (reply == NULL) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to insert '%.*s' into redis", key.size(), &key[0]); } freeReplyObject(reply); return GEARMAN_SUCCESS; } static gearmand_error_t _hiredis_flush(gearman_server_st *, void *) { return GEARMAN_SUCCESS; } static gearmand_error_t _hiredis_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::Hiredis *queue= (gearmand::plugins::queue::Hiredis *)context; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "hires done: %.*s", (uint32_t)unique_size, (char *)unique); std::vector key; build_key(key, unique, unique_size, function_name, function_name_size); redisReply *reply= (redisReply*)redisCommand(queue->redis(), "DELETE %.*s", key.size(), &key[0]); if (reply == NULL) { return GEARMAN_QUEUE_ERROR; } freeReplyObject(reply); return GEARMAN_SUCCESS; } static gearmand_error_t _hiredis_replay(gearman_server_st *server, void *context, gearman_queue_add_fn *add_fn, void *add_context) { gearmand::plugins::queue::Hiredis *queue= (gearmand::plugins::queue::Hiredis *)context; gearmand_info("hiredis replay start"); redisReply *reply= (redisReply*)redisCommand(queue->redis(), "KEYS %s", GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX); if (reply == NULL) { return gearmand_gerror("Failed to call KEYS during QUEUE replay", GEARMAN_QUEUE_ERROR); } for (size_t x= 0; x < reply->elements; x++) { char prefix[GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX_SIZE]; char function_name[GEARMAN_FUNCTION_MAX_SIZE]; char unique[GEARMAN_MAX_UNIQUE_SIZE]; char fmt_str[100] = ""; int fmt_str_length= snprintf(fmt_str, sizeof(fmt_str), "%%%ds-%%%ds-%%%ds", int(GEARMAN_QUEUE_GEARMAND_DEFAULT_PREFIX_SIZE), int(GEARMAN_FUNCTION_MAX_SIZE), int(GEARMAN_MAX_UNIQUE_SIZE)); if (fmt_str_length <= 0 or size_t(fmt_str_length) >= sizeof(fmt_str)) { assert(fmt_str_length != 1); return gearmand_gerror("snprintf() failed to produce a valud fmt_str for redis key", GEARMAN_QUEUE_ERROR); } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" int ret= sscanf(reply->element[x]->str, fmt_str, prefix, function_name, unique); #pragma GCC diagnostic pop if (ret == 0) { continue; } redisReply *get_reply= (redisReply*)redisCommand(queue->redis(), "GET %s", reply->element[x]->str); if (get_reply == NULL) { continue; } (void)(add_fn)(server, add_context, unique, strlen(unique), function_name, strlen(function_name), get_reply->str, get_reply->len, GEARMAN_JOB_PRIORITY_NORMAL, 0); freeReplyObject(get_reply); } freeReplyObject(reply); return GEARMAN_SUCCESS; } #endif // defined(HAVE_HIREDIS) && HAVE_HIREDIS gearmand-1.0.6/libgearman-server/plugins/queue/postgres/0000775000076400007640000000000012142673674023652 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/postgres/include.am0000664000076400007640000000124112107145705025600 0ustar00brianbrian00000000000000# 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/postgres/queue.h if HAVE_LIBPQ libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/postgres/queue.cc libgearman_server_libgearman_server_la_LIBADD+= $(POSTGRESQL_LDFLAGS) libgearman_server_libgearman_server_la_CXXFLAGS+= $(POSTGRESQL_CFLAGS) gearmand_gearmand_LDADD+= $(POSTGRESQL_LDFLAGS) endif gearmand-1.0.6/libgearman-server/plugins/queue/postgres/queue.h0000664000076400007640000000351712107145705025143 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/plugins/queue/postgres/queue.cc0000664000076400007640000003030412107145705025273 0ustar00brianbrian00000000000000/* 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 libpq Queue Storage Definitions */ #include #include #include #include #include #if defined(HAVE_LIBPQ) and HAVE_LIBPQ #pragma GCC diagnostic ignored "-Wundef" #include #endif #include /** * @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, gearman_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) { 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 + "'"); PGresult* 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*, 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, gearman_job_priority_t priority, int64_t when) { (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*, void *context, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size) { (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 (data == NULL) { PQclear(result); return gearmand_perror(errno, "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, (gearman_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; } gearmand-1.0.6/libgearman-server/plugins/queue/sqlite/0000775000076400007640000000000012142673674023305 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/sqlite/include.am0000664000076400007640000000152512107145705025240 0ustar00brianbrian00000000000000# 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/sqlite/queue.h noinst_HEADERS+= libgearman-server/plugins/queue/sqlite/instance.hpp if HAVE_LIBSQLITE3 libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/sqlite/queue.cc libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/sqlite/instance.cc libgearman_server_libgearman_server_la_CFLAGS+= $(SQLITE3_CFLAGS) libgearman_server_libgearman_server_la_CXXFLAGS+= $(SQLITE3_CFLAGS) libgearman_server_libgearman_server_la_LIBADD+= $(SQLITE3_LDFLAGS) endif gearmand-1.0.6/libgearman-server/plugins/queue/sqlite/instance.hpp0000664000076400007640000000701612107145705025614 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 gearmand { namespace queue { class Instance : public gearmand::queue::Context { public: Instance(const std::string& schema_, const std::string& table_); ~Instance(); gearmand_error_t init(); gearmand_error_t add(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when); gearmand_error_t flush(gearman_server_st *server); gearmand_error_t done(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size); gearmand_error_t replay(gearman_server_st *server); bool has_error() { return _error_string.size(); } private: gearmand_error_t replay_loop(gearman_server_st *server); void reset_error() { _error_string.clear(); } bool _sqlite_count(const std::string& arg, int& count); bool _sqlite_dispatch(const std::string& arg); bool _sqlite_dispatch(const char* arg); bool _sqlite_count(const char* arg, int& count); bool _sqlite_prepare(const std::string& query_size, sqlite3_stmt ** sth); bool _sqlite_commit(); bool _sqlite_rollback(); bool _sqlite_lock(); void _sqlite3_finalize(sqlite3_stmt*); private: bool _epoch_support; bool _check_replay; int _in_trans; sqlite3 *_db; sqlite3_stmt* delete_sth; sqlite3_stmt* insert_sth; sqlite3_stmt* replay_sth; std::string _error_string; std::string _schema; std::string _table; std::string _insert_query; std::string _delete_query; }; } // namespace queue } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/sqlite/instance.cc0000664000076400007640000004323012107145705025410 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "libgearman-server/plugins/base.h" #include "libgearman-server/plugins/queue/sqlite/instance.hpp" #include namespace gearmand { namespace queue { Instance::Instance(const std::string& schema_, const std::string& table_): _epoch_support(true), _check_replay(false), _in_trans(0), _db(NULL), delete_sth(NULL), insert_sth(NULL), replay_sth(NULL), _schema(schema_), _table(table_) { _delete_query+= "DELETE FROM "; _delete_query+= _table; _delete_query+= " WHERE unique_key=? and function_name=?"; 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 (?,?,?,?,?)"; } } Instance::~Instance() { _sqlite3_finalize(delete_sth); delete_sth= NULL; _sqlite3_finalize(insert_sth); insert_sth= NULL; _sqlite3_finalize(replay_sth); replay_sth= NULL; assert(_db); if (_db) { if (sqlite3_close(_db) != SQLITE_OK) { gearmand_error(sqlite3_errmsg(_db)); } _db= NULL; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite shutdown database"); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite shutdown"); } void Instance::_sqlite3_finalize(sqlite3_stmt* sth) { if (sth) { if (sqlite3_finalize(sth) != SQLITE_OK ) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "finalize error: %s", sqlite3_errmsg(_db)); } } } bool Instance::_sqlite_prepare(const std::string& query, sqlite3_stmt ** sth) { reset_error(); if (query.size() > UINT32_MAX) { _error_string= "query size too big"; return false; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite query: %s", query.c_str()); if (sqlite3_prepare_v2(_db, query.c_str(), -1, sth, NULL) != SQLITE_OK) { _error_string= sqlite3_errmsg(_db); return false; } return true; } bool Instance::_sqlite_lock() { /* already in transaction? */ if (_in_trans == 0) { if (_sqlite_dispatch("BEGIN TRANSACTION") == false) { return false; } } _in_trans++; return true; } static int sql_count(void * rows_, int argc, char **, char **) { int *rows= (int*)rows_; assert(argc == 1); (void)argc; assert(rows); *rows= *rows +1; return 0; } bool Instance::_sqlite_dispatch(const char* arg) { int count; return _sqlite_count(arg, count); } bool Instance::_sqlite_count(const char* arg, int& count) { reset_error(); count= 0; char* error= NULL; int errcode= sqlite3_exec(_db, arg, sql_count, &count, &error); if (error != NULL or errcode != SQLITE_OK) { assert(errcode != SQLITE_OK); _error_string= error; sqlite3_free(error); return false; } return true; } bool Instance::_sqlite_count(const std::string& arg, int& count) { return _sqlite_count(arg.c_str(), count); } bool Instance::_sqlite_dispatch(const std::string& arg) { int count; return _sqlite_count(arg.c_str(), count); } bool Instance::_sqlite_commit() { /* not in transaction? */ if (_in_trans) { if (_sqlite_dispatch("COMMIT") == false) { return false; } } _in_trans= 0; return true; } gearmand_error_t Instance::init() { gearmand_info("Initializing libsqlite3 module"); if (_schema.empty()) { return gearmand_gerror("missing required --libsqlite3-db= argument", GEARMAN_QUEUE_ERROR); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite open: %s", _schema.c_str()); assert(_db == NULL); if (sqlite3_open_v2(_schema.c_str(), &_db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "sqlite3_open failed with: %s", sqlite3_errmsg(_db)); } if (_db == NULL) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "Unknown error while opening up sqlite file"); } // The only reason why we do this is because during testing we might read the // database which can cause a lock conflict. sqlite3_busy_timeout(_db, 6000); int rows; std::string check_table_str("SELECT 1 FROM sqlite_master WHERE type='table' AND name='"); check_table_str+= _table; check_table_str+= "'"; if (_sqlite_count(check_table_str, rows) == false) { return gearmand_gerror(_error_string.c_str(), GEARMAN_QUEUE_ERROR); } if (rows) { std::string query("SELECT when_to_run FROM "); query+= _table; sqlite3_stmt* select_sth= NULL; if (_sqlite_prepare(query, &select_sth) == false) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Error from '%s': %s", query.c_str(), _error_string.c_str()); query.clear(); query+= "ALTER TABLE "; query+= _table; query+= " ADD COLUMN when_to_run INTEGER"; if (_sqlite_dispatch(query) == false) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Error from '%s': %s", query.c_str(), _error_string.c_str()); gearmand_info("No epoch support in sqlite queue"); _epoch_support= false; } } _sqlite3_finalize(select_sth); } else { std::string query("CREATE TABLE "); query+= _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'", _table.c_str()); if (_sqlite_dispatch(query) == false) { return gearmand_gerror(_error_string.c_str(), GEARMAN_QUEUE_ERROR); } } if (_sqlite_prepare(_delete_query, &delete_sth) == false) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "DELETE PREPARE error: %s", _error_string.c_str()); } if (_sqlite_prepare(_insert_query, &insert_sth) == false) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "INSERT PREPARE: %s", _error_string.c_str()); } { std::string query; if (_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+= _table; if (_sqlite_prepare(query, &replay_sth) == false) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "REPLAY PREPARE: %s", _error_string.c_str()); } } return GEARMAN_SUCCESS; } bool Instance::_sqlite_rollback() { /* not in transaction? */ if (_in_trans) { if (_sqlite_dispatch("ROLLBACK") == false) { return false; } } _in_trans= 0; return true; } gearmand_error_t Instance::add(gearman_server_st*, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when) { assert(_check_replay == false); if (when and _epoch_support == false) { return gearmand_gerror("Table lacks when_to_run field", GEARMAN_QUEUE_ERROR); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite add: priority: %d, unique_key: %.*s, function_name: %.*s when: %ld size: %u", int(priority), int(unique_size), (char*)unique, int(function_name_size), (char*)function_name, (long int)when, uint32_t(data_size)); if (_sqlite_lock() == false) { return gearmand_gerror(_error_string.c_str(), GEARMAN_QUEUE_ERROR); } if (sqlite3_reset(insert_sth) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to reset INSERT prep statement: %s", sqlite3_errmsg(_db)); } if (sqlite3_bind_int(insert_sth, 1, priority) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind priority [%d]: %s", priority, sqlite3_errmsg(_db)); } if (sqlite3_bind_text(insert_sth, 2, (const char *)unique, (int)unique_size, SQLITE_TRANSIENT) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind unique [%.*s]: %s", (uint32_t)unique_size, (char*)unique, sqlite3_errmsg(_db)); } if (sqlite3_bind_text(insert_sth, 3, (const char *)function_name, (int)function_name_size, SQLITE_TRANSIENT) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind function [%.*s]: %s", (uint32_t)function_name_size, (char*)function_name, sqlite3_errmsg(_db)); } if (sqlite3_bind_blob(insert_sth, 4, data, (int)data_size, SQLITE_TRANSIENT) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind data blob: %s", sqlite3_errmsg(_db)); } // epoch data if (sqlite3_bind_int64(insert_sth, 5, when) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind epoch int64_t(%ld): %s", (long int)when, sqlite3_errmsg(_db)); } // INSERT happens here if (sqlite3_step(insert_sth) != SQLITE_DONE) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "INSERT error: %s", sqlite3_errmsg(_db)); } return GEARMAN_SUCCESS; } gearmand_error_t Instance::flush(gearman_server_st*) { gearmand_debug("sqlite flush"); if (_sqlite_commit() == false) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "COMMIT called on FLUSH error: %s", _error_string.c_str()); } return GEARMAN_SUCCESS; } gearmand_error_t Instance::done(gearman_server_st*, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite done: unique_key: %.*s, function_name: %.*s", int(unique_size), (char*)unique, int(function_name_size), (char*)function_name); if (_sqlite_lock() == false) { return gearmand_gerror(_error_string.c_str(), GEARMAN_QUEUE_ERROR); } if (sqlite3_reset(delete_sth) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to reset DELETE prep statement: %s", sqlite3_errmsg(_db)); } if (sqlite3_bind_text(delete_sth, 1, (const char *)unique, int(unique_size), SQLITE_TRANSIENT) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind unique [%.*s]: %s", uint32_t(unique_size), (char*)unique, sqlite3_errmsg(_db)); } if (sqlite3_bind_text(delete_sth, 2, (const char *)function_name, int(function_name_size), SQLITE_TRANSIENT) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to bind function [%.*s]: %s", uint32_t(function_name_size), (char*)function_name, sqlite3_errmsg(_db)); } // DELETE happens here if (sqlite3_step(delete_sth) != SQLITE_DONE) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "DELETE error: %s", sqlite3_errmsg(_db)); } if (_sqlite_commit() == false) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "DELETE error: %s", _error_string.c_str()); } return GEARMAN_SUCCESS; } gearmand_error_t Instance::replay(gearman_server_st *server) { gearmand_error_t ret; _check_replay= true; if (gearmand_failed(ret= replay_loop(server))) { if (_sqlite_rollback() == false) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "failed to rollback sqlite from failed replay error: %s", _error_string.c_str()); } } _check_replay= false; return ret; } gearmand_error_t Instance::replay_loop(gearman_server_st *server) { gearmand_info("sqlite replay start"); gearmand_error_t gret= GEARMAN_UNKNOWN_STATE; size_t row_count= 0; while (sqlite3_step(replay_sth) == SQLITE_ROW) { const char *unique, *function_name; size_t unique_size, function_name_size; row_count++; if (sqlite3_column_type(replay_sth, 0) == SQLITE_TEXT) { unique= (char *)sqlite3_column_text(replay_sth, 0); unique_size= size_t(sqlite3_column_bytes(replay_sth, 0)); } else { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "column %d is not type TEXT: %d", 0, int(sqlite3_column_type(replay_sth, 0))); } if (sqlite3_column_type(replay_sth, 1) == SQLITE_TEXT) { function_name= (char *)sqlite3_column_text(replay_sth, 1); function_name_size= size_t(sqlite3_column_bytes(replay_sth, 1)); } else { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "column %d is not type TEXT", 1); } gearman_job_priority_t priority; if (sqlite3_column_type(replay_sth, 2) == SQLITE_INTEGER) { priority= (gearman_job_priority_t)sqlite3_column_int64(replay_sth, 2); } else { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "column %d is not type INTEGER", 2); } if (sqlite3_column_type(replay_sth, 3) != SQLITE_BLOB) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "column %d is not type TEXT", 3); } size_t data_size= (size_t)sqlite3_column_bytes(replay_sth, 3); char* data= (char*)malloc(data_size); /* need to make a copy here ... gearman_server_job_free will free it later */ if (data == NULL) { return gearmand_perror(errno, "malloc"); } memcpy(data, sqlite3_column_blob(replay_sth, 3), data_size); int64_t when; if (_epoch_support) { if (sqlite3_column_type(replay_sth, 4) == SQLITE_INTEGER) { when= int64_t(sqlite3_column_int64(replay_sth, 4)); } else { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "column %d is not type INTEGER", 3); } } else { when= 0; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "sqlite replay: unique_key: %.*s, function_name: %.*s", int(unique_size), (char*)unique, int(function_name_size), (char*)function_name); gret= Instance::replay_add(server, NULL, unique, unique_size, function_name, function_name_size, data, data_size, priority, when); if (gearmand_failed(gret)) { break; } } if (sqlite3_reset(replay_sth) != SQLITE_OK) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_QUEUE_ERROR, "failed to reset REPLAY prep statement: %s", sqlite3_errmsg(_db)); } if (row_count == 0) { return GEARMAN_SUCCESS; } return gret; } } // namespace queue } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/sqlite/queue.h0000664000076400007640000000351512107145705024574 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/plugins/queue/sqlite/queue.cc0000664000076400007640000000623612107145705024735 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009 Cory Bennett * 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 libsqlite3 Queue Storage Definitions */ #include #include #include #include #include "libgearman-server/plugins/queue/sqlite/instance.hpp" /** Default values. */ #define GEARMAN_QUEUE_SQLITE_DEFAULT_TABLE "gearman_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; private: }; Sqlite::Sqlite() : Queue("libsqlite3") { 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() { } gearmand_error_t Sqlite::initialize() { gearmand::queue::Instance* exec_queue= new gearmand::queue::Instance(schema, table); if (exec_queue == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } gearmand_error_t rc; if ((rc= exec_queue->init()) != GEARMAN_SUCCESS) { delete exec_queue; return rc; } gearman_server_set_queue(Gearmand()->server, exec_queue); return rc; } void initialize_sqlite() { static Sqlite local_instance; } } // namespace queue } // namespace plugins } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/base.h0000664000076400007640000000405212107145705023056 0ustar00brianbrian00000000000000/* 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); virtual gearmand_error_t initialize()= 0; virtual ~Queue()= 0; typedef std::vector vector; private: }; } // namespace plugin } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/base.cc0000664000076400007640000000402012107145705023207 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "libgearman-server/plugins/queue/base.h" #include #include namespace gearmand { namespace plugins { Queue::Queue(const std::string &arg) : Plugin(arg) { gearmand::queue::add(this); } Queue::~Queue() { } } // namespace plugin } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/mysql/0000775000076400007640000000000012142673674023151 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/plugins/queue/mysql/include.am0000664000076400007640000000131712107145705025103 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman # Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ # Copyright (C) 2011 Oleksiy Krivoshey # 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/mysql/queue.h if HAVE_LIBMYSQL libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/plugins/queue/mysql/queue.cc libgearman_server_libgearman_server_la_CFLAGS+= @MYSQL_INCLUDE@ libgearman_server_libgearman_server_la_CXXFLAGS+= @MYSQL_INCLUDE@ libgearman_server_libgearman_server_la_LDFLAGS+= @MYSQL_LDFLAGS@ endif gearmand-1.0.6/libgearman-server/plugins/queue/mysql/queue.h0000664000076400007640000000343212107145705024436 0ustar00brianbrian00000000000000/* * 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_mysql(); } // namespace queue } // namespace plugin } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue/mysql/queue.cc0000664000076400007640000003704712107145705024605 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2011 Oleksiy Krivoshey * 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 /** * Default values. */ #define GEARMAN_QUEUE_MYSQL_DEFAULT_TABLE "gearman_queue" namespace gearmand { namespace plugins { namespace queue { class MySQL; } } } static gearmand_error_t _initialize(gearman_server_st& server, gearmand::plugins::queue::MySQL *queue); namespace gearmand { namespace plugins { namespace queue { class MySQL : public gearmand::plugins::Queue { public: MySQL(); ~MySQL(); gearmand_error_t initialize(); gearmand_error_t prepareAddStatement(); gearmand_error_t prepareDoneStatement(); MYSQL *con; MYSQL_STMT *add_stmt; MYSQL_STMT *done_stmt; std::string mysql_host; std::string mysql_user; std::string mysql_password; std::string mysql_db; std::string mysql_table; in_port_t port() const { return _port; } private: in_port_t _port; }; MySQL::MySQL() : Queue("MySQL"), con(NULL), add_stmt(NULL), done_stmt(NULL) { command_line_options().add_options() ("mysql-host", boost::program_options::value(&mysql_host)->default_value("localhost"), "MySQL host.") ("mysql-port", boost::program_options::value(&_port)->default_value(3306), "Port of server. (by default 3306)") ("mysql-user", boost::program_options::value(&mysql_user)->default_value(""), "MySQL user.") ("mysql-password", boost::program_options::value(&mysql_password)->default_value(""), "MySQL user password.") ("mysql-db", boost::program_options::value(&mysql_db)->default_value(""), "MySQL database.") ("mysql-table", boost::program_options::value(&mysql_table)->default_value(GEARMAN_QUEUE_MYSQL_DEFAULT_TABLE), "MySQL table name."); } MySQL::~MySQL() { if (add_stmt) { mysql_stmt_close(add_stmt); } if (con) { mysql_close(con); } } gearmand_error_t MySQL::initialize() { return _initialize(Gearmand()->server, this); } gearmand_error_t MySQL::prepareAddStatement() { char query_buffer[1024]; if ((this->add_stmt= mysql_stmt_init(this->con)) == NULL) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_init failed: %s", mysql_error(this->con)); return GEARMAN_QUEUE_ERROR; } int query_buffer_length= snprintf(query_buffer, sizeof(query_buffer), "INSERT INTO %s " "(unique_key, function_name, priority, data, when_to_run) " "VALUES(?, ?, ?, ?, ?)", this->mysql_table.c_str()); if (mysql_stmt_prepare(this->add_stmt, query_buffer, query_buffer_length)) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_prepare failed: %s", mysql_error(this->con)); return GEARMAN_QUEUE_ERROR; } return GEARMAN_SUCCESS; } gearmand_error_t MySQL::prepareDoneStatement() { char query_buffer[1024]; if ((this->done_stmt= mysql_stmt_init(this->con)) == NULL) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_init failed: %s", mysql_error(this->con)); return GEARMAN_QUEUE_ERROR; } int query_buffer_length= snprintf(query_buffer, sizeof(query_buffer), "DELETE FROM %s " "WHERE unique_key=? " "AND function_name=?", this->mysql_table.c_str()); if (mysql_stmt_prepare(this->done_stmt, query_buffer, query_buffer_length)) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_prepare failed: %s", mysql_error(this->con)); return GEARMAN_QUEUE_ERROR; } return GEARMAN_SUCCESS; } void initialize_mysql() { static MySQL local_instance; } } // namespace queue } // namespace plugin } // namespace gearmand /* Queue callback functions. */ static gearmand_error_t _mysql_queue_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, gearman_job_priority_t priority, int64_t when); static gearmand_error_t _mysql_queue_flush(gearman_server_st *server, void *context); static gearmand_error_t _mysql_queue_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 _mysql_queue_replay(gearman_server_st *server, void *context, gearman_queue_add_fn *add_fn, void *add_context); gearmand_error_t _initialize(gearman_server_st& server, gearmand::plugins::queue::MySQL *queue) { MYSQL_RES * result; my_bool my_true= true; gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM,"Initializing MySQL module"); gearman_server_set_queue(server, queue, _mysql_queue_add, _mysql_queue_flush, _mysql_queue_done, _mysql_queue_replay); queue->con= mysql_init(queue->con); mysql_options(queue->con, MYSQL_READ_DEFAULT_GROUP, "gearmand"); if (!mysql_real_connect(queue->con, queue->mysql_host.c_str(), queue->mysql_user.c_str(), queue->mysql_password.c_str(), queue->mysql_db.c_str(), queue->port(), NULL, 0)) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Failed to connect to database: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } mysql_options(queue->con, MYSQL_OPT_RECONNECT, &my_true); if (!(result= mysql_list_tables(queue->con, queue->mysql_table.c_str()))) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_list_tables failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } if (mysql_num_rows(result) == 0) { char query_buffer[1024]; int query_buffer_length= snprintf(query_buffer, sizeof(query_buffer), "CREATE TABLE %s" "(" "unique_key VARCHAR(%d)," "function_name VARCHAR(255)," "priority INT," "data LONGBLOB," "when_to_run INT," "unique key (unique_key, function_name)" ")", queue->mysql_table.c_str(), GEARMAN_UNIQUE_SIZE); gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM,"MySQL module: creating table %s", queue->mysql_table.c_str()); if (mysql_real_query(queue->con, query_buffer, query_buffer_length)) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "MySQL module: create table failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } } mysql_free_result(result); if (queue->prepareAddStatement() == GEARMAN_QUEUE_ERROR) { return GEARMAN_QUEUE_ERROR; } if (queue->prepareDoneStatement() == GEARMAN_QUEUE_ERROR) { return GEARMAN_QUEUE_ERROR; } return GEARMAN_SUCCESS; } /* * Static definitions */ static gearmand_error_t _mysql_queue_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, gearman_job_priority_t priority, int64_t when) { MYSQL_BIND bind[5]; gearmand::plugins::queue::MySQL *queue= (gearmand::plugins::queue::MySQL *)context; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,"MySQL queue add: %.*s %.*s", (uint32_t) unique_size, (char *) unique, (uint32_t) function_name_size, (char *) function_name); bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *)unique; bind[0].buffer_length= unique_size; bind[0].is_null= 0; bind[0].length= (unsigned long*)&unique_size; bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char *)function_name; bind[1].buffer_length= function_name_size; bind[1].is_null= 0; bind[1].length= (unsigned long*)&function_name_size; bind[2].buffer_type= MYSQL_TYPE_LONG; bind[2].buffer= (char *)&priority; bind[2].is_null= 0; bind[2].length= 0; bind[3].buffer_type= MYSQL_TYPE_LONG_BLOB; bind[3].buffer= (char *)data; bind[3].buffer_length= data_size; bind[3].is_null= 0; bind[3].length= (unsigned long*)&data_size; bind[4].buffer_type= MYSQL_TYPE_LONG; bind[4].buffer= (char *)&when; bind[4].is_null= 0; bind[4].length= 0; while(1) { if (mysql_stmt_bind_param(queue->add_stmt, bind)) { if ( mysql_stmt_errno(queue->add_stmt) == CR_NO_PREPARE_STMT ) { if (queue->prepareAddStatement() == GEARMAN_QUEUE_ERROR) { return GEARMAN_QUEUE_ERROR; } continue; } else { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_bind_param failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } } if (mysql_stmt_execute(queue->add_stmt)) { if ( mysql_stmt_errno(queue->add_stmt) == CR_SERVER_LOST ) { mysql_stmt_close(queue->add_stmt); if (queue->prepareAddStatement() != GEARMAN_QUEUE_ERROR) { continue; } } gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_execute failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } break; } return GEARMAN_SUCCESS; } static gearmand_error_t _mysql_queue_flush(gearman_server_st*, void*) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,"MySQL queue flush"); return GEARMAN_SUCCESS; } static gearmand_error_t _mysql_queue_done(gearman_server_st*, void *context, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size) { MYSQL_BIND bind[2]; gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,"MySQL queue done: %.*s %.*s", (uint32_t) unique_size, (char *) unique, (uint32_t) function_name_size, (char *) function_name); gearmand::plugins::queue::MySQL *queue= (gearmand::plugins::queue::MySQL *)context; bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *)unique; bind[0].buffer_length= unique_size; bind[0].is_null= 0; bind[0].length= (unsigned long*)&unique_size; bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char *)function_name; bind[1].buffer_length= function_name_size; bind[1].is_null= 0; bind[1].length= (unsigned long*)&function_name_size; while(1) { if (mysql_stmt_bind_param(queue->done_stmt, bind)) { if ( mysql_stmt_errno(queue->done_stmt) == CR_NO_PREPARE_STMT ) { if (queue->prepareDoneStatement() == GEARMAN_QUEUE_ERROR) { return GEARMAN_QUEUE_ERROR; } continue; } else { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_bind_param failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } } if (mysql_stmt_execute(queue->done_stmt)) { if ( mysql_stmt_errno(queue->done_stmt) == CR_SERVER_LOST ) { mysql_stmt_close(queue->done_stmt); if (queue->prepareDoneStatement() != GEARMAN_QUEUE_ERROR) { continue; } } gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_stmt_execute failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } break; } return GEARMAN_SUCCESS; } static gearmand_error_t _mysql_queue_replay(gearman_server_st* server, void *context, gearman_queue_add_fn *add_fn, void *add_context) { MYSQL_RES * result; MYSQL_ROW row; char query_buffer[1024]; gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM,"MySQL queue replay"); gearmand::plugins::queue::MySQL *queue= (gearmand::plugins::queue::MySQL *)context; int query_buffer_length= snprintf(query_buffer, sizeof(query_buffer), "SELECT unique_key, function_name, data, priority, when_to_run FROM %s", queue->mysql_table.c_str()); if (mysql_real_query(queue->con, query_buffer, query_buffer_length)) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_real_query failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } if (!(result= mysql_store_result(queue->con))) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "mysql_store_result failed: %s", mysql_error(queue->con)); return GEARMAN_QUEUE_ERROR; } if (mysql_num_fields(result) < 5) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "MySQL queue: insufficient row fields in queue table"); return GEARMAN_QUEUE_ERROR; } gearmand_error_t ret= GEARMAN_SUCCESS; while ((row= mysql_fetch_row(result))) { unsigned long *lengths; gearman_job_priority_t priority= (gearman_job_priority_t)0; int when= 0; lengths= mysql_fetch_lengths(result); /* need to make a copy here ... gearman_server_job_free will free it later */ size_t data_size= lengths[2]; char * data= (char *)malloc(data_size); if (data == NULL) { return gearmand_perror(errno, "malloc failed"); } memcpy(data, row[2], data_size); if (lengths[3]) { priority= (gearman_job_priority_t) atoi(row[3]); } if (lengths[4]) { when= atoi(row[4]); } ret= (*add_fn)(server, add_context, row[0], (size_t) lengths[0], row[1], (size_t) lengths[1], data, data_size, priority, when); if (ret != GEARMAN_SUCCESS) { break; } } mysql_free_result(result); return ret; } gearmand-1.0.6/libgearman-server/plugins/base.h0000664000076400007640000001230412107145705021731 0ustar00brianbrian00000000000000/* 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_server_con_st; struct gearmand_packet_st; struct gearman_server_st; namespace gearmand { class Plugin { public: Plugin(const std::string&); const std::string &name() const { return _name; } int compare(const std::string&); virtual ~Plugin()= 0; boost::program_options::options_description &command_line_options(); bool has_error() { return _error_string.size(); } const std::string& error_string() { return _error_string; } protected: void reset_error() { _error_string.clear(); } std::string _error_string; private: boost::program_options::options_description _command_line_options; std::string _name; std::string _match; }; namespace queue { class Context { public: virtual ~Context()= 0; virtual gearmand_error_t add(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when)= 0; virtual gearmand_error_t flush(gearman_server_st *server)= 0; virtual gearmand_error_t done(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size)= 0; virtual gearmand_error_t replay(gearman_server_st *server)= 0; static gearmand_error_t replay_add(gearman_server_st *server, void *context __attribute__ ((unused)), const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when); bool has_error() { return _error_string.size(); } const std::string& error_string() { return _error_string; } protected: void reset_error() { _error_string.clear(); } std::string _error_string; }; } // namespace queue namespace protocol { class Context { public: virtual ~Context()= 0; // If the caller should free the Context, or leave it up to the plugin virtual bool is_owner() { return true; } // Notify on disconnect virtual void notify(gearman_server_con_st*) { return; } virtual size_t pack(const gearmand_packet_st *packet, gearman_server_con_st *con, void *data, const size_t data_size, gearmand_error_t& ret_ptr)= 0; virtual size_t unpack(gearmand_packet_st *packet, gearman_server_con_st *con, const void *data, const size_t data_size, gearmand_error_t& ret_ptr)= 0; bool has_error() { return _error_string.size(); } const std::string& error_string() { return _error_string; } protected: void reset_error() { _error_string.clear(); } std::string _error_string; }; } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/queue.h0000664000076400007640000000422712107145705022150 0ustar00brianbrian00000000000000/* 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 #include #include #include #include #include gearmand-1.0.6/libgearman-server/plugins/base.cc0000664000076400007640000000507612107145705022077 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include "libgearman-server/plugins/base.h" #include #include #include #include #include struct gearman_server_con_st; struct gearmand_packet_st; struct gearman_server_st; namespace gearmand { Plugin::Plugin(const std::string &name_arg) : _command_line_options(name_arg), _name(name_arg), _match(name_arg) { std::transform(_match.begin(), _match.end(), _match.begin(), ::tolower); } int Plugin::compare(const std::string& arg) { return _match.compare(arg); } Plugin::~Plugin() { } boost::program_options::options_description& Plugin::command_line_options() { return _command_line_options; } namespace queue { Context::~Context() { } } // namespace queue namespace protocol { Context::~Context() { } } // namespace protocol } // namespace gearmand gearmand-1.0.6/libgearman-server/plugins/protocol.h0000664000076400007640000000345712107145705022671 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/client.cc0000664000076400007640000000641712114264153020757 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server client definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #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= new (std::nothrow) gearman_server_client_st; if (client == NULL) { gearmand_merror("new", gearman_server_client_st, 0); return NULL; } } assert(client); if (client == NULL) { gearmand_error("In gearman_server_client_add() we failed to either allocorate of find a free one"); return NULL; } client->init(con); GEARMAN_LIST_ADD(con->client, client, con_); return client; } void gearman_server_client_free(gearman_server_client_st *client) { if (client) { 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_debug("delete gearman_server_client_st"); delete client; } } } gearmand-1.0.6/libgearman-server/thread.h0000664000076400007640000000757612107145705020624 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 #ifdef __cplusplus extern "C" { #endif #include /** * @addtogroup gearman_server_thread Thread Declarations * @ingroup gearman_server * * This is the interface gearman servers should use for creating threads. * * @{ */ /** * Initialize a thread structure. This cannot fail if the caller supplies a * thread structure. * @param server Server structure previously initialized with * gearman_server_create. * @param thread Caller allocated thread structure, or NULL to allocate one. * @return Pointer to an allocated thread structure if thread parameter was * NULL, or the thread parameter pointer if it was not NULL. */ GEARMAN_API 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_init. */ GEARMAN_API void gearman_server_thread_free(gearman_server_thread_st *thread); /** * Set thread run callback. * @param thread Thread structure previously initialized with * 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. */ GEARMAN_API void gearman_server_thread_set_run(gearman_server_thread_st *thread, gearman_server_thread_run_fn *run_fn, void *run_arg); /** * Process server thread connections. * @param thread Thread structure previously initialized with * 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 gearmand_con_st * gearman_server_thread_run(gearman_server_thread_st *thread, gearmand_error_t *ret_ptr); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/gearmand_thread.cc0000664000076400007640000003675512141170033022607 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Gearmand Thread Definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #include #include #include #include /* * Private declarations */ namespace { #if defined(HAVE_PTHREAD_TIMEDJOIN_NP) && HAVE_PTHREAD_TIMEDJOIN_NP bool fill_timespec(struct timespec& ts) { #if defined(HAVE_LIBRT) && HAVE_LIBRT if (HAVE_LIBRT) // This won't be called on OSX, etc,... { if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { gearmand_perror(errno, "clock_gettime(CLOCK_REALTIME)"); return false; } } #else { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { gearmand_perror(errno, "gettimeofday()"); return false; } TIMEVAL_TO_TIMESPEC(&tv, &ts); } #endif return true; } #endif // defined(HAVE_PTHREAD_TIMEDJOIN_NP) && HAVE_PTHREAD_TIMEDJOIN_NP } /** * @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); namespace { gearmand_error_t gearmand_connection_watch(gearmand_io_st *con, short events, void *) { short set_events= 0; gearmand_con_st* dcon= gearman_io_context(con); if (events & POLLIN) { set_events|= EV_READ; } if (events & POLLOUT) { set_events|= EV_WRITE; } if (dcon->last_events != set_events) { if (dcon->last_events) { if (event_del(&(dcon->event)) == -1) { gearmand_perror(errno, "event_del"); assert_msg(false, "event_del"); } } event_set(&(dcon->event), dcon->fd, set_events | EV_PERSIST, _con_ready, dcon); if (event_base_set(dcon->thread->base, &(dcon->event)) == -1) { gearmand_perror(errno, "event_base_set"); assert_msg(false, "event_del"); } if (event_add(&(dcon->event), NULL) == -1) { gearmand_perror(errno, "event_add"); return GEARMAN_EVENT; } dcon->last_events= set_events; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "%15s:%5s Watching %6s %s", dcon->host, dcon->port, events & POLLIN ? "POLLIN" : "", events & POLLOUT ? "POLLOUT" : ""); return GEARMAN_SUCCESS; } } /** @} */ /* * Public definitions */ gearmand_error_t gearmand_thread_create(gearmand_st *gearmand) { gearmand_thread_st* thread= new (std::nothrow) gearmand_thread_st; if (thread == NULL) { return gearmand_merror("new", gearmand_thread_st, 1); } if (! gearman_server_thread_init(gearmand_server(gearmand), &(thread->server_thread), _log, thread, gearmand_connection_watch)) { delete 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; GEARMAN_LIST__ADD(Gearmand()->thread, 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_debug("Initializing libevent for IO thread"); assert(thread->base == NULL); thread->base= event_base_new(); if (thread->base == NULL) { gearmand_thread_free(thread); gearmand_fatal("event_base_new()"); return GEARMAN_EVENT; } } gearmand_error_t 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_mutex_init(&(thread->lock), NULL); if (pthread_ret != 0) { thread->count= 0; gearmand_thread_free(thread); return gearmand_fatal_perror(pthread_ret, "pthread_mutex_init"); } 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); return gearmand_perror(pthread_ret, "pthread_create"); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Thread %u created", thread->count); return GEARMAN_SUCCESS; } void gearmand_thread_free(gearmand_thread_st *thread) { if (thread) { if (Gearmand()->threads and thread->count > 0) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Shutting down thread %u", thread->count); gearmand_thread_wakeup(thread, GEARMAND_WAKEUP_SHUTDOWN); int pthread_error= -1; #if defined(HAVE_PTHREAD_TIMEDJOIN_NP) && HAVE_PTHREAD_TIMEDJOIN_NP { struct timespec ts; if (fill_timespec(ts)) { ts.tv_sec+= 30; pthread_error= pthread_timedjoin_np(thread->id, NULL, &ts); if (pthread_error) { gearmand_perror(pthread_error, "pthread_timedjoin_np"); } } if (pthread_error != 0) { pthread_error= pthread_kill(thread->id, SIGQUIT); if (pthread_error) { gearmand_perror(pthread_error, "pthread_kill(, SIGQUIT)"); } pthread_error= pthread_join(thread->id, NULL); } } #else pthread_error= pthread_join(thread->id, NULL); #endif if (pthread_error) { gearmand_perror(pthread_error, "pthread_join"); } } if (thread->is_thread_lock) { int pthread_error; if ((pthread_error= pthread_mutex_destroy(&(thread->lock)))) { gearmand_perror(pthread_error, "pthread_mutex_destroy"); } } _wakeup_close(thread); while (thread->dcon_list != NULL) { gearmand_con_free(thread->dcon_list); } while (thread->dcon_add_list != NULL) { gearmand_con_st* dcon= thread->dcon_add_list; thread->dcon_add_list= dcon->next; gearmand_sockfd_close(dcon->fd); delete dcon; } while (thread->free_dcon_list != NULL) { gearmand_con_st* dcon= thread->free_dcon_list; thread->free_dcon_list= dcon->next; delete dcon; } gearman_server_thread_free(&(thread->server_thread)); GEARMAN_LIST__DEL(Gearmand()->thread, thread); if (Gearmand()->threads > 0) { if (thread->base != NULL) { if (Gearmand()->base == thread->base) { Gearmand()->base= NULL; } event_base_free(thread->base); thread->base= NULL; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Thread %u shutdown complete", thread->count); } delete 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 main gearmand thread is still active. */ int limit= 5; ssize_t written; while (--limit) { if ((written= write(thread->wakeup_fd[1], &buffer, 1)) != 1) { if (written < 0) { switch (errno) { case EINTR: continue; default: break; } gearmand_perror(errno, gearmand_strwakeup(wakeup)); } else { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "gearmand_wakeup() incorrectly wrote %lu bytes of data.", (unsigned long)written); } } break; } } 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 or ret == GEARMAN_IO_WAIT or ret == GEARMAN_SHUTDOWN_GRACEFUL) { return; } if (dcon == NULL) { /* 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]; int length= snprintf(buffer, sizeof(buffer), "[%6u ]", thread->count); if (length <= 0 or sizeof(length) >= sizeof(buffer)) { assert(0); buffer[0]= 0; } (void)gearmand_initialize_thread_logging(buffer); gearmand_debug("Entering thread event loop"); if (event_base_loop(thread->base, 0) == -1) { gearmand_fatal("event_base_loop(-1)"); Gearmand()->ret= GEARMAN_EVENT; } gearmand_debug("Exiting thread event loop"); return NULL; } static void _log(const char *line, gearmand_verbose_t verbose, gearmand_thread_st*) { if (Gearmand()) { (*Gearmand()->log_fn)(line, verbose, (void *)Gearmand()->log_context); } } static void _run(gearman_server_thread_st*, void *fn_arg) { if (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) { gearmand_debug("Creating IO thread wakeup pipe"); #if defined(HAVE_PIPE2) && HAVE_PIPE2 if (pipe2(thread->wakeup_fd, O_NONBLOCK) == -1) { return gearmand_perror(errno, "pipe"); } #else if (pipe(thread->wakeup_fd) == -1) { return gearmand_perror(errno, "pipe"); } int ret= fcntl(thread->wakeup_fd[0], F_GETFL, 0); if (ret == -1) { return gearmand_perror(errno, "fcntl(F_GETFL)"); } ret= fcntl(thread->wakeup_fd[0], F_SETFL, ret | O_NONBLOCK); if (ret == -1) { return gearmand_perror(errno, "fcntl(F_SETFL)"); } #endif 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(errno, "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_debug("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_debug(GEARMAN_DEFAULT_LOG_PARAM, "Clearing event for IO thread wakeup pipe %u", thread->count); if (event_del(&(thread->wakeup_event)) < 0) { gearmand_perror(errno, "event_del() failure, shutdown may hang"); } 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) { int local_errno= errno; if (local_errno == EINTR) { continue; } if (local_errno == EAGAIN) { break; } _clear_events(thread); gearmand_perror(local_errno, "_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_debug("Received PAUSE wakeup event"); break; case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: gearmand_debug("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_debug("Received SHUTDOWN wakeup event"); _clear_events(thread); break; case GEARMAND_WAKEUP_CON: gearmand_debug("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); } } gearmand-1.0.6/libgearman-server/packet.cc0000664000076400007640000002727312114264153020753 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server connection definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #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= new (std::nothrow) gearman_server_packet_st; if (server_packet == NULL) { gearmand_perror(errno, "new() gearman_server_packet_st"); return NULL; } } server_packet->next= NULL; return server_packet; } void destroy_gearman_server_packet_st(gearman_server_packet_st *packet) { delete packet; } void gearman_server_packet_free(gearman_server_packet_st *packet, gearman_server_thread_st *thread, bool from_thread) { if (from_thread and 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_debug("delete() gearman_server_packet_st"); delete 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_debug("delete() gearman_server_packet_st"); delete 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 (server_packet == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } server_packet->packet.reset(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; } int error; if ((error= pthread_mutex_lock(&con->thread->lock)) == 0) { GEARMAN_FIFO__ADD(con->io_packet, server_packet); if ((error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_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)); int error; if ((error= pthread_mutex_lock(&con->thread->lock)) == 0) { GEARMAN_FIFO__DEL(con->io_packet, server_packet); if ((error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_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) { int error; if ((error= pthread_mutex_lock(&con->thread->lock)) == 0) { GEARMAN_FIFO__ADD(con->proc_packet, packet); if ((error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_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) { int error; if ((error= pthread_mutex_lock(&con->thread->lock)) == 0) { GEARMAN_FIFO__DEL(con->proc_packet, server_packet); if ((error= pthread_mutex_unlock(&con->thread->lock)) != 0) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_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) { if (packet->argc == gearman_command_info(packet->command)->argc and (not (gearman_command_info(packet->command)->data) or 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 { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "resizing packet buffer"); if (packet->args == packet->args_buffer) { packet->args= (char *)malloc(packet->args_size + arg_size); memcpy(packet->args, packet->args_buffer, packet->args_size); } else { char *new_args= (char *)realloc(packet->args, packet->args_size + arg_size); if (new_args == NULL) { return gearmand_perror(errno, "realloc"); } 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 */ void gearmand_packet_st::reset(enum gearman_magic_t magic_, gearman_command_t command_) { options.complete= false; options.free_data= false; magic= magic_; command= command_; argc= 0; args_size= 0; data_size= 0; args= NULL; 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_debug("free packet's args"); free(packet->args); packet->args= NULL; } if (packet->options.free_data && packet->data != NULL) { gearmand_debug("free() packet's data"); 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) { 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; } uint32_t tmp= packet->command; tmp= htonl(tmp); 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) { 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; } gearmand-1.0.6/libgearman-server/byte.h0000664000076400007640000000421212107145705020300 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/io.h0000664000076400007640000001100112116617157017743 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Declarations */ #pragma once #include #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. */ 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(). */ void gearmand_io_free(gearmand_io_st *connection); 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. */ gearmand_error_t gearman_io_set_fd(gearmand_io_st *connection, int fd); /** * Get application context pointer. */ gearmand_con_st *gearman_io_context(const gearmand_io_st *connection); /** * Used by thread to send packets. */ gearmand_error_t gearman_io_send(gearman_server_con_st *connection, const struct gearmand_packet_st *packet, bool flush); /** * Used by thread to recv packets. */ gearmand_error_t gearman_io_recv(gearman_server_con_st *con, bool recv_data); /** * Set events to be watched for a connection. */ 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. */ gearmand_error_t gearmand_io_set_revents(gearman_server_con_st *connection, short revents); void gearmand_sockfd_close(int& sockfd); void gearmand_pipe_close(int& sockfd); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/constants.h0000664000076400007640000001367112111602475021357 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Defines, typedefs, and enums */ #pragma once #ifdef __cplusplus #include #else #include #endif #include #include #include /** * @addtogroup gearman_server_constants Constants * @ingroup gearman_server * @{ */ /* 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_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_DEFAULT_HASH_SIZE 991 #define GEARMAN_MAX_COMMAND_ARGS 8 #define GEARMAN_MAX_FREE_SERVER_CLIENT 1000 #define GEARMAN_MAX_FREE_SERVER_CON 1000 #define GEARMAN_MAX_FREE_SERVER_JOB 1000 #define GEARMAN_MAX_FREE_SERVER_PACKET 2000 #define GEARMAN_MAX_FREE_SERVER_WORKER 1000 #define GEARMAN_OPTION_SIZE 64 #define GEARMAN_PACKET_HEADER_SIZE 12 #define GEARMAN_PIPE_BUFFER_SIZE 256 #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_MAGIC_MEMORY (void*)(0x000001) /** @} */ /** @} */ typedef enum { 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; #endif #ifdef __cplusplus extern "C" { #endif /* Function types. */ typedef void (gearman_server_thread_run_fn)(gearman_server_thread_st *thread, void *context); typedef gearmand_error_t (gearman_queue_add_fn)(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, gearman_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 char *unique, size_t unique_size, const char *function_name, size_t function_name_size); typedef gearmand_error_t (gearman_queue_replay_fn)(gearman_server_st *server, void *context, gearman_queue_add_fn *add_fn, void *add_context); 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 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); /** @} */ /** * @addtogroup gearman_server_protocol Protocol Plugins * @ingroup gearman_server */ /** * @addtogroup gearman_server_queue Queue Plugins * @ingroup gearman_server */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/packet.h0000664000076400007640000001140412107145705020605 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Declarations */ #pragma once #include #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearman_server_packet Packet Declarations * @ingroup gearman_server * * This is a low level interface for gearman server connections. This is used * internally by the server interface, so you probably want to look there first. * * @{ */ /** * Initialize a server packet structure. */ GEARMAN_API gearman_server_packet_st * 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. */ GEARMAN_API void gearman_server_packet_free(gearman_server_packet_st *packet, gearman_server_thread_st *thread, bool from_thread); /** * Add a server packet structure to io queue for a connection. */ GEARMAN_API 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, ...); /** * Remove the first server packet structure from io queue for a connection. */ GEARMAN_API void gearman_server_io_packet_remove(gearman_server_con_st *con); /** * Add a server packet structure to proc queue for a connection. */ GEARMAN_API void gearman_server_proc_packet_add(gearman_server_con_st *con, gearman_server_packet_st *packet); /** * Remove the first server packet structure from proc queue for a connection. */ GEARMAN_API 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); void destroy_gearman_server_packet_st(gearman_server_packet_st *packet); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/job.h0000664000076400007640000001172712107145705020120 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Job Declarations */ #pragma once #include /** @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. * * @{ */ #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_client_st *server_client, 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, gearman_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); /** * Free a server job structure. */ GEARMAN_API void gearman_server_job_free(gearman_server_job_st *server_job); /** * Get a server job structure from the job handle. */ GEARMAN_API gearman_server_job_st *gearman_server_job_get(gearman_server_st *server, const char *job_handle, const size_t job_handle_length, gearman_server_con_st *worker_con); /** * See if there are any jobs to be run for the server worker connection. */ GEARMAN_API gearman_server_job_st * gearman_server_job_peek(gearman_server_con_st *server_con); /** * Start running a job for the server worker connection. */ GEARMAN_API gearman_server_job_st * gearman_server_job_take(gearman_server_con_st *server_con); /** * Queue a job to be run. */ GEARMAN_API gearmand_error_t gearman_server_job_queue(gearman_server_job_st *server_job); uint32_t _server_job_hash(const char *key, size_t key_size); void *_proc(void *data); void _server_con_worker_list_append(gearman_server_worker_st *list, gearman_server_worker_st *worker); gearman_server_job_st *gearman_server_job_get_by_unique(gearman_server_st *server, const char *unique, const size_t unique_length, gearman_server_con_st *worker_con); /** @} */ void destroy_gearman_server_job_st(gearman_server_job_st *); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/error/0000775000076400007640000000000012142673674020330 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman-server/error/include.am0000664000076400007640000000046212107145705022262 0ustar00brianbrian00000000000000# 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 gearmand-1.0.6/libgearman-server/error/type.h0000664000076400007640000000630512107145705021454 0ustar00brianbrian00000000000000/* 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_INVALID_ARGUMENT, 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) gearmand-1.0.6/libgearman-server/error/strerror.h0000664000076400007640000000361612107145705022357 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2010-2012 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 #ifdef __cplusplus extern "C" { #endif GEARMAN_API const char *gearmand_strerror(gearmand_error_t rc); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/error/strerror.cc0000664000076400007640000001153312107145705022512 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2010-2012 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 gearman_strerror() */ #include "gear_config.h" #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_INVALID_ARGUMENT: return "An invalid argument was passed to a function."; case GEARMAN_MAX_RETURN: default: return "Gibberish returned!"; } } gearmand-1.0.6/libgearman-server/io.cc0000664000076400007640000006526712114264153020120 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include "libgearman-server/common.h" #include #include #include #include #ifndef SOCK_NONBLOCK # define SOCK_NONBLOCK 0 #endif 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_msg(false, "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; } static 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_info(GEARMAN_DEFAULT_LOG_PARAM, "Peer connection has called close() %s:%s", connection->context == NULL ? "-" : connection->context->host, connection->context == NULL ? "-" : connection->context->port); _connection_close(connection); return 0; } else if (read_size == -1) { int local_errno= errno; switch (local_errno) { case EAGAIN: ret= gearmand_io_set_events(con, POLLIN); if (gearmand_failed(ret)) { gearmand_perror(local_errno, "recv"); return 0; } ret= GEARMAN_IO_WAIT; return 0; case EINTR: continue; case EPIPE: case ECONNRESET: case EHOSTDOWN: { ret= GEARMAN_LOST_CONNECTION; gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Peer connection has called close() %s:%s", connection->context == NULL ? "-" : connection->context->host, connection->context == NULL ? "-" : connection->context->port); _connection_close(connection); return 0; } break; default: ret= GEARMAN_ERRNO; } gearmand_perror(local_errno, "closing connection due to previous errno error"); _connection_close(connection); return 0; } break; } ret= GEARMAN_SUCCESS; return size_t(read_size); } static 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; } 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_debug(GEARMAN_DEFAULT_LOG_PARAM, "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) { int local_errno= errno; switch (local_errno) { case EAGAIN: { gearmand_error_t 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(local_errno, "lost connection to client during send(EPIPE || ECONNRESET || EHOSTDOWN)"); _connection_close(connection); return GEARMAN_LOST_CONNECTION; default: break; } gearmand_perror(local_errno, "send() failed, closing connection"); _connection_close(connection); return GEARMAN_ERRNO; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "send() %u bytes to peer %s:%s", uint32_t(write_size), connection->context == NULL ? "-" : connection->context->host, connection->context == NULL ? "-" : connection->context->port); 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; } } } /** * @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; GEARMAN_LIST__ADD(gearman->con, connection); connection->context= dcon; connection->send_buffer_ptr= connection->send_buffer; connection->recv_packet= NULL; connection->recv_buffer_ptr= connection->recv_buffer; } void gearmand_connection_list_st::list_free() { while (con_list) { gearmand_io_free(con_list); } } gearmand_connection_list_st::gearmand_connection_list_st() : con_count(0), con_list(NULL), event_watch_fn(NULL), event_watch_context(NULL) { } void gearmand_connection_list_st::init(gearmand_event_watch_fn *watch_fn, void *watch_context) { ready_con_count= 0; ready_con_list= NULL; con_count= 0; con_list= NULL; event_watch_fn= watch_fn; event_watch_context= watch_context; } void gearmand_io_free(gearmand_io_st *connection) { if (connection->fd != INVALID_SOCKET) _connection_close(connection); if (connection->options.ready) { connection->options.ready= false; GEARMAN_LIST_DEL(connection->universal->ready_con, connection, ready_); } GEARMAN_LIST__DEL(connection->universal->con, connection); 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_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; } gearmand_error_t gearman_io_send(gearman_server_con_st *con, const gearmand_packet_st *packet, bool flush) { 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) { gearmand_error_t ret; send_size= con->protocol->pack(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: { gearmand_error_t local_ret; if ((local_ret= _connection_flush(con)) != GEARMAN_SUCCESS) { return local_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: { gearmand_error_t local_ret; if ((local_ret= _connection_flush(con)) != GEARMAN_SUCCESS) { return local_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: { gearmand_error_t local_ret= _connection_flush(con); if (local_ret == GEARMAN_SUCCESS and connection->options.close_after_flush) { _connection_close(connection); local_ret= GEARMAN_LOST_CONNECTION; gearmand_debug("closing connection after flush by request"); } return local_ret; } } if (flush) { connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_UNIVERSAL_FLUSH; gearmand_error_t local_ret= _connection_flush(con); if (local_ret == GEARMAN_SUCCESS and connection->options.close_after_flush) { _connection_close(connection); local_ret= GEARMAN_LOST_CONNECTION; gearmand_debug("closing connection after flush by request"); } return local_ret; } connection->send_state= gearmand_io_st::GEARMAND_CON_SEND_STATE_NONE; 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. connection->recv_packet->reset(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) { assert(con->protocol); size_t recv_size= con->protocol->unpack(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_warn("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)) { // GEARMAN_LOST_CONNECTION is not worth a warning, clients/workers just // drop connections for close. if (ret != GEARMAN_LOST_CONNECTION) { gearmand_gerror_warn("Failed while in _connection_read()", ret); } return ret; } gearmand_log_debug(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_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_warn("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; GEARMAN_LIST_ADD(connection->universal->ready_con, connection, ready_); } 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_warn("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) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "setsockopt() %d", connection.fd); { int setting= 1; if (setsockopt(connection.fd, IPPROTO_TCP, TCP_NODELAY, &setting, (socklen_t)sizeof(int)) and errno != EOPNOTSUPP) { return gearmand_perror(errno, "setsockopt(TCP_NODELAY)"); } } { struct linger linger; 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))) { return gearmand_perror(errno, "setsockopt(SO_LINGER)"); } } #if defined(__MACH__) && defined(__APPLE__) || defined(__FreeBSD__) { int setting= 1; // This is not considered a fatal error if (setsockopt(connection.fd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&setting, sizeof(int))) { gearmand_perror(errno, "setsockopt(SO_NOSIGPIPE)"); } } #endif if (0) { struct timeval waittime; 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) { return gearmand_perror(errno, "setsockopt(SO_SNDTIMEO)"); } if (setsockopt(connection.fd, SOL_SOCKET, SO_RCVTIMEO, &waittime, (socklen_t)sizeof(struct timeval)) and errno != ENOPROTOOPT) { return gearmand_perror(errno, "setsockopt(SO_RCVTIMEO)"); } } if (0) { int setting= GEARMAN_DEFAULT_SOCKET_SEND_SIZE; if (setsockopt(connection.fd, SOL_SOCKET, SO_SNDBUF, &setting, (socklen_t)sizeof(int))) { return gearmand_perror(errno, "setsockopr(SO_SNDBUF)"); } setting= GEARMAN_DEFAULT_SOCKET_RECV_SIZE; if (setsockopt(connection.fd, SOL_SOCKET, SO_RCVBUF, &setting, (socklen_t)sizeof(int))) { return gearmand_perror(errno, "setsockopt(SO_RCVBUF)"); } } if (SOCK_NONBLOCK == 0) { int flags; do { flags= fcntl(connection.fd, F_GETFL, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags == -1) { return gearmand_perror(errno, "fcntl(F_GETFL)"); } else if ((flags & O_NONBLOCK) == 0) { int retval; do { retval= fcntl(connection.fd, F_SETFL, flags | O_NONBLOCK); } while (retval == -1 and (errno == EINTR or errno == EAGAIN)); if (retval == -1) { return gearmand_perror(errno, "fcntl(F_SETFL)"); } } } return GEARMAN_SUCCESS; } void gearmand_sockfd_close(int& sockfd) { if (sockfd == INVALID_SOCKET) { gearmand_error("gearmand_sockfd_close() called with an 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(errno, "shutdown"); assert(errno != ENOTSOCK); } else if (closesocket(sockfd) == SOCKET_ERROR) { gearmand_perror(errno, "close"); } sockfd= INVALID_SOCKET; } void gearmand_pipe_close(int& pipefd) { if (pipefd == INVALID_SOCKET) { gearmand_error("gearmand_pipe_close() called with an invalid socket"); return; } if (closesocket(pipefd) == SOCKET_ERROR) { gearmand_perror(errno, "close"); } pipefd= -1; } gearmand-1.0.6/libgearman-server/thread.cc0000664000076400007640000003034112107145705020744 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server Thread Definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #ifdef __cplusplus # include # include #else # include # include #endif /* * Private declarations */ /** * @addtogroup gearman_server_private Private Server Functions * @ingroup gearman_server * @{ */ /** * Try reading packets for a connection. */ static gearmand_error_t _thread_packet_read(gearman_server_con_st *con); /** * Flush outgoing packets for a connection. */ static gearmand_error_t _thread_packet_flush(gearman_server_con_st *con); /** * Start processing thread for the server. */ static gearmand_error_t _proc_thread_start(gearman_server_st *server); /** * Kill processing thread for the server. */ static void _proc_thread_kill(gearman_server_st *server); /** @} */ /* * Public definitions */ 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 false; } } thread->con_count= 0; thread->io_count= 0; thread->proc_count= 0; thread->to_be_freed_count= 0; thread->free_con_count= 0; thread->free_packet_count= 0; thread->log_fn= log_function; thread->log_context= context; thread->run_fn= NULL; thread->run_fn_arg= NULL; thread->con_list= NULL; thread->io_list= NULL; thread->proc_list= NULL; thread->free_con_list= NULL; thread->free_packet_list= NULL; thread->to_be_freed_list= NULL; int error; if ((error= pthread_mutex_init(&(thread->lock), NULL))) { gearmand_perror(error, "pthread_mutex_init"); return false; } GEARMAN_LIST__ADD(server->thread, thread); thread->gearman= &(thread->gearmand_connection_list_static); thread->gearman->init(event_watch, NULL); return true; } void gearman_server_thread_free(gearman_server_thread_st *thread) { _proc_thread_kill(Server); while (thread->con_list != NULL) { gearman_server_con_free(thread->con_list); } while (thread->free_con_list != NULL) { gearman_server_con_st *con= thread->free_con_list; thread->free_con_list= con->next; delete con; } while (thread->free_packet_list != NULL) { gearman_server_packet_st *packet= thread->free_packet_list; thread->free_packet_list= packet->next; destroy_gearman_server_packet_st(packet); } if (thread->gearman != NULL) { thread->gearman->list_free(); } pthread_mutex_destroy(&(thread->lock)); GEARMAN_LIST__DEL(Server->thread, thread); } void gearman_server_thread_set_run(gearman_server_thread_st *thread, gearman_server_thread_run_fn *run_fn, void *run_fn_arg) { thread->run_fn= run_fn; thread->run_fn_arg= run_fn_arg; } gearmand_con_st * gearman_server_thread_run(gearman_server_thread_st *thread, gearmand_error_t *ret_ptr) { /* If we are multi-threaded, we may have packets to flush or connections that should start reading again. */ if (Server->flags.threaded) { gearman_server_con_st *server_con; while ((server_con= gearman_server_con_to_be_freed_next(thread)) != NULL) { if (server_con->is_dead && server_con->proc_removed) gearman_server_con_free(server_con); else gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "con %llu isn't dead %d or proc removed %d, but is in to_be_freed_list", server_con, server_con->is_dead, server_con->proc_removed); } while ((server_con= gearman_server_con_io_next(thread)) != NULL) { if (server_con->is_dead) { gearman_server_con_attempt_free(server_con); continue; } if (server_con->ret != GEARMAN_SUCCESS) { *ret_ptr= server_con->ret; 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 gearman_server_con_data(server_con); } } } /* Check for new activity on connections. */ { gearman_server_con_st *server_con; while ((server_con= gearmand_ready(thread->gearman))) { /* 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 (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 (! (Server->flags.threaded)) { 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 gearman_server_con_data(server_con); } } } /* Check for the two shutdown modes. */ if (Server->shutdown) { *ret_ptr= GEARMAN_SHUTDOWN; } else if (Server->shutdown_graceful) { if (Server->job_count == 0) { *ret_ptr= GEARMAN_SHUTDOWN; } else { *ret_ptr= GEARMAN_SHUTDOWN_GRACEFUL; } } else { *ret_ptr= GEARMAN_SUCCESS; } return NULL; } /* * Private definitions */ static gearmand_error_t _thread_packet_read(gearman_server_con_st *con) { while (1) { if (con->packet == NULL) { if (! (con->packet= gearman_server_packet_create(con->thread, true))) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } } 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; } 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 (Server->flags.threaded) { /* Multi-threaded, queue for the processing thread to run. */ gearman_server_proc_packet_add(con, con->packet); con->packet= NULL; } else { /* Single threaded, run the command here. */ 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 (gearmand_failed(rc)) { return rc; } } } return GEARMAN_SUCCESS; } static gearmand_error_t _thread_packet_flush(gearman_server_con_st *con) { /* 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) { gearmand_error_t ret= gearman_io_send(con, &(con->io_packet_list->packet), con->io_packet_list->next == NULL ? true : false); if (gearmand_failed(ret)) { return ret; } 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 gearmand_io_set_events(con, POLLIN); } static gearmand_error_t _proc_thread_start(gearman_server_st *server) { int error; if ((error= pthread_mutex_init(&(server->proc_lock), NULL))) { return gearmand_perror(error, "pthread_mutex_init"); } if ((error= pthread_cond_init(&(server->proc_cond), NULL))) { return gearmand_perror(error, "pthread_cond_init"); } pthread_attr_t attr; if ((error= pthread_attr_init(&attr))) { return gearmand_perror(error, "pthread_attr_init"); } if ((error= pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM))) { (void) pthread_attr_destroy(&attr); return gearmand_perror(error, "pthread_attr_setscope"); } if ((error= pthread_create(&(server->proc_id), &attr, _proc, server))) { (void) pthread_attr_destroy(&attr); return gearmand_perror(error, "pthread_create"); } if ((error= pthread_attr_destroy(&attr))) { gearmand_perror(error, "pthread_create"); } server->flags.threaded= true; return GEARMAN_SUCCESS; } static void _proc_thread_kill(gearman_server_st *server) { if (! (server->flags.threaded) || server->proc_shutdown) { return; } server->proc_shutdown= true; /* Signal proc thread to shutdown. */ int error; if ((error= pthread_mutex_lock(&(server->proc_lock))) == 0) { if ((error= pthread_cond_signal(&(server->proc_cond)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_cond_signal"); } if ((error= pthread_mutex_unlock(&(server->proc_lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); } /* Wait for the proc thread to exit and then cleanup. */ if ((error= pthread_join(server->proc_id, NULL))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_join"); } if ((error= pthread_cond_destroy(&(server->proc_cond)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_cond_destroy"); } if ((error= pthread_mutex_destroy(&(server->proc_lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_destroy"); } } gearmand-1.0.6/libgearman-server/timer.h0000664000076400007640000000351512107145705020462 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 libgearman { namespace server { class Epoch { public: Epoch(); ~Epoch(); static struct timeval current(); }; } // server } // libgearman gearmand-1.0.6/libgearman-server/error.h0000664000076400007640000000341212107145705020467 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/log.cc0000664000076400007640000003214412141153076020257 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include "libgearman-server/common.h" #include "libgearman-server/timer.h" #include #include #include #include #include #include #include #ifdef _WIN32 # include #else # include #endif #ifndef __INTEL_COMPILER # pragma GCC diagnostic ignored "-Wold-style-cast" # pragma GCC diagnostic ignored "-Wformat-nonliteral" # pragma GCC diagnostic ignored "-Wformat-security" #endif 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) { int pthread_error; if ((pthread_error= pthread_key_create(&logging_key, delete_log))) { gearmand_log_fatal_perror(GEARMAND_AT, "pthread_key_create", pthread_error, "pthread_key_create"); abort(); } } gearmand_error_t gearmand_initialize_thread_logging(const char *identity) { if (identity) { int pthread_error; if ((pthread_error= pthread_once(&intitialize_log_once, create_log))) { return gearmand_log_fatal_perror(GEARMAND_AT, "pthread_once", pthread_error, "identity: %s", identity); } if (pthread_getspecific(logging_key) == NULL) { const char *key_to_use= strdup(identity); if ((pthread_error= pthread_setspecific(logging_key, key_to_use))) { return gearmand_log_fatal_perror(GEARMAND_AT, "pthread_setspecific", pthread_error, "identity: %s", identity); } } return GEARMAN_SUCCESS; } gearmand_fatal("identity was NULL"); return GEARMAN_INVALID_ARGUMENT; } /** * 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 /* func */, gearmand_verbose_t verbose, const gearmand_error_t error_arg, const char *format, va_list args) { struct timeval current_epoch; if (Gearmand() and Gearmand()->verbose < GEARMAND_VERBOSE_DEBUG) { current_epoch= libgearman::server::Epoch::current(); current_epoch.tv_usec= 0; } else { (void)gettimeofday(¤t_epoch, NULL); } struct tm current_tm; if (current_epoch.tv_sec == 0) { (void)gettimeofday(¤t_epoch, NULL); } if ((gmtime_r(¤t_epoch.tv_sec, ¤t_tm) == NULL)) { memset(¤t_epoch, 0, sizeof(current_epoch)); } (void) pthread_once(&intitialize_log_once, create_log); const char *identity= (const char *)pthread_getspecific(logging_key); if (identity == NULL) { identity= "[ main ]"; } char log_buffer[GEARMAN_MAX_ERROR_SIZE*2] = { 0 }; if (Gearmand() && Gearmand()->log_fn) { char *log_buffer_ptr= log_buffer; size_t remaining_size= sizeof(log_buffer); { int length= snprintf(log_buffer, sizeof(log_buffer), "%04d-%02d-%02d %02d:%02d:%02d.%06d %s ", int(1900 +current_tm.tm_year), current_tm.tm_mon +1, current_tm.tm_mday, current_tm.tm_hour, current_tm.tm_min, current_tm.tm_sec, int(current_epoch.tv_usec), identity); // We just return whatever we have if this occurs if (length <= 0 or (size_t)length >= sizeof(log_buffer)) { remaining_size= 0; } else { remaining_size-= size_t(length); log_buffer_ptr+= length; } } if (remaining_size) { int length= vsnprintf(log_buffer_ptr, remaining_size, format, args); if (length <= 0 or size_t(length) >= remaining_size) { remaining_size= 0; } else { remaining_size-= size_t(length); log_buffer_ptr+= length; } } if (remaining_size and error_arg != GEARMAN_SUCCESS) { int length= snprintf(log_buffer_ptr, remaining_size, " %s(%s)", func, gearmand_strerror(error_arg)); if (length <= 0 or size_t(length) >= remaining_size) { remaining_size= 0; } else { remaining_size-= size_t(length); log_buffer_ptr+= length; } } if (remaining_size and position and verbose != GEARMAND_VERBOSE_INFO) { int length= snprintf(log_buffer_ptr, remaining_size, " -> %s", position); if (length <= 0 or size_t(length) >= remaining_size) { remaining_size= 0; } } // Make sure this is null terminated log_buffer[sizeof(log_buffer) -1]= 0; } if (Gearmand() and Gearmand()->log_fn) { Gearmand()->log_fn(log_buffer, verbose, (void *)Gearmand()->log_context); } else { fprintf(stderr, "%s -> %s", log_buffer, gearmand_verbose_name(verbose)); vfprintf(stderr, format, args); fprintf(stderr, "\n"); } } gearmand_error_t gearmand_log_fatal(const char *position, const char *func, const char *format, ...) { if (Gearmand() and Gearmand()->verbose < GEARMAND_VERBOSE_FATAL) { return GEARMAN_ERRNO; } { va_list args; va_start(args, format); gearmand_log(position, func, GEARMAND_VERBOSE_FATAL, GEARMAN_SUCCESS, format, args); va_end(args); } return GEARMAN_ERRNO; } gearmand_error_t gearmand_log_fatal_perror(const char *position, const char *function, const int local_errno, const char *format, ...) { if (Gearmand() and Gearmand()->verbose < GEARMAND_VERBOSE_FATAL) { return GEARMAN_ERRNO; } char* message_buffer= NULL; { va_list args; va_start(args, format); size_t ask= snprintf(0, 0, format); ask++; // for null message_buffer= (char*)alloca(sizeof(char) * ask); if (message_buffer) { vsnprintf(message_buffer, ask, format, args); } va_end(args); } { const char *errmsg_ptr; char errmsg[GEARMAN_MAX_ERROR_SIZE]; errmsg[0]= 0; #ifdef STRERROR_R_CHAR_P errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg)); #else strerror_r(local_errno, errmsg, sizeof(errmsg)); errmsg_ptr= errmsg; #endif if (message_buffer) { gearmand_log_fatal(position, function, "%s(%s)", message_buffer, errmsg_ptr); } else { gearmand_log_fatal(position, function, "%s", errmsg_ptr); } } switch (local_errno) { case ENOMEM: return GEARMAN_MEMORY_ALLOCATION_FAILURE; case ECONNRESET: case EHOSTDOWN: return GEARMAN_LOST_CONNECTION; default: break; } return GEARMAN_ERRNO; } gearmand_error_t gearmand_log_error(const char *position, const char *function, const char *format, ...) { if (not Gearmand() or Gearmand()->verbose >= GEARMAND_VERBOSE_ERROR) { va_list args; va_start(args, format); gearmand_log(position, function, GEARMAND_VERBOSE_ERROR, GEARMAN_SUCCESS, format, args); va_end(args); } return GEARMAN_UNKNOWN_OPTION; } void gearmand_log_warning(const char *position, const char *function, const char *format, ...) { if (not Gearmand() or Gearmand()->verbose >= GEARMAND_VERBOSE_WARN) { va_list args; va_start(args, format); gearmand_log(position, function, GEARMAND_VERBOSE_WARN, GEARMAN_SUCCESS, format, args); va_end(args); } } // LOG_NOTICE is only used for reporting job status. void gearmand_log_notice(const char *position, const char *function, const char *format, ...) { if (not Gearmand() or Gearmand()->verbose >= GEARMAND_VERBOSE_NOTICE) { va_list args; va_start(args, format); gearmand_log(position, function, GEARMAND_VERBOSE_NOTICE, GEARMAN_SUCCESS, format, args); va_end(args); } } void gearmand_log_info(const char *position, const char *function, const char *format, ...) { if (not Gearmand() or Gearmand()->verbose >= GEARMAND_VERBOSE_INFO) { va_list args; va_start(args, format); gearmand_log(position, function, GEARMAND_VERBOSE_INFO, GEARMAN_SUCCESS, 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, GEARMAN_SUCCESS, format, args); va_end(args); } } gearmand_error_t gearmand_log_perror(const char *position, const char *function, const int local_errno, const char *format, ...) { if (not Gearmand() or (Gearmand()->verbose >= GEARMAND_VERBOSE_ERROR)) { char* message_buffer= NULL; { va_list args; va_start(args, format); size_t ask= snprintf(0, 0, format); ask++; // for null message_buffer= (char*)alloca(sizeof(char) * ask); vsnprintf(message_buffer, ask, format, args); va_end(args); } const char *errmsg_ptr; char errmsg[GEARMAN_MAX_ERROR_SIZE]; errmsg[0]= 0; #ifdef STRERROR_R_CHAR_P errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg)); #else strerror_r(local_errno, errmsg, sizeof(errmsg)); errmsg_ptr= errmsg; #endif if (message_buffer) { gearmand_log_error(position, function, "%s(%s)", message_buffer, errmsg_ptr); } else { gearmand_log_error(position, function, "%s", errmsg_ptr); } } switch (local_errno) { case ENOMEM: return GEARMAN_MEMORY_ALLOCATION_FAILURE; case ECONNRESET: case EHOSTDOWN: return GEARMAN_LOST_CONNECTION; default: break; } return GEARMAN_ERRNO; } gearmand_error_t gearmand_log_gerror(const char *position, const char *function, const gearmand_error_t rc, const char *format, ...) { if (gearmand_failed(rc) and rc != GEARMAN_IO_WAIT) { va_list args; if (Gearmand() == NULL or Gearmand()->verbose >= GEARMAND_VERBOSE_ERROR) { va_start(args, format); gearmand_log(position, function, GEARMAND_VERBOSE_ERROR, rc, format, args); va_end(args); } } else if (rc == GEARMAN_IO_WAIT) { } return rc; } gearmand_error_t gearmand_log_gerror_warn(const char *position, const char *function, const gearmand_error_t rc, const char *format, ...) { if (gearmand_failed(rc) and rc != GEARMAN_IO_WAIT) { va_list args; if (Gearmand() == NULL or Gearmand()->verbose >= GEARMAND_VERBOSE_WARN) { va_start(args, format); gearmand_log(position, function, GEARMAND_VERBOSE_WARN, rc, format, args); va_end(args); } } else if (rc == GEARMAN_IO_WAIT) { } 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, errno, 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; } gearmand-1.0.6/libgearman-server/gearmand_con.h0000664000076400007640000000611712107145705021760 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Declarations */ #pragma once #include #include #include #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearmand_con Connection Declarations * @ingroup gearmand * * Connection handling for gearmand. * * @{ */ /** * Create a new gearmand connection. * @param gearmand Server instance structure previously initialized with * gearmand_create. * @param fd File descriptor of new connection. * @param host Host of peer connection. * @param port Port of peer connection. * @param add_fn Optional callback to use when adding the connection to an I/O thread. * @return Pointer to an allocated gearmand structure. */ GEARMAN_API gearmand_error_t gearmand_con_create(gearmand_st *gearmand, int fd, const char *host, const char *port, gearmand_connection_add_fn *add_fn); /** * Free resources used by a connection. * @param dcon Connection previously initialized with gearmand_con_create. */ GEARMAN_API void gearmand_con_free(gearmand_con_st *dcon); /** * Check connection queue for a thread. */ GEARMAN_API void gearmand_con_check_queue(gearmand_thread_st *thread); void _con_ready(int fd, short events, void *arg); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/worker.h0000664000076400007640000000477312107145705020662 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Worker Declarations */ #pragma once #include #ifdef __cplusplus extern "C" { #endif /** @addtogroup gearman_server_worker Worker Declarations @ingroup * gearman_server * * This is a low level interface for gearman server workers. This is used * internally by the server interface, so you probably want to look there first. * * @{ */ /** * Add a new worker to a server instance. */ GEARMAN_API gearman_server_worker_st * gearman_server_worker_add(gearman_server_con_st *con, const char *function_name, size_t function_name_size, long timeout); /** * Free a server worker structure. */ GEARMAN_API void gearman_server_worker_free(gearman_server_worker_st *worker); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/gearmand_thread.h0000664000076400007640000000600512107145705022444 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Thread Declarations */ #pragma once #include #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearmand_thread Thread Declarations * @ingroup gearmand * * Thread handling for gearmand. * * @{ */ /** * Create a new gearmand thread. * @param gearmand Server instance structure previously initialized with * gearmand_create. * @return Standard gearman return value. */ GEARMAN_API gearmand_error_t gearmand_thread_create(struct gearmand_st *gearmand); /** * Free resources used by a thread. * @param thread Thread previously initialized with gearmand_thread_create. */ GEARMAN_API void gearmand_thread_free(gearmand_thread_st *thread); /** * Interrupt a running gearmand thread. * @param thread Thread structure previously initialized with * gearmand_thread_create. * @param wakeup Wakeup event to send to running thread. */ GEARMAN_API void gearmand_thread_wakeup(gearmand_thread_st *thread, gearmand_wakeup_t wakeup); /** * Run the thread when there are events ready. * @param thread Thread structure previously initialized with * gearmand_thread_create. */ GEARMAN_API void gearmand_thread_run(gearmand_thread_st *thread); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/log.h0000664000076400007640000001307212122444522020116 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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. * */ /* All logging facilities within the server. */ #include #pragma once #ifdef __cplusplus extern "C" { #endif #ifndef __PRETTY_FUNCTION__ # define __PRETTY_FUNCTION__ __func__ #endif #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) #define GEARMAND_AT __FILE__ ":" TOSTRING(__LINE__) #ifndef gearman_literal_param # ifdef __cplusplus # define gearman_literal_param(X) (X), (size_t(sizeof(X) - 1)) # else # define gearman_literal_param(X) (X), ((size_t)((sizeof(X) - 1))) # endif #endif #define GEARMAN_DEFAULT_LOG_PARAM GEARMAND_AT, __PRETTY_FUNCTION__ GEARMAN_INTERNAL_API gearmand_error_t gearmand_initialize_thread_logging(const char *identity); /** * Log a fatal message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API gearmand_error_t 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 gearmand_error_t gearmand_log_fatal_perror(const char *position, const char *function, const int local_errno, const char *format, ...); #define gearmand_fatal_perror(__local_errno, __mesg) gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, (__local_errno), (__mesg)) /** * Log an error message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API 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)) gearmand_error_t gearmand_log_perror(const char *position, const char *function, const int local_errno, const char *format, ...); #define gearmand_perror(__local_errno, __mesg) gearmand_log_perror(GEARMAN_DEFAULT_LOG_PARAM, (__local_errno), (__mesg)) gearmand_error_t gearmand_log_gerror(const char *position, const char *function, const gearmand_error_t rc, const char *format, ...); #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_gerror_warn(const char *position, const char *function, const gearmand_error_t rc, const char *format, ...); #define gearmand_gerror_warn(_mesg, _gearmand_errot_t) gearmand_log_gerror_warn(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))) GEARMAN_INTERNAL_API void gearmand_log_notice(const char *position, const char *function, const char *format, ...); /** * Log an info message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API 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 an info message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API void gearmand_log_warning(const char *position, const char *function, const char *format, ...); #define gearmand_warning(_mesg) gearmand_log_warning(GEARMAN_DEFAULT_LOG_PARAM, (_mesg)) /** * Log a debug message, see gearmand_log() for argument details. */ GEARMAN_INTERNAL_API 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)) #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/gearmand.cc0000664000076400007640000007722112122032115021246 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 Gearmand Definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "util/memory.h" using namespace org::tangent; using namespace gearmand; #ifndef SOCK_NONBLOCK # define SOCK_NONBLOCK 0 #endif /* * 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, const uint32_t job_retries, const char *job_handle_prefix, uint8_t worker_wakeup, bool round_robin, uint32_t hashtable_buckets); static void gearmand_set_log_fn(gearmand_st *gearmand, gearmand_log_fn *function, void *context, const gearmand_verbose_t verbose); static void gearman_server_free(gearman_server_st& server) { /* All threads should be cleaned up before calling this. */ assert(server.thread_list == NULL); for (uint32_t key= 0; key < server.hashtable_buckets; key++) { while (server.job_hash[key] != NULL) { gearman_server_job_free(server.job_hash[key]); } } for (uint32_t function_key= 0; function_key < GEARMAND_DEFAULT_HASH_SIZE; function_key++) { while(server.function_hash[function_key] != NULL) { gearman_server_function_free(&server, server.function_hash[function_key]); } } while (server.free_packet_list != NULL) { gearman_server_packet_st *packet= server.free_packet_list; server.free_packet_list= packet->next; delete packet; } while (server.free_job_list != NULL) { gearman_server_job_st* job= server.free_job_list; server.free_job_list= job->next; delete job; } while (server.free_client_list != NULL) { gearman_server_client_st* client= server.free_client_list; server.free_client_list= client->con_next; delete client; } while (server.free_worker_list != NULL) { gearman_server_worker_st* worker= server.free_worker_list; server.free_worker_list= worker->con_next; delete worker; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "removing queue: %s", (server.queue_version == QUEUE_VERSION_CLASS) ? "CLASS" : "FUNCTION"); if (server.queue_version == QUEUE_VERSION_CLASS) { delete server.queue.object; assert(server.queue.functions == NULL); } else if (server.queue_version == QUEUE_VERSION_FUNCTION) { delete server.queue.functions; assert(server.queue.object == NULL); } else { gearmand_debug("Unknown queue type in removal"); } free(server.job_hash); free(server.unique_hash); free(server.function_hash); } /** @} */ #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_msg(false, "Gearmand() was called before it was allocated"); } assert(_global_gearmand); return _global_gearmand; } gearmand_st *gearmand_create(const char *host_arg, uint32_t threads_arg, int backlog_arg, const uint32_t job_retries, const char *job_handle_prefix, uint8_t worker_wakeup, gearmand_log_fn *log_function, void *log_context, const gearmand_verbose_t verbose_arg, bool round_robin, bool exceptions_, uint32_t hashtable_buckets) { assert(_global_gearmand == NULL); if (_global_gearmand) { gearmand_error("You have called gearmand_create() twice within your application."); _exit(EXIT_FAILURE); } gearmand_st* gearmand= new (std::nothrow) gearmand_st(host_arg, threads_arg, backlog_arg, verbose_arg, exceptions_); if (gearmand == NULL) { gearmand_perror(errno, "Failed to new() gearmand_st"); return NULL; } _global_gearmand= gearmand; if (gearman_server_create(gearmand->server, job_retries, job_handle_prefix, worker_wakeup, round_robin, hashtable_buckets) == false) { delete gearmand; _global_gearmand= NULL; return NULL; } gearmand_set_log_fn(gearmand, log_function, log_context, verbose_arg); return gearmand; } void gearmand_free(gearmand_st *gearmand) { if (gearmand) { _close_events(gearmand); if (gearmand->threads > 0) { gearmand_debug("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= gearmand->free_dcon_list; gearmand->free_dcon_list= dcon->next; delete dcon; } if (gearmand->base != NULL) { event_base_free(gearmand->base); gearmand->base= NULL; } gearman_server_free(gearmand->server); gearmand_info("Shutdown complete"); delete 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; } bool gearmand_exceptions(gearmand_st *gearmand) { return gearmand->exceptions(); } gearmand_error_t gearmand_port_add(gearmand_st *gearmand, const char *port, gearmand_connection_add_fn *function) { gearmand->_port_list.resize(gearmand->_port_list.size() +1); strncpy(gearmand->_port_list.back().port, port, NI_MAXSERV); gearmand->_port_list.back().add_fn= function; return GEARMAN_SUCCESS; } gearman_server_st *gearmand_server(gearmand_st *gearmand) { return &gearmand->server; } gearmand_error_t gearmand_run(gearmand_st *gearmand) { libgearman::server::Epoch epoch; /* Initialize server components. */ if (gearmand->base == NULL) { gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Starting up(%lu), verbose set to %s", (unsigned long)(getpid()), gearmand_verbose_name(gearmand->verbose)); if (gearmand->threads > 0) { /* 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); } 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. */ uint32_t x= 0; do { gearmand->ret= gearmand_thread_create(gearmand); if (gearmand->ret != GEARMAN_SUCCESS) return gearmand->ret; x++; } while (x < gearmand->threads); gearmand_debug("replaying queue: begin"); gearmand->ret= gearman_server_queue_replay(gearmand->server); if (gearmand_failed(gearmand->ret)) { return gearmand_gerror("failed to reload queue", gearmand->ret); } gearmand_debug("replaying queue: end"); } gearmand->ret= _watch_events(gearmand); if (gearmand_failed(gearmand->ret)) { return gearmand->ret; } gearmand_debug("Entering main event loop"); if (event_base_loop(gearmand->base, 0) == -1) { gearmand_fatal("event_base_loop(-1)"); return GEARMAN_EVENT; } gearmand_debug("Exited main event loop"); return gearmand->ret; } void gearmand_wakeup(gearmand_st *gearmand, gearmand_wakeup_t 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 (gearmand->wakeup_fd[1] != -1) { int limit= 5; while (--limit) // limit is for EINTR { ssize_t written; uint8_t buffer= wakeup; if ((written= write(gearmand->wakeup_fd[1], &buffer, 1)) != 1) { if (written < 0) { switch (errno) { case EINTR: continue; default: break; } gearmand_perror(errno, gearmand_strwakeup(wakeup)); } else { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "gearmand_wakeup() incorrectly wrote %lu bytes of data.", (unsigned long)written); } } return; } } } /* * Private definitions */ gearmand_error_t set_socket(int& fd, struct addrinfo *addrinfo_next) { /* 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) { return gearmand_perror(errno, "socket()"); } #ifdef IPV6_V6ONLY { int flags= 1; if (addrinfo_next->ai_family == AF_INET6) { flags= 1; if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flags, sizeof(flags)) == -1) { return gearmand_perror(errno, "setsockopt(IPV6_V6ONLY)"); } } } #endif if (0) // Add in when we have server working as a library again. { if (FD_CLOEXEC) { int flags; do { flags= fcntl(fd, F_GETFD, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags != -1) { int rval; do { rval= fcntl (fd, F_SETFD, flags | FD_CLOEXEC); } while (rval == -1 && (errno == EINTR or errno == EAGAIN)); // we currently ignore the case where rval is -1 } } } { int flags= 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags)) == -1) { return gearmand_perror(errno, "setsockopt(SO_REUSEADDR)"); } } { int flags= 1; if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags)) == -1) { return gearmand_perror(errno, "setsockopt(SO_KEEPALIVE)"); } } { struct linger ling= {0, 0}; if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)) == -1) { return gearmand_perror(errno, "setsockopt(SO_LINGER)"); } } { int flags= 1; if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags)) == -1) { return gearmand_perror(errno, "setsockopt(TCP_NODELAY)"); } } return GEARMAN_SUCCESS; } static const uint32_t bind_timeout= 20; // Number is not special, but look at INFO messages if you decide to change it. typedef std::pair host_port_t; static gearmand_error_t _listen_init(gearmand_st *gearmand) { for (uint32_t x= 0; x < gearmand->_port_list.size(); ++x) { struct addrinfo hints; struct addrinfo *addrinfo; gearmand_port_st *port= &gearmand->_port_list[x]; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_flags= AI_PASSIVE; hints.ai_socktype= SOCK_STREAM; { int ret= getaddrinfo(gearmand->host, port->port, &hints, &addrinfo); if (ret != 0) { char buffer[1024]; int length= snprintf(buffer, sizeof(buffer), "%s:%s", gearmand->host ? gearmand->host : "", port->port); if (length <= 0 or size_t(length) >= sizeof(buffer)) { buffer[0]= 0; } return gearmand_gai_error(buffer, ret); } } std::set unique_hosts; for (struct addrinfo *addrinfo_next= addrinfo; addrinfo_next != NULL; addrinfo_next= addrinfo_next->ai_next) { char host[NI_MAXHOST]; { int 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); strncpy(host, "-", sizeof(host)); strncpy(port->port, "-", sizeof(port->port)); } } std::string host_string(host); std::string port_string(port->port); host_port_t check= std::make_pair(host_string, port_string); if (unique_hosts.find(check) != unique_hosts.end()) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Already listening on %s:%s", host, port->port); continue; } unique_hosts.insert(check); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Trying to listen on %s:%s", host, port->port); /* @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; int ret= -1; int fd; for (waited= 0, retry= 1; ; retry++, waited+= this_wait) { { gearmand_error_t socket_ret; if (gearmand_failed(socket_ret= set_socket(fd, addrinfo_next))) { gearmand_sockfd_close(fd); return socket_ret; } } errno= 0; if ((ret= bind(fd, addrinfo_next->ai_addr, addrinfo_next->ai_addrlen)) == 0) { // Success break; } // Protect our error ret= errno; gearmand_sockfd_close(fd); if (waited >= bind_timeout) { return gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Timeout occured when calling bind() for %s:%s", host, port->port); } if (ret != EADDRINUSE) { return gearmand_perror(ret, "bind"); } this_wait= retry * retry / 3 + 1; // We are in single user threads, so strerror() is fine. gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Retrying bind(%s) on %s:%s %u + %u >= %u", strerror(ret), host, port->port, waited, this_wait, bind_timeout); struct timespec requested; requested.tv_sec= this_wait; requested.tv_nsec= 0; nanosleep(&requested, NULL); } if (listen(fd, gearmand->backlog) == -1) { gearmand_perror(errno, "listen"); gearmand_sockfd_close(fd); return GEARMAN_ERRNO; } // Scoping note for eventual transformation { int* fd_list= (int *)realloc(port->listen_fd, sizeof(int) * (port->listen_count + 1)); if (fd_list == NULL) { gearmand_perror(errno, "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) { return gearmand_log_fatal(GEARMAN_DEFAULT_LOG_PARAM, "Could not bind/listen to any addresses"); } assert(port->listen_event == NULL); 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); if (event_base_set(gearmand->base, &(port->listen_event[y])) == -1) { return gearmand_perror(errno, "event_base_set()"); } } } return GEARMAN_SUCCESS; } static void _listen_close(gearmand_st *gearmand) { _listen_clear(gearmand); for (uint32_t x= 0; x < gearmand->_port_list.size(); ++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_list.size(); ++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(errno, "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) { for (uint32_t x= 0; x < gearmand->_port_list.size(); ++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])) == -1) { gearmand_perror(errno, "We tried to event_del() an event which no longer existed"); assert_msg(false, "We tried to event_del() an event which no longer existed"); } } } gearmand->is_listen_event= false; } } static void _listen_event(int event_fd, short events __attribute__ ((unused)), void *arg) { gearmand_port_st *port= (gearmand_port_st *)arg; struct sockaddr sa; socklen_t sa_len= sizeof(sa); #if defined(HAVE_ACCEPT4) && HAVE_ACCEPT4 int fd= accept4(event_fd, &sa, &sa_len, SOCK_NONBLOCK); // SOCK_NONBLOCK); #else int fd= accept(event_fd, &sa, &sa_len); #endif if (fd == -1) { int local_error= errno; switch (local_error) { case EINTR: return; case ECONNABORTED: case EMFILE: gearmand_perror(local_error, "accept"); return; default: break; } _clear_events(Gearmand()); Gearmand()->ret= gearmand_perror(local_error, "accept"); return; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "accept() %d", fd); /* Since this is numeric, it should never fail. Even if it did we don't want to really error from it. */ char host[NI_MAXHOST]; char port_str[NI_MAXSERV]; int error= getnameinfo(&sa, sa_len, host, NI_MAXHOST, port_str, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV); if (error != 0) { gearmand_gai_error("getnameinfo", error); strncpy(host, "-", sizeof(host)); strncpy(port_str, "-", sizeof(port_str)); } gearmand_log_info(GEARMAN_DEFAULT_LOG_PARAM, "Accepted connection from %s:%s", host, port_str); gearmand_error_t 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_debug("Creating wakeup pipe"); #if defined(HAVE_PIPE2) && HAVE_PIPE2 if (pipe2(gearmand->wakeup_fd, O_NONBLOCK) == -1) { return gearmand_fatal_perror(errno, "pipe2(gearmand->wakeup_fd)"); } #else if (pipe(gearmand->wakeup_fd) == -1) { return gearmand_fatal_perror(errno, "pipe(gearmand->wakeup_fd)"); } int returned_flags; if ((returned_flags= fcntl(gearmand->wakeup_fd[0], F_GETFL, 0)) == -1) { return gearmand_fatal_perror(errno, "fcntl:F_GETFL"); } if (fcntl(gearmand->wakeup_fd[0], F_SETFL, returned_flags | O_NONBLOCK) == -1) { return gearmand_fatal_perror(errno, "fcntl(F_SETFL)"); } #endif 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_debug("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_debug("Adding event for wakeup pipe"); if (event_add(&(gearmand->wakeup_event), NULL) < 0) { gearmand_perror(errno, "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_debug("Clearing event for wakeup pipe"); if (event_del(&(gearmand->wakeup_event)) < 0) { gearmand_perror(errno, "We tried to event_del() an event which no longer existed"); assert_msg(false, "We tried to event_del() an event which no longer existed"); } gearmand->is_wakeup_event= false; } } static void _wakeup_event(int fd, short, void *arg) { gearmand_st *gearmand= (gearmand_st *)arg; while (1) { uint8_t buffer[GEARMAN_PIPE_BUFFER_SIZE]; ssize_t 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) { int local_error= errno; if (local_error == EINTR) { continue; } if (local_error == EAGAIN) { break; } _clear_events(gearmand); gearmand->ret= gearmand_perror(local_error, "_wakeup_event:read"); return; } for (ssize_t x= 0; x < ret; ++x) { switch ((gearmand_wakeup_t)buffer[x]) { case GEARMAND_WAKEUP_PAUSE: gearmand_debug("Received PAUSE wakeup event"); _clear_events(gearmand); gearmand->ret= GEARMAN_PAUSE; break; case GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL: gearmand_debug("Received SHUTDOWN_GRACEFUL wakeup event"); _listen_close(gearmand); for (gearmand_thread_st* 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_debug("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= _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); } /** @} */ /* * 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) { switch (verbose) { case GEARMAND_VERBOSE_FATAL: return "FATAL"; case GEARMAND_VERBOSE_ALERT: return "ALERT"; case GEARMAND_VERBOSE_CRITICAL: return "CRITICAL"; case GEARMAND_VERBOSE_ERROR: return "ERROR"; case GEARMAND_VERBOSE_WARN: return "WARNING"; case GEARMAND_VERBOSE_NOTICE: return "NOTICE"; case GEARMAND_VERBOSE_INFO: return "INFO"; case GEARMAND_VERBOSE_DEBUG: return "DEBUG"; default: break; } return "UNKNOWN"; } bool gearmand_verbose_check(const char *name, gearmand_verbose_t& level) { bool success= true; if (strcmp("FATAL", name) == 0) { level= GEARMAND_VERBOSE_FATAL; } else if (strcmp("ALERT", name) == 0) { level= GEARMAND_VERBOSE_ALERT; } else if (strcmp("CRITICAL", name) == 0) { level= GEARMAND_VERBOSE_CRITICAL; } else if (strcmp("ERROR", name) == 0) { level= GEARMAND_VERBOSE_ERROR; } else if (strcmp("WARNING", name) == 0) { level= GEARMAND_VERBOSE_WARN; } else if (strcmp("NOTICE", name) == 0) { level= GEARMAND_VERBOSE_NOTICE; } else if (strcmp("INFO", name) == 0) { level= GEARMAND_VERBOSE_INFO; } else if (strcmp("DEBUG", name) == 0) { level= GEARMAND_VERBOSE_DEBUG; } else { success= false; } return success; } static bool gearman_server_create(gearman_server_st& server, const uint32_t job_retries_arg, const char *job_handle_prefix, uint8_t worker_wakeup_arg, bool round_robin_arg, uint32_t hashtable_buckets) { 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.free_job_list= NULL; server.free_client_list= NULL; server.free_worker_list= NULL; server.queue_version= QUEUE_VERSION_NONE; server.queue.object= NULL; server.queue.functions= NULL; server.function_hash= (gearman_server_function_st **) calloc(GEARMAND_DEFAULT_HASH_SIZE, sizeof(gearman_server_function_st *)); if (server.function_hash == NULL) { gearmand_merror("calloc", server.function_hash, GEARMAND_DEFAULT_HASH_SIZE); return false; } server.hashtable_buckets= hashtable_buckets; server.job_hash= (gearman_server_job_st **) calloc(hashtable_buckets, sizeof(gearman_server_job_st *)); if (server.job_hash == NULL) { gearmand_merror("calloc", server.job_hash, hashtable_buckets); return false; } server.unique_hash= (gearman_server_job_st **) calloc(hashtable_buckets, sizeof(gearman_server_job_st *)); if (server.unique_hash == NULL) { gearmand_merror("calloc", server.unique_hash, hashtable_buckets); return false; } int checked_length= -1; if (job_handle_prefix) { checked_length= snprintf(server.job_handle_prefix, GEARMAND_JOB_HANDLE_SIZE, "%s", job_handle_prefix); } else { struct utsname un; if (uname(&un) == -1) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, errno, "uname(&un) failed"); gearman_server_free(server); return false; } 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) { gearmand_log_fatal(GEARMAN_DEFAULT_LOG_PARAM, "Available length %d not enough to store job handle prefix %s", GEARMAND_JOB_HANDLE_SIZE, server.job_handle_prefix); gearman_server_free(server); return false; } server.job_handle_count= 1; return true; } gearmand-1.0.6/libgearman-server/queue.hpp0000664000076400007640000000527612107145705021034 0ustar00brianbrian00000000000000/* 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, std::string); } // namespace queue } // namespace gearmand namespace gearmand { namespace queue { class Context; } } /** * Set persistent queue context that will be passed back to all queue callback * functions. */ 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); void gearman_server_set_queue(gearman_server_st& server, gearmand::queue::Context* context); gearmand-1.0.6/libgearman-server/gearmand.h0000664000076400007640000001313212116617157021121 0ustar00brianbrian00000000000000/* 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 Gearmand Declarations */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __cplusplus #include #endif #include #include #include #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearmand Gearmand Declarations * * This is a server implementation using the gearman_server interface. * * @{ */ GEARMAN_API gearmand_st *Gearmand(void); #define Server (&(Gearmand()->server)) /** * 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, uint32_t threads, int backlog, const uint32_t job_retries, const char *job_handle_prefix, uint8_t worker_wakeup, gearmand_log_fn *function, void *log_context, const gearmand_verbose_t verbose, bool round_robin, bool exceptions_, uint32_t hashtable_buckets); /** * Free resources used by a server instace. * @param gearmand Server instance structure previously initialized with * gearmand_create. */ GEARMAN_API void gearmand_free(gearmand_st *gearmand); GEARMAN_API gearman_server_st *gearmand_server(gearmand_st *gearmand); /** * Add a port to listen on when starting server with optional callback. * @param gearmand Server instance structure previously initialized with * gearmand_create. * @param port Port for the server to listen on. * @param function Optional callback function that is called when a connection has been accepted on the given port. * @return Standard gearman return value. */ GEARMAN_API gearmand_error_t gearmand_port_add(gearmand_st *gearmand, const char *port, gearmand_connection_add_fn *function); /** * Run the server instance. * @param gearmand Server instance structure previously initialized with * gearmand_create. * @return Standard gearman return value. */ GEARMAN_API gearmand_error_t gearmand_run(gearmand_st *gearmand); bool gearmand_exceptions(gearmand_st *gearmand); /** * Interrupt a running gearmand server from another thread. You should only * call this when another thread is currently running gearmand_run() and you * want to wakeup the server with the given event. * @param gearmand Server instance structure previously initialized with * gearmand_create. * @param wakeup Wakeup event to send to running gearmand. */ GEARMAN_API void gearmand_wakeup(gearmand_st *gearmand, gearmand_wakeup_t wakeup); GEARMAN_API 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 #ifdef __cplusplus GEARMAN_API bool gearmand_verbose_check(const char *name, gearmand_verbose_t& level); #endif gearmand-1.0.6/libgearman-server/gearmand_con.cc0000664000076400007640000004765412107145705022131 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Gearmand Connection Definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #include #include #include /* * Private declarations */ /** * @addtogroup gearmand_con_private Private Gearmand Connection Functions * @ingroup gearmand_con * @{ */ static gearmand_error_t _con_add(gearmand_thread_st *thread, gearmand_con_st *dcon) { gearmand_error_t ret= GEARMAN_SUCCESS; dcon->server_con= gearman_server_con_add(&(thread->server_thread), dcon, &ret); assert(dcon->server_con || ret != GEARMAN_SUCCESS); assert(! dcon->server_con || ret == GEARMAN_SUCCESS); if (dcon->server_con == NULL) { gearmand_sockfd_close(dcon->fd); return ret; } if (dcon->add_fn) { ret= (*dcon->add_fn)(dcon->server_con); if (gearmand_failed(ret)) { gearman_server_con_free(dcon->server_con); gearmand_sockfd_close(dcon->fd); return ret; } } GEARMAN_LIST__ADD(thread->dcon, dcon); return GEARMAN_SUCCESS; } void _con_ready(int, short events, void *arg) { gearmand_con_st *dcon= (gearmand_con_st *)(arg); short revents= 0; if (events & EV_READ) { revents|= POLLIN; } if (events & EV_WRITE) { revents|= POLLOUT; } 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_debug(GEARMAN_DEFAULT_LOG_PARAM, "%s:%s Ready %6s %s", dcon->host, dcon->port, revents & POLLIN ? "POLLIN" : "", revents & POLLOUT ? "POLLOUT" : ""); gearmand_thread_run(dcon->thread); } /** @} */ /* * Public definitions */ /** * Generate hash key for job handles and unique IDs. */ uint32_t _server_job_hash(const char *key, size_t key_size) { const char *ptr= key; int32_t value= 0; while (key_size--) { value += (int32_t)*ptr++; value += (value << 10); value ^= (value >> 6); } value += (value << 3); value ^= (value >> 11); value += (value << 15); return (uint32_t)(value == 0 ? 1 : value); } void _server_con_worker_list_append(gearman_server_worker_st *list, gearman_server_worker_st *worker) { worker->con_prev= NULL; worker->con_next= list; while (worker->con_next != NULL) { worker->con_prev= worker->con_next; worker->con_next= worker->con_next->con_next; } if (worker->con_prev) { worker->con_prev->con_next= worker; } } void destroy_gearman_server_job_st(gearman_server_job_st* arg) { gearmand_debug("delete gearman_server_con_st"); delete arg; } gearman_server_job_st *gearman_server_job_get_by_unique(gearman_server_st *server, const char *unique, const size_t unique_length, gearman_server_con_st *worker_con) { uint32_t key= _server_job_hash(unique, unique_length); gearman_server_job_st *server_job; for (server_job= server->unique_hash[key % server->hashtable_buckets]; server_job != NULL; server_job= server_job->unique_next) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "COMPARE unique \"%s\"(%u) == \"%s\"(%u)", bool(server_job->unique[0]) ? server_job->unique : "", uint32_t(strlen(server_job->unique)), unique, uint32_t(unique_length)); if (bool(server_job->unique[0]) and (strcmp(server_job->unique, unique) == 0)) { /* Check to make sure the worker asking for the job still owns the job. */ if (worker_con != NULL and (server_job->worker == NULL or server_job->worker->con != worker_con)) { return NULL; } return server_job; } } return NULL; } gearman_server_job_st *gearman_server_job_get(gearman_server_st *server, const char *job_handle, const size_t job_handle_length, gearman_server_con_st *worker_con) { uint32_t key= _server_job_hash(job_handle, job_handle_length); for (gearman_server_job_st *server_job= server->job_hash[key % server->hashtable_buckets]; server_job != NULL; server_job= server_job->next) { if (server_job->job_handle_key == key and strncmp(server_job->job_handle, job_handle, GEARMAND_JOB_HANDLE_SIZE) == 0) { /* Check to make sure the worker asking for the job still owns the job. */ if (worker_con != NULL and (server_job->worker == NULL or server_job->worker->con != worker_con)) { return NULL; } return server_job; } } return NULL; } gearman_server_job_st * gearman_server_job_peek(gearman_server_con_st *server_con) { 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 (gearman_job_priority_t priority= GEARMAN_JOB_PRIORITY_HIGH; priority != GEARMAN_JOB_PRIORITY_MAX; priority= gearman_job_priority_t(int(priority) +1)) { 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) { 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_job->ignore_job= false; gearman_server_job_free(gearman_server_job_take(server_con)); return gearman_server_job_peek(server_con); } return server_job; } } } } return NULL; } gearman_server_job_st *gearman_server_job_take(gearman_server_con_st *server_con) { for (gearman_server_worker_st *server_worker= server_con->worker_list; server_worker; server_worker= server_worker->con_next) { if (server_worker->function and server_worker->function->job_count) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Jobs available for %.*s: %lu", (int)server_worker->function->function_name_size, server_worker->function->function_name, (unsigned long)(server_worker->function->job_count)); 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; } } gearman_job_priority_t priority; for (priority= GEARMAN_JOB_PRIORITY_HIGH; priority < GEARMAN_JOB_PRIORITY_LOW; priority= gearman_job_priority_t(int(priority) +1)) { if (server_worker->function->job_list[priority]) { break; } } gearman_server_job_st *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 and server_job->when != 0 and 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++; if (server_job->ignore_job) { gearman_server_job_free(server_job); return gearman_server_job_take(server_con); } return server_job; } } } return NULL; } void *_proc(void *data) { gearman_server_st *server= (gearman_server_st *)data; (void)gearmand_initialize_thread_logging("[ proc ]"); while (1) { int pthread_error; if ((pthread_error= pthread_mutex_lock(&(server->proc_lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_lock"); return NULL; } while (server->proc_wakeup == false) { if (server->proc_shutdown) { if ((pthread_error= pthread_mutex_unlock(&(server->proc_lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } return NULL; } (void) pthread_cond_wait(&(server->proc_cond), &(server->proc_lock)); } server->proc_wakeup= false; { if ((pthread_error= pthread_mutex_unlock(&(server->proc_lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } } for (gearman_server_thread_st *thread= server->thread_list; thread != NULL; thread= thread->next) { gearman_server_con_st *con; while ((con= gearman_server_con_proc_next(thread)) != NULL) { bool packet_sent = false; while (1) { gearman_server_packet_st *packet= gearman_server_proc_packet_remove(con); if (packet == NULL) { break; } con->ret= gearman_server_run_command(con, &(packet->packet)); packet_sent = true; gearmand_packet_free(&(packet->packet)); gearman_server_packet_free(packet, con->thread, false); } // if a packet was sent in above block, and connection is dead, // queue up into io thread so it comes back to the PROC queue for // marking proc_removed. this prevents leaking any connection objects if (packet_sent) { if (con->is_dead) { gearman_server_con_io_add(con); } } else if (con->is_dead) { gearman_server_con_free_workers(con); while (con->client_list != NULL) gearman_server_client_free(con->client_list); con->proc_removed= true; gearman_server_con_to_be_freed_add(con); } } } } } gearman_server_job_st * gearman_server_job_create(gearman_server_st *server) { gearman_server_job_st *server_job; if (server->free_job_count > 0) { server_job= server->free_job_list; GEARMAN_LIST__DEL(server->free_job, server_job); } else { server_job= new (std::nothrow) gearman_server_job_st; if (server_job == NULL) { return NULL; } } server_job->ignore_job= false; server_job->job_queued= false; server_job->retries= 0; server_job->priority= GEARMAN_JOB_PRIORITY_NORMAL; server_job->job_handle_key= 0; server_job->unique_key= 0; server_job->client_count= 0; server_job->numerator= 0; server_job->denominator= 0; server_job->data_size= 0; server_job->next= NULL; server_job->prev= NULL; server_job->unique_next= NULL; server_job->unique_prev= NULL; server_job->worker_next= NULL; server_job->worker_prev= NULL; server_job->function= NULL; server_job->function_next= NULL; server_job->data= NULL; server_job->client_list= NULL; server_job->worker= NULL; server_job->job_handle[0]= 0; server_job->unique[0]= 0; server_job->unique_length= 0; return server_job; } gearmand_error_t gearmand_con_create(gearmand_st *gearmand, int fd, const char *host, const char *port, gearmand_connection_add_fn *add_fn) { gearmand_con_st *dcon; if (gearmand->free_dcon_count > 0) { dcon= gearmand->free_dcon_list; GEARMAN_LIST__DEL(gearmand->free_dcon, dcon); } else { dcon= new (std::nothrow) gearmand_con_st; if (dcon == NULL) { gearmand_perror(errno, "new build_gearmand_con_st"); gearmand_sockfd_close(fd); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } memset(&dcon->event, 0, sizeof(struct event)); } dcon->last_events= 0; dcon->fd= fd; dcon->next= NULL; dcon->prev= NULL; dcon->server_con= NULL; dcon->add_fn= NULL; strncpy(dcon->host, host, NI_MAXHOST); dcon->host[NI_MAXHOST -1]= 0; strncpy(dcon->port, port, NI_MAXSERV); dcon->port[NI_MAXSERV -1]= 0; dcon->add_fn= add_fn; /* If we are not threaded, just add the connection now. */ if (gearmand->threads == 0) { dcon->thread= gearmand->thread_list; return _con_add(gearmand->thread_list, dcon); } /* We do a simple round-robin connection queue algorithm here. */ if (gearmand->thread_add_next == NULL) { gearmand->thread_add_next= gearmand->thread_list; } dcon->thread= gearmand->thread_add_next; /* We don't need to lock if the list is empty. */ if (dcon->thread->dcon_add_count == 0 && dcon->thread->free_dcon_count < gearmand->max_thread_free_dcon_count) { GEARMAN_LIST__ADD(dcon->thread->dcon_add, dcon); gearmand_thread_wakeup(dcon->thread, GEARMAND_WAKEUP_CON); } else { uint32_t free_dcon_count; gearmand_con_st *free_dcon_list= NULL; int pthread_error; if ((pthread_error= pthread_mutex_lock(&(dcon->thread->lock))) == 0) { GEARMAN_LIST__ADD(dcon->thread->dcon_add, dcon); /* Take the free connection structures back to reuse. */ free_dcon_list= dcon->thread->free_dcon_list; free_dcon_count= dcon->thread->free_dcon_count; dcon->thread->free_dcon_list= NULL; dcon->thread->free_dcon_count= 0; if ((pthread_error= pthread_mutex_unlock(&(dcon->thread->lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_lock"); gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); } /* Only wakeup the thread if this is the first in the queue. We don't need to lock around the count check, worst case it was already picked up and we send an extra byte. */ if (dcon->thread->dcon_add_count == 1) { gearmand_thread_wakeup(dcon->thread, GEARMAND_WAKEUP_CON); } /* Put the free connection structures we grabbed on the main list. */ while (free_dcon_list != NULL) { dcon= free_dcon_list; GEARMAN_LIST__DEL(free_dcon, dcon); GEARMAN_LIST__ADD(gearmand->free_dcon, dcon); } } gearmand->thread_add_next= gearmand->thread_add_next->next; return GEARMAN_SUCCESS; } void gearmand_con_free(gearmand_con_st *dcon) { if (event_initialized(&(dcon->event))) { if (event_del(&(dcon->event)) == -1) { gearmand_perror(errno, "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) == -1) { gearmand_perror(errno, "event_add"); } else { if (event_del(&(dcon->event)) == -1) { gearmand_perror(errno, "event_del"); } } } } // @note server_con could be null if we failed to complete the initial // connection. if (dcon->server_con) { gearman_server_con_attempt_free(dcon->server_con); } GEARMAN_LIST__DEL(dcon->thread->dcon, dcon); gearmand_sockfd_close(dcon->fd); if (Gearmand()->free_dcon_count < GEARMAN_MAX_FREE_SERVER_CON) { if (Gearmand()->threads == 0) { GEARMAN_LIST__ADD(Gearmand()->free_dcon, dcon); } else { /* Lock here because the main thread may be emptying this. */ int error; if ((error= pthread_mutex_lock(&(dcon->thread->lock))) == 0) { GEARMAN_LIST__ADD(dcon->thread->free_dcon, dcon); if ((error= pthread_mutex_unlock(&(dcon->thread->lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); } } } else { delete dcon; } } void gearmand_con_check_queue(gearmand_thread_st *thread) { /* Dirty check is fine here, wakeup is always sent after add completes. */ if (thread->dcon_add_count == 0) { return; } /* We want to add new connections inside the lock because other threads may walk the thread's dcon_list while holding the lock. */ while (thread->dcon_add_list != NULL) { int error; if ((error= pthread_mutex_lock(&(thread->lock))) == 0) { gearmand_con_st *dcon= thread->dcon_add_list; GEARMAN_LIST__DEL(thread->dcon_add, dcon); if ((error= pthread_mutex_unlock(&(thread->lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); 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 { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); } } } gearmand-1.0.6/libgearman-server/connection.hpp0000664000076400007640000000350512107145705022040 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 gearmand_connection_set_protocol(gearman_server_con_st *connection, gearmand::protocol::Context* arg); gearmand-1.0.6/libgearman-server/queue.h0000664000076400007640000000523212107145705020464 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 #ifdef __cplusplus extern "C" { #endif gearmand_error_t gearman_queue_add(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when); gearmand_error_t gearman_queue_flush(gearman_server_st *server); gearmand_error_t gearman_queue_done(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/plugins.cc0000664000076400007640000000503712107145705021162 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include namespace gearmand { namespace plugins { void initialize(boost::program_options::options_description &all) { queue::initialize_default(); if (HAVE_LIBDRIZZLE) { queue::initialize_drizzle(); } if (HAVE_LIBMEMCACHED) { queue::initialize_libmemcached(); } if (HAVE_LIBSQLITE3) { queue::initialize_sqlite(); } if (HAVE_LIBPQ) { queue::initialize_postgres(); } if (HAVE_HIREDIS) { #ifdef HAVE_LIBHIREDIS queue::initialize_redis(); #endif } if (HAVE_TOKYOCABINET) { queue::initialize_tokyocabinet(); } if (HAVE_LIBMYSQL_BUILD) { queue::initialize_mysql(); } gearmand::queue::load_options(all); } } //namespace plugins } //namespace gearmand gearmand-1.0.6/libgearman-server/client.h0000664000076400007640000000464012107145705020620 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Client Declarations */ #pragma once #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearman_server_client Client Declarations * @ingroup gearman_server * * This is a low level interface for gearman server clients. This is used * internally by the server interface, so you probably want to look there first. * * @{ */ /** * Add a new client to a server instance. */ GEARMAN_API gearman_server_client_st * gearman_server_client_add(gearman_server_con_st *con); /** * Free a server client structure. */ GEARMAN_API void gearman_server_client_free(gearman_server_client_st *client); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/queue.cc0000664000076400007640000001663512107145705020633 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include "libgearman-server/common.h" #include #include #include #include #include gearmand_error_t gearman_queue_add(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when) { assert(server->state.queue_startup == false); if (server->queue_version == QUEUE_VERSION_FUNCTION) { assert(server->queue.functions->_add_fn); return (*(server->queue.functions->_add_fn))(server, (void *)server->queue.functions->_context, unique, unique_size, function_name, function_name_size, data, data_size, priority, when); } assert(server->queue.object); return server->queue.object->add(server, unique, unique_size, function_name, function_name_size, data, data_size, priority, when); } gearmand_error_t gearman_queue_flush(gearman_server_st *server) { if (server->queue_version == QUEUE_VERSION_FUNCTION) { assert(server->queue.functions->_flush_fn); return (*(server->queue.functions->_flush_fn))(server, (void *)server->queue.functions->_context); } assert(server->queue.object); return server->queue.object->flush(server); } gearmand_error_t gearman_queue_done(gearman_server_st *server, const char *unique, size_t unique_size, const char *function_name, size_t function_name_size) { if (server->queue_version == QUEUE_VERSION_FUNCTION) { assert(server->queue.functions->_done_fn); return (*(server->queue.functions->_done_fn))(server, (void *)server->queue.functions->_context, unique, unique_size, function_name, function_name_size); } assert(server->queue.object); return server->queue.object->done(server, unique, unique_size, function_name, function_name_size); } 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) { delete server.queue.functions; server.queue.functions= NULL; delete server.queue.object; server.queue.object= NULL; server.queue_version= QUEUE_VERSION_FUNCTION; server.queue.functions= new queue_st(); if (server.queue.functions) { server.queue.functions->_context= context; server.queue.functions->_add_fn= add; server.queue.functions->_flush_fn= flush; server.queue.functions->_done_fn= done; server.queue.functions->_replay_fn= replay; } assert(server.queue.functions); } void gearman_server_set_queue(gearman_server_st& server, gearmand::queue::Context* context) { delete server.queue.functions; server.queue.functions= NULL; delete server.queue.object; server.queue.object= NULL; assert(context); { server.queue_version= QUEUE_VERSION_CLASS; server.queue.object= context; } } 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 *, std::string name) { bool launched= false; if (name.empty()) { return GEARMAN_SUCCESS; } std::transform(name.begin(), name.end(), name.begin(), ::tolower); for (plugins::Queue::vector::iterator iter= all_queue_modules.begin(); iter != all_queue_modules.end(); ++iter) { if ((*iter)->compare(name) == 0) { if (launched) { return gearmand_gerror("Attempt to initialize multiple queues", GEARMAN_UNKNOWN_OPTION); } gearmand_error_t rc; if (gearmand_failed(rc= (*iter)->initialize())) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, rc, "Failed to initialize %s: %s", name.c_str(), (*iter)->error_string().c_str()); } launched= true; } } if (launched == false) { return gearmand_log_gerror(GEARMAN_DEFAULT_LOG_PARAM, GEARMAN_UNKNOWN_OPTION, "Unknown queue %s", name.c_str()); } return GEARMAN_SUCCESS; } } // namespace queue } // namespace gearmand gearmand-1.0.6/libgearman-server/worker.cc0000664000076400007640000001107712107145705021013 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server worker definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include 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= new (std::nothrow) gearman_server_worker_st; if (worker == NULL) { gearmand_merror("new", gearman_server_worker_st, 1); return NULL; } } worker->job_count= 0; worker->timeout= -1; 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; } /* * Public definitions */ gearman_server_worker_st * gearman_server_worker_add(gearman_server_con_st *con, const char *function_name, size_t function_name_size, long timeout) { gearman_server_function_st *function= gearman_server_function_get(Server, function_name, function_name_size); if (function == NULL) { return NULL; } gearman_server_worker_st* worker= gearman_server_worker_create(con, function); if (worker == NULL) { return NULL; } worker->timeout= timeout; 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= gearman_server_job_queue(worker->job_list); if (ret != GEARMAN_SUCCESS) { gearmand_gerror_warn("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_debug("delete"); delete worker; } } gearmand-1.0.6/libgearman-server/wakeup.cc0000664000076400007640000000432612107145705020775 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #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(); } } gearmand-1.0.6/libgearman-server/function.h0000664000076400007640000000520012107145705021160 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Function Declarations */ #pragma once #include #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearman_server_function Function Declarations * @ingroup gearman_server * * This is a low level interface for gearman server functions. This is used * internally by the server interface, so you probably want to look there first. * * @{ */ /** Add a new function to a server instance. */ GEARMAN_API gearman_server_function_st * gearman_server_function_get(gearman_server_st *server, const char *function_name, size_t function_name_size); /** * Free a server function structure. */ GEARMAN_API void gearman_server_function_free(gearman_server_st *server, gearman_server_function_st *function); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/verbose.h0000664000076400007640000000507412107145705021011 0ustar00brianbrian00000000000000/* 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 /** * Verbosity levels. */ enum gearmand_verbose_t { // Logging this will cause gearmand to shutdown GEARMAND_VERBOSE_FATAL= LOG_EMERG, // syslog:LOG_EMERG // Next two are currently unused GEARMAND_VERBOSE_ALERT= LOG_ALERT, // syslog:LOG_ALERT GEARMAND_VERBOSE_CRITICAL= LOG_CRIT, // syslog:LOG_CRIT GEARMAND_VERBOSE_ERROR= LOG_ERR, // syslog:LOG_ERR GEARMAND_VERBOSE_WARN= LOG_WARNING, // syslog:LOG_WARNING // Notice should only be used for job creation/completion GEARMAND_VERBOSE_NOTICE= LOG_NOTICE, // syslog:LOG_NOTICE // Info is used for state of the system (i.e. startup, shutdown, etc) GEARMAND_VERBOSE_INFO= LOG_INFO, // syslog:LOG_INFO // @todo Fix it so that these will not be compiled in by default GEARMAND_VERBOSE_DEBUG= LOG_DEBUG // syslog:LOG_DEBUG }; #ifndef __cplusplus typedef enum gearmand_verbose_t gearmand_verbose_t; #endif gearmand-1.0.6/libgearman-server/wakeup.h0000664000076400007640000000411012107145705020626 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 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 gearmand-1.0.6/libgearman-server/server.h0000664000076400007640000000655612107145705020660 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server Declarations */ #include #pragma once #ifdef __cplusplus extern "C" { #endif #include 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. * @param server_con Server connection that has a packet to process. * @param packet The packet that needs processing. * @return Standard gearman return value. */ GEARMAN_API 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. * @param server Server structure previously initialized with * gearman_server_create. * @return Standard gearman return value. This will return GEARMAN_SHUTDOWN if * the server is ready to shutdown now. */ GEARMAN_API gearmand_error_t gearman_server_shutdown_graceful(gearman_server_st *server); /** * Replay the persistent queue to load all unfinshed jobs into the server. This * should only be run at startup. * @param server Server structure previously initialized with * gearman_server_create. * @return Standard gearman return value. This will return GEARMAN_SHUTDOWN if * the server is ready to shutdown now. */ #ifdef __cplusplus GEARMAN_API gearmand_error_t gearman_server_queue_replay(gearman_server_st& server); #endif /** * Get persistent queue context. */ GEARMAN_API void *gearman_server_queue_context(const gearman_server_st *server); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/text.cc0000664000076400007640000002524212141170641020460 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012-2013 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 "gear_config.h" #include "libgearman-server/common.h" #include "libgearman-server/log.h" #include "libgearman/vector.hpp" #include #include #include #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" gearmand_error_t server_run_text(gearman_server_con_st *server_con, gearmand_packet_st *packet) { gearman_vector_st data(GEARMAN_TEXT_RESPONSE_SIZE); if (packet->argc) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "text command %.*s", packet->arg_size[0], packet->arg[0]); } if (packet->argc == 0) { data.vec_printf(TEXT_ERROR_UNKNOWN_COMMAND, 4, "NULL"); } else if (strcasecmp("workers", (char *)(packet->arg[0])) == 0) { for (gearman_server_thread_st *thread= Server->thread_list; thread != NULL; thread= thread->next) { int error; if ((error= pthread_mutex_lock(&thread->lock)) == 0) { for (gearman_server_con_st *con= thread->con_list; con != NULL; con= con->next) { if (con->_host == NULL) { continue; } data.vec_append_printf("%d %s %s :", con->con.fd, con->_host, con->id); for (gearman_server_worker_st *worker= con->worker_list; worker != NULL; worker= worker->con_next) { data.vec_append_printf(" %.*s", (int)(worker->function->function_name_size), worker->function->function_name); } data.vec_append_printf("\n"); } if ((error= (pthread_mutex_unlock(&(thread->lock)))) != 0) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); } } data.vec_append_printf(".\n"); } else if (strcasecmp("status", (char *)(packet->arg[0])) == 0) { for (uint32_t function_key= 0; function_key < GEARMAND_DEFAULT_HASH_SIZE; function_key++) { for (gearman_server_function_st *function= Server->function_hash[function_key]; function != NULL; function= function->next) { data.vec_append_printf("%.*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); } } data.vec_append_printf(".\n"); } else if (strcasecmp("create", (char *)(packet->arg[0])) == 0) { if (packet->argc == 3 and strcasecmp("function", (char *)(packet->arg[1])) == 0) { gearman_server_function_st* function= gearman_server_function_get(Server, (char *)(packet->arg[2]), packet->arg_size[2] -2); if (function) { data.vec_printf(TEXT_SUCCESS); } else { data.vec_printf(TEXT_ERROR_CREATE_FUNCTION, (int)packet->arg_size[2], (char *)(packet->arg[2])); } } else { // create data.vec_printf(TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); } } else if (strcasecmp("drop", (char *)(packet->arg[0])) == 0) { if (packet->argc == 3 and strcasecmp("function", (char *)(packet->arg[1])) == 0) { bool success= false; for (uint32_t function_key= 0; function_key < GEARMAND_DEFAULT_HASH_SIZE; function_key++) { for (gearman_server_function_st *function= Server->function_hash[function_key]; function != NULL; function= function->next) { if (strcasecmp(function->function_name, (char *)(packet->arg[2])) == 0) { success= true; if (function->worker_count == 0 && function->job_running == 0) { gearman_server_function_free(Server, function); data.vec_append_printf(TEXT_SUCCESS); } else { data.vec_append_printf("ERR there are still connected workers or executing clients\r\n"); } break; } } } if (success == false) { data.vec_printf("ERR function not found\r\n"); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "%s", data.value()); } } else { // drop data.vec_printf(TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); } } else if (strcasecmp("maxqueue", (char *)(packet->arg[0])) == 0) { if (packet->argc == 1) { data.vec_append_printf(TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); } else { uint32_t max_queue_size[GEARMAN_JOB_PRIORITY_MAX]; for (int priority= 0; priority < GEARMAN_JOB_PRIORITY_MAX; ++priority) { const int argc= priority +2; if (packet->argc > argc) { const int parameter= atoi((char *)(packet->arg[argc])); if (parameter < 0) { max_queue_size[priority]= 0; } else { max_queue_size[priority]= (uint32_t)parameter; } } else { max_queue_size[priority]= GEARMAN_DEFAULT_MAX_QUEUE_SIZE; } } /* To preserve the existing behavior of maxqueue, ensure that the one-parameter invocation is applied to all priorities. */ if (packet->argc <= 3) { for (int priority= 1; priority < GEARMAN_JOB_PRIORITY_MAX; ++priority) { max_queue_size[priority]= max_queue_size[0]; } } for (uint32_t function_key= 0; function_key < GEARMAND_DEFAULT_HASH_SIZE; function_key++) { for (gearman_server_function_st *function= Server->function_hash[function_key]; function != NULL; function= function->next) { if (strlen((char *)(packet->arg[1])) == function->function_name_size && (memcmp(packet->arg[1], function->function_name, function->function_name_size) == 0)) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Applying queue limits to %s", function->function_name); memcpy(function->max_queue_size, max_queue_size, sizeof(uint32_t) * GEARMAN_JOB_PRIORITY_MAX); } } } data.vec_append_printf(TEXT_SUCCESS); } } else if (strcasecmp("getpid", (char *)(packet->arg[0])) == 0) { data.vec_printf("OK %d\n", (int)getpid()); } else if (strcasecmp("shutdown", (char *)(packet->arg[0])) == 0) { if (packet->argc == 1) { Server->shutdown= true; data.vec_printf(TEXT_SUCCESS); } else if (packet->argc == 2 && strcasecmp("graceful", (char *)(packet->arg[1])) == 0) { Server->shutdown_graceful= true; data.vec_printf(TEXT_SUCCESS); } else { // shutdown data.vec_printf(TEXT_ERROR_ARGS, (int)packet->arg_size[0], (char *)(packet->arg[0])); } } else if (strcasecmp("verbose", (char *)(packet->arg[0])) == 0) { data.vec_printf("OK %s\n", gearmand_verbose_name(Gearmand()->verbose)); } else if (strcasecmp("version", (char *)(packet->arg[0])) == 0) { data.vec_printf("OK %s\n", PACKAGE_VERSION); } else { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Failed to find command %.*s(%" PRIu64 ")", packet->arg_size[0], packet->arg[0], packet->arg_size[0]); data.vec_printf(TEXT_ERROR_UNKNOWN_COMMAND, (int)packet->arg_size[0], (char *)(packet->arg[0])); } gearman_server_packet_st *server_packet= gearman_server_packet_create(server_con->thread, false); if (server_packet == NULL) { return gearmand_gerror("calling gearman_server_packet_create()", GEARMAN_MEMORY_ALLOCATION_FAILURE); } server_packet->packet.reset(GEARMAN_MAGIC_TEXT, GEARMAN_COMMAND_TEXT); server_packet->packet.options.complete= true; server_packet->packet.options.free_data= true; if (data.size() == 0) { data.vec_append_printf(TEXT_ERROR_INTERNAL_ERROR); } gearman_string_t taken= data.take(); server_packet->packet.data= gearman_c_str(taken); server_packet->packet.data_size= gearman_size(taken); int error; if ((error= pthread_mutex_lock(&server_con->thread->lock)) == 0) { GEARMAN_FIFO__ADD(server_con->io_packet, server_packet); if ((error= pthread_mutex_unlock(&(server_con->thread->lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); } gearman_server_con_io_add(server_con); return GEARMAN_SUCCESS; } gearmand-1.0.6/libgearman-server/connection.cc0000664000076400007640000004546412116617157021655 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server connection definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #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, gearmand_con_st *dcon, gearmand_error_t *ret) { gearman_server_con_st *con= _server_con_create(thread, dcon, ret); if (con) { if ((*ret= gearman_io_set_fd(&(con->con), dcon->fd)) != GEARMAN_SUCCESS) { gearman_server_con_free(con); return NULL; } *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; } } return con; } 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; if (thread->free_con_count > 0) { con= thread->free_con_list; GEARMAN_LIST__DEL(thread->free_con, con); } else { con= new (std::nothrow) gearman_server_con_st; if (con == NULL) { *ret= gearmand_perror(errno, "new() build_gearman_server_con_st"); return NULL; } } assert(con); if (con == NULL) { 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= Gearmand()->_exceptions; con->is_dead= false; con->is_cleaned_up = false; con->is_noop_sent= false; con->ret= GEARMAN_SUCCESS; con->io_list= false; con->proc_list= false; con->to_be_freed_list= false; con->proc_removed= false; con->io_packet_count= 0; con->proc_packet_count= 0; con->worker_count= 0; con->client_count= 0; con->thread= thread; con->packet= NULL; con->io_packet_list= NULL; con->io_packet_end= NULL; con->proc_packet_list= NULL; con->proc_packet_end= NULL; con->io_next= NULL; con->io_prev= NULL; con->proc_next= NULL; con->proc_prev= NULL; con->to_be_freed_next= NULL; con->to_be_freed_prev= NULL; con->worker_list= NULL; con->client_list= NULL; con->_host= dcon->host; con->_port= dcon->port; strcpy(con->id, "-"); con->timeout_event= NULL; con->protocol= NULL; int error; if ((error= pthread_mutex_lock(&thread->lock)) == 0) { GEARMAN_LIST__ADD(thread->con, con); if ((error= pthread_mutex_unlock(&thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); gearman_server_con_free(con); *ret= GEARMAN_ERRNO; return NULL; } } else { assert(error); gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, error, "pthread_mutex_lock"); gearman_server_con_free(con); *ret= GEARMAN_ERRNO; return NULL; } return con; } void gearman_server_con_attempt_free(gearman_server_con_st *con) { con->_host= NULL; con->_port= NULL; if (Server->flags.threaded) { if (!(con->proc_removed) && !(Server->proc_shutdown)) { gearman_server_con_delete_timeout(con); con->is_dead= true; con->is_sleeping= false; con->is_exceptions= Gearmand()->_exceptions; con->is_noop_sent= false; gearman_server_con_proc_add(con); } } else { gearman_server_con_free(con); } } void gearman_server_con_free(gearman_server_con_st *con) { gearman_server_thread_st *thread= con->thread; gearman_server_packet_st *packet; con->_host= NULL; con->_port= NULL; gearman_server_con_delete_timeout(con); if (con->is_cleaned_up) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "con %llu is already cleaned-up. returning", con); return; } gearmand_io_free(&(con->con)); con->protocol_release(); if (con->packet != NULL) { if (&(con->packet->packet) != con->con.recv_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); 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); } if (con->timeout_event != NULL) { event_del(con->timeout_event); } if (con->proc_list) { gearman_server_con_proc_remove(con); } if (con->io_list) { gearman_server_con_io_remove(con); } int lock_error; if ((lock_error= pthread_mutex_lock(&thread->lock)) == 0) { GEARMAN_LIST__DEL(con->thread->con, con); if ((lock_error= pthread_mutex_unlock(&thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } assert(lock_error == 0); if (thread->free_con_count < GEARMAN_MAX_FREE_SERVER_CON) { GEARMAN_LIST__ADD(thread->free_con, con); con->is_cleaned_up = true; return; } delete con; } gearmand_io_st *gearman_server_con_con(gearman_server_con_st *con) { assert(con); return &con->con; } gearmand_con_st *gearman_server_con_data(gearman_server_con_st *con) { assert(con); return gearman_io_context(&(con->con)); } const char *gearman_server_con_id(gearman_server_con_st *con) { assert(con); return con->id; } void gearman_server_con_set_id(gearman_server_con_st *con, char *id, size_t size) { if (size >= GEARMAN_SERVER_CON_ID_SIZE) { size= GEARMAN_SERVER_CON_ID_SIZE - 1; } memcpy(con->id, id, size); con->id[size]= 0; } void gearman_server_con_free_worker(gearman_server_con_st *con, char *function_name, size_t function_name_size) { gearman_server_worker_st *worker= con->worker_list; gearman_server_worker_st *prev_worker= NULL; while (worker != NULL) { if (worker->function->function_name_size == function_name_size && !memcmp(worker->function->function_name, function_name, function_name_size)) { gearman_server_worker_free(worker); /* Set worker to the last kept worker, or the beginning of the list. */ if (prev_worker == NULL) { worker= con->worker_list; } else { worker= prev_worker; } } else { /* Save this so we don't need to scan the list again if one is removed. */ prev_worker= worker; worker= worker->con_next; } } } void gearman_server_con_free_workers(gearman_server_con_st *con) { while (con->worker_list != NULL) { gearman_server_worker_free(con->worker_list); } } void gearman_server_con_to_be_freed_add(gearman_server_con_st *con) { int lock_error; if ((lock_error= pthread_mutex_lock(&con->thread->lock)) == 0) { if (con->to_be_freed_list) { if ((lock_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } assert(lock_error == 0); return; } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_lock"); } assert(lock_error == 0); GEARMAN_LIST_ADD(con->thread->to_be_freed, con, to_be_freed_); con->to_be_freed_list = true; /* Looks funny, but need to check to_be_freed_count locked, but call run unlocked. */ if (con->thread->to_be_freed_count == 1 && con->thread->run_fn) { if ((lock_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } assert(lock_error == 0); (*con->thread->run_fn)(con->thread, con->thread->run_fn_arg); } else { if ((lock_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } assert(lock_error == 0); } } gearman_server_con_st * gearman_server_con_to_be_freed_next(gearman_server_thread_st *thread) { gearman_server_con_st *con; if (thread->to_be_freed_list == NULL) { return NULL; } int lock_error; if ((lock_error= pthread_mutex_lock(&thread->lock)) == 0) { con= thread->to_be_freed_list; while (con != NULL) { GEARMAN_LIST_DEL(thread->to_be_freed, con, to_be_freed_); if (con->to_be_freed_list) { con->to_be_freed_list= false; break; } con= thread->to_be_freed_list; } if ((lock_error= pthread_mutex_unlock(&thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } return con; } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_lock"); } assert(lock_error == 0); return NULL; } void gearman_server_con_io_add(gearman_server_con_st *con) { if (con->io_list) { return; } int lock_error; if ((lock_error= pthread_mutex_lock(&con->thread->lock)) == 0) { GEARMAN_LIST_ADD(con->thread->io, con, io_); con->io_list= true; /* Looks funny, but need to check io_count locked, but call run unlocked. */ if (con->thread->io_count == 1 && con->thread->run_fn) { if ((lock_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } (*con->thread->run_fn)(con->thread, con->thread->run_fn_arg); } else { if ((lock_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } } } else { gearmand_log_fatal(GEARMAN_DEFAULT_LOG_PARAM, "pthread_mutex_lock(%d), programming error, please report", lock_error); } assert(lock_error == 0); } void gearman_server_con_io_remove(gearman_server_con_st *con) { int lock_error; if ((lock_error= pthread_mutex_lock(&con->thread->lock)) == 0) { if (con->io_list) { GEARMAN_LIST_DEL(con->thread->io, con, io_); con->io_list= false; } if ((lock_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, lock_error, "pthread_mutex_lock"); } assert(lock_error == 0); } gearman_server_con_st * gearman_server_con_io_next(gearman_server_thread_st *thread) { gearman_server_con_st *con= thread->io_list; if (con) { gearman_server_con_io_remove(con); } return con; } void gearman_server_con_proc_add(gearman_server_con_st *con) { if (con->proc_list) { return; } int pthread_error; if ((pthread_error= pthread_mutex_lock(&con->thread->lock)) == 0) { GEARMAN_LIST_ADD(con->thread->proc, con, proc_); con->proc_list= true; if ((pthread_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } if (! (Server->proc_shutdown) && !(Server->proc_wakeup)) { if ((pthread_error= pthread_mutex_lock(&(Server->proc_lock))) == 0) { Server->proc_wakeup= true; if ((pthread_error= pthread_cond_signal(&(Server->proc_cond))) == 0) { if ((pthread_error= pthread_mutex_unlock(&(Server->proc_lock)))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_cond_signal"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_lock"); } } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_lock"); } } void gearman_server_con_proc_remove(gearman_server_con_st *con) { int pthread_error; if ((pthread_error= pthread_mutex_lock(&con->thread->lock)) == 0) { if (con->proc_list) { GEARMAN_LIST_DEL(con->thread->proc, con, proc_); con->proc_list= false; } if ((pthread_error= pthread_mutex_unlock(&con->thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_lock"); } } gearman_server_con_st * gearman_server_con_proc_next(gearman_server_thread_st *thread) { if (thread->proc_list == NULL) { return NULL; } gearman_server_con_st *con= NULL; int pthread_error; if ((pthread_error= pthread_mutex_lock(&thread->lock)) == 0) { con= thread->proc_list; while (con != NULL) { GEARMAN_LIST_DEL(thread->proc, con, proc_); con->proc_list= false; if (!(con->proc_removed)) { break; } con= thread->proc_list; } if ((pthread_error= pthread_mutex_unlock(&thread->lock))) { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_unlock"); } } else { gearmand_log_fatal_perror(GEARMAN_DEFAULT_LOG_PARAM, pthread_error, "pthread_mutex_lock"); } return con; } static void _server_job_timeout(int fd, short event, void *arg) { (void)fd; (void)event; gearman_server_job_st *job= (gearman_server_job_st *)arg; /* A timeout has ocurred on a job, re-queue it */ gearmand_log_warning(GEARMAN_DEFAULT_LOG_PARAM, "Worker timeout reached on job, requeueing: %s %s", job->job_handle, job->unique); gearmand_error_t ret= gearman_server_job_queue(job); if (ret != GEARMAN_SUCCESS) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Failed trying to requeue job after timeout, job lost: %s %s", job->job_handle, job->unique); gearman_server_job_free(job); } } gearmand_error_t gearman_server_con_add_job_timeout(gearman_server_con_st *con, gearman_server_job_st *job) { if (job) { gearman_server_worker_st *worker; for (worker= con->worker_list; worker != NULL; worker= worker->con_next) { /* Assumes the functions are always fetched from the same server structure */ if (worker->function == job->function) { break; } } /* It makes no sense to add a timeout to a connection that has no workers for a job */ assert(worker); if (worker) { // We treat 0 and -1 as being the same (i.e. no timer) if (worker->timeout > 0) { if (worker->timeout < 1000) { worker->timeout= 1000; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Adding timeout on %s for %s (%dl)", job->function->function_name, job->job_handle, worker->timeout); if (con->timeout_event == NULL) { gearmand_con_st *dcon= con->con.context; con->timeout_event= (struct event *)malloc(sizeof(struct event)); if (con->timeout_event == NULL) { return gearmand_gerror("creating timeout event", GEARMAN_MEMORY_ALLOCATION_FAILURE); } timeout_set(con->timeout_event, _server_job_timeout, job); event_base_set(dcon->thread->base, con->timeout_event); } /* XXX Right now, if a worker has diff timeouts for functions I think this will overwrite any existing timeouts on that event. One solution to that would be to record the timeout from last time, and only set this one if it is longer than that one. */ struct timeval timeout_tv = { 0 , 0 }; timeout_tv.tv_sec= worker->timeout; timeout_add(con->timeout_event, &timeout_tv); } else if (con->timeout_event) // Delete the timer if it exists { gearman_server_con_delete_timeout(con); } } } return GEARMAN_SUCCESS; } void gearman_server_con_delete_timeout(gearman_server_con_st *con) { if (con->timeout_event) { timeout_del(con->timeout_event); con->timeout_event= NULL; } } gearman_server_con_st *gearmand_ready(gearmand_connection_list_st *universal) { if (universal->ready_con_list) { gearmand_io_st *con= universal->ready_con_list; con->options.ready= false; GEARMAN_LIST_DEL(universal->ready_con, con, ready_); return con->root; } return NULL; } gearmand-1.0.6/libgearman-server/byteorder.h0000664000076400007640000000436412107145705021344 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/plugins.h0000664000076400007640000000371412107145705021024 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman-server/text.h0000664000076400007640000000357212107145705020331 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 gearmand_error_t server_run_text(gearman_server_con_st *server_con, gearmand_packet_st *packet); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman-server/function.cc0000664000076400007640000001165312111602475021324 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server function definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #include /* * Public definitions */ static uint32_t _server_function_hash(const char *name, size_t size) { const char *ptr= name; int32_t value= 0; while (size--) { value += (int32_t)*ptr++; value += (value << 10); value ^= (value >> 6); } value += (value << 3); value ^= (value >> 11); value += (value << 15); return (uint32_t)(value == 0 ? 1 : value); } #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static gearman_server_function_st* gearman_server_function_create(gearman_server_st *server, const char *function_name, size_t function_name_size, uint32_t function_key) { gearman_server_function_st* function= new (std::nothrow) gearman_server_function_st; if (function == NULL) { gearmand_merror("new gearman_server_function_st", gearman_server_function_st, 0); return NULL; } function->worker_count= 0; function->job_count= 0; function->job_total= 0; function->job_running= 0; memset(function->max_queue_size, GEARMAN_DEFAULT_MAX_QUEUE_SIZE, sizeof(uint32_t) * GEARMAN_JOB_PRIORITY_MAX); function->function_name= new char[function_name_size +1]; if (function->function_name == NULL) { gearmand_merror("new[]", char, function_name_size +1); delete 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; 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); GEARMAN_HASH__ADD(server->function, function_key, function); return function; } 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; uint32_t function_hash = _server_function_hash(function_name, function_name_size) % GEARMAND_DEFAULT_HASH_SIZE; for (function= server->function_hash[function_hash]; function != NULL; function= function->next) { if (function->function_name_size == function_name_size and memcmp(function->function_name, function_name, function_name_size) == 0) { return function; } } return gearman_server_function_create(server, function_name, function_name_size, function_hash); } void gearman_server_function_free(gearman_server_st *server, gearman_server_function_st *function) { uint32_t function_key; function_key= _server_function_hash(function->function_name, function->function_name_size); function_key= function_key % GEARMAND_DEFAULT_HASH_SIZE; GEARMAN_HASH__DEL(server->function, function_key, function); delete [] function->function_name; delete function; } gearmand-1.0.6/libgearman-server/job.cc0000664000076400007640000003340212107145705020250 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Server job definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include #include /* * Private declarations */ /** * @addtogroup gearman_server_job_private Private Server Job Functions * @ingroup gearman_server_job * @{ */ /** * Get a server job structure from the unique ID. If data_size is non-zero, * then unique points to the workload data and not a real unique key. */ static gearman_server_job_st * _server_job_get_unique(gearman_server_st *server, uint32_t unique_key, gearman_server_function_st *server_function, const char *unique, size_t data_size) { gearman_server_job_st *server_job; for (server_job= server->unique_hash[unique_key % server->hashtable_buckets]; server_job != NULL; server_job= server_job->unique_next) { if (data_size == 0) { if (server_job->function == server_function && server_job->unique_key == unique_key && !strcmp(server_job->unique, unique)) { return server_job; } } else { if (server_job->function == server_function && server_job->unique_key == unique_key && server_job->data_size == data_size && memcmp(server_job->data, unique, data_size) == 0) { return server_job; } } } return NULL; } /** @} */ #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, gearman_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_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, gearman_job_priority_t priority, gearman_server_client_st *server_client, gearmand_error_t *ret_ptr, int64_t when) { 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; key= 0; } else { if (unique_size == 1 && *unique == '-') { if (data_size == 0) { key= 0; server_job= NULL; } else { /* Look up job via unique data when unique = '-'. */ key= _server_job_hash((const char*)data, data_size); server_job= _server_job_get_unique(server, key, server_function, (const char*)data, data_size); } } else { /* Look up job via unique ID first to make sure it's not a duplicate. */ key= _server_job_hash(unique, unique_size); server_job= _server_job_get_unique(server, key, server_function, unique, 0); } } if (server_job == NULL) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Comparing queue %u to limit %u for priority %u", server_function->job_total, server_function->max_queue_size[priority], priority); if (server_function->max_queue_size[priority] > 0 && server_function->job_total >= server_function->max_queue_size[priority]) { *ret_ptr= GEARMAN_JOB_QUEUE_FULL; return NULL; } server_job= gearman_server_job_create(server); if (server_job == NULL) { *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; return NULL; } server_job->priority= priority; server_job->function= server_function; server_function->job_total++; 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); } server_job->unique_length= unique_size; checked_length= snprintf(server_job->unique, GEARMAN_MAX_UNIQUE_SIZE, "%.*s", (int)unique_size, unique); if (checked_length >= GEARMAN_MAX_UNIQUE_SIZE || checked_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "We received a unique beyond GEARMAN_MAX_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 % server->hashtable_buckets; 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 % server->hashtable_buckets; GEARMAN_HASH__ADD(server->job, key, server_job); if (server->state.queue_startup) { server_job->job_queued= true; } else if (server_client == NULL) { *ret_ptr= gearman_queue_add(server, 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; } { *ret_ptr= gearman_queue_flush(server); if (*ret_ptr != GEARMAN_SUCCESS) { server_job->data= NULL; gearman_server_job_free(server_job); return NULL; } } server_job->job_queued= true; } *ret_ptr= gearman_server_job_queue(server_job); if (gearmand_failed(*ret_ptr)) { if (server_client == NULL) { /* Do our best to remove the job from the queue. */ (void)gearman_queue_done(server, server_job->unique, unique_size, server_job->function->function_name, server_job->function->function_name_size); } gearman_server_job_free(server_job); return NULL; } } else { *ret_ptr= GEARMAN_JOB_EXISTS; } if (server_client) { server_client->job= server_job; GEARMAN_LIST_ADD(server_job->client, server_client, job_); } return server_job; } void gearman_server_job_free(gearman_server_job_st *server_job) { if (server_job == NULL) { return; } if (server_job->worker != NULL) { server_job->function->job_running--; } server_job->function->job_total--; if (server_job->data != NULL) { free((void *)(server_job->data)); server_job->data= NULL; } while (server_job->client_list != NULL) { gearman_server_client_free(server_job->client_list); } if (server_job->worker != NULL) { GEARMAN_LIST_DEL(server_job->worker->job, server_job, worker_); } uint32_t key= server_job->unique_key % Server->hashtable_buckets; GEARMAN_HASH_DEL(Server->unique, key, server_job, unique_); key= server_job->job_handle_key % Server->hashtable_buckets; GEARMAN_HASH__DEL(Server->job, key, server_job); if (Server->free_job_count < GEARMAN_MAX_FREE_SERVER_JOB) { gearman_server_st *server= Server; GEARMAN_LIST__ADD(server->free_job, server_job); } else { destroy_gearman_server_job_st(server_job); } } gearmand_error_t gearman_server_job_queue(gearman_server_job_st *job) { if (job->worker) { job->retries++; if (Server->job_retries != 0 && Server->job_retries == job->retries) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "Dropped job due to max retry count: %s %.*s", job->job_handle, (int)job->unique_length, job->unique); gearman_server_client_st *client; for (client= job->client_list; client != NULL; client= client->job_next) { gearmand_error_t 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) { gearmand_error_t ret= gearman_queue_done(Server, job->unique, job->unique_length, job->function->function_name, job->function->function_name_size); if (ret != GEARMAN_SUCCESS) { return ret; } } gearman_server_job_free(job); return GEARMAN_SUCCESS; } GEARMAN_LIST_DEL(job->worker->job, job, worker_); job->worker= NULL; job->function->job_running--; job->function_next= NULL; job->numerator= 0; job->denominator= 0; } /* Queue NOOP for possible sleeping workers. */ if (job->function->worker_list != NULL) { gearman_server_worker_st *worker= job->function->worker_list; uint32_t noop_sent= 0; do { if (worker->con->is_sleeping && ! (worker->con->is_noop_sent)) { gearmand_error_t ret= gearman_server_io_packet_add(worker->con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_NOOP, NULL); if (gearmand_failed(ret)) { gearmand_gerror("gearman_server_io_packet_add", ret); return ret; } worker->con->is_noop_sent= true; noop_sent++; } worker= worker->function_next; } while (worker != job->function->worker_list && (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++; return GEARMAN_SUCCESS; } gearmand-1.0.6/libgearman-server/server.cc0000664000076400007640000012345012133220412020773 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 Server Definitions */ #include "gear_config.h" #include "libgearman-server/common.h" #include "libgearman-server/queue.h" #include "libgearman-server/plugins/base.h" #include #include #include #include #include /* * Private declarations */ /** * @addtogroup gearman_server_private Private Server Functions * @ingroup gearman_server * @{ */ /** * Queue an error packet. */ static gearmand_error_t _server_error_packet(gearman_server_con_st *server_con, const char *error_code, const char *error_string); /** * Send work result packets with data back to clients. */ static gearmand_error_t _server_queue_work_data(gearman_server_job_st *server_job, gearmand_packet_st *packet, gearman_command_t command); /** @} */ /* * Public definitions */ gearmand_error_t gearman_server_run_command(gearman_server_con_st *server_con, gearmand_packet_st *packet) { gearmand_error_t ret; gearman_server_client_st *server_client= NULL; if (packet->magic == GEARMAN_MAGIC_RESPONSE) { return _server_error_packet(server_con, "bad_magic", "Request magic expected"); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "%15s:%5s packet command %s", server_con->con.context == NULL || server_con->con.context->host == NULL ? "-" : server_con->con.context->host, server_con->con.context == NULL || server_con->con.context->port == NULL ? "-" : server_con->con.context->port, gearmand_strcommand(packet)); switch (packet->command) { /* Client/worker requests. */ case GEARMAN_COMMAND_ECHO_REQ: /* Reuse the data buffer and just shove the data back. */ ret= gearman_server_io_packet_add(server_con, true, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_ECHO_RES, packet->data, packet->data_size, NULL); 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"); } gearman_job_priority_t map_priority= GEARMAN_JOB_PRIORITY_NORMAL; /* Schedule job. */ gearman_server_job_st *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 _server_error_packet(server_con, "queue_insert_error", gearmand_strerror(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; } gearmand_log_notice(GEARMAN_DEFAULT_LOG_PARAM,"accepted,%.*s,%.*s,%.*s", packet->arg_size[0] -1, packet->arg[0], // Function packet->arg_size[1] -1, packet->arg[1], // unique packet->arg_size[2] -1, packet->arg[2]); // reducer } break; /* Client requests. */ case GEARMAN_COMMAND_SUBMIT_JOB: case GEARMAN_COMMAND_SUBMIT_JOB_BG: case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: 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: { gearman_job_priority_t priority; if (packet->command == GEARMAN_COMMAND_SUBMIT_JOB || packet->command == GEARMAN_COMMAND_SUBMIT_JOB_BG || packet->command == GEARMAN_COMMAND_SUBMIT_JOB_EPOCH) { priority= GEARMAN_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; } else { priority= GEARMAN_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_EPOCH) { server_client= NULL; } else { server_client= gearman_server_client_add(server_con); if (server_client == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Received submission, function:%.*s unique:%.*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) { char *endptr; // @note stroll will set errno if error, but it might also leave errno // alone if none happens (so a previous call that sets it might cause // an error. errno= 0; when= strtoll((char *)packet->arg[2], &endptr, 10); if (errno) { return gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "strtoul(%ul)", when); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Received EPOCH job submission, function:%.*s unique:%.*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. */ gearman_server_job_st *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 _server_error_packet(server_con, "queue_insert_error", gearmand_strerror(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; } gearmand_log_notice(GEARMAN_DEFAULT_LOG_PARAM,"accepted,%.*s,%.*s,%jd", packet->arg_size[0], packet->arg[0], // Function packet->arg_size[1], packet->arg[1], // Unique when); } break; case GEARMAN_COMMAND_GET_STATUS_UNIQUE: { char unique_handle[GEARMAN_MAX_UNIQUE_SIZE]; /* This may not be NULL terminated, so copy to make sure it is. */ int unique_handle_length= snprintf(unique_handle, GEARMAN_MAX_UNIQUE_SIZE, "%.*s", (int)(packet->arg_size[0]), (char *)(packet->arg[0])); if (unique_handle_length >= GEARMAN_MAX_UNIQUE_SIZE || unique_handle_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", unique_handle_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } gearman_server_job_st *server_job= gearman_server_job_get_by_unique(Server, unique_handle, (size_t)unique_handle_length, NULL); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Searching for unique job: \"%s\" found: %s clients:%d", unique_handle, server_job ? "yes" : "no", server_job ? server_job->client_count : 0); /* Queue status result packet. */ if (server_job == NULL) { ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_STATUS_RES_UNIQUE, unique_handle, (size_t)(unique_handle_length +1), // Job Handle "0", (size_t)2, // "0", (size_t)2, // "0", (size_t)2, // "0", (size_t)2, // "0", (size_t)1, // client_count NULL); } else { char numerator_buffer[11]; /* Max string size to hold a uint32_t. */ int numerator_buffer_length= snprintf(numerator_buffer, sizeof(numerator_buffer), "%u", server_job->numerator); if ((size_t)numerator_buffer_length >= sizeof(numerator_buffer) || numerator_buffer_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", numerator_buffer_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } char denominator_buffer[11]; /* Max string size to hold a uint32_t. */ int denominator_buffer_length= snprintf(denominator_buffer, sizeof(denominator_buffer), "%u", server_job->denominator); if ((size_t)denominator_buffer_length >= sizeof(denominator_buffer) || denominator_buffer_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", denominator_buffer_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } char client_count_buffer[11]; /* Max string size to hold a uint32_t. */ int client_count_buffer_length= snprintf(client_count_buffer, sizeof(client_count_buffer), "%u", server_job->client_count); if ((size_t)client_count_buffer_length >= sizeof(client_count_buffer) || client_count_buffer_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", client_count_buffer_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_STATUS_RES_UNIQUE, unique_handle, (size_t)(unique_handle_length +1), // unique_handle "1", (size_t)2, // is_known server_job->worker == NULL ? "0" : "1", (size_t)2, // is_running numerator_buffer, (size_t)(numerator_buffer_length +1), // numerator denominator_buffer, (size_t)(denominator_buffer_length +1), //denominator client_count_buffer, (size_t)(client_count_buffer_length), //client_count NULL); } if (ret != GEARMAN_SUCCESS) { gearmand_gerror("gearman_server_io_packet_add", ret); return ret; } } break; case GEARMAN_COMMAND_GET_STATUS: { char job_handle[GEARMAND_JOB_HANDLE_SIZE]; /* This may not be NULL terminated, so copy to make sure it is. */ int job_handle_length= snprintf(job_handle, GEARMAND_JOB_HANDLE_SIZE, "%.*s", (int)(packet->arg_size[0]), (char *)(packet->arg[0])); if (job_handle_length >= GEARMAND_JOB_HANDLE_SIZE || job_handle_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", job_handle_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } gearman_server_job_st *server_job= gearman_server_job_get(Server, job_handle, (size_t)job_handle_length, NULL); /* Queue status result packet. */ if (server_job == NULL) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,"status,%.*s,unknown,unknown,unknown,unknown", int(job_handle_length), job_handle); ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_STATUS_RES, job_handle, (size_t)(job_handle_length +1), // Job Handle "0", (size_t)2, // "0", (size_t)2, // "0", (size_t)2, // "0", (size_t)1, // NULL); } else { char numerator_buffer[11]; /* Max string size to hold a uint32_t. */ int numerator_buffer_length= snprintf(numerator_buffer, sizeof(numerator_buffer), "%u", server_job->numerator); if ((size_t)numerator_buffer_length >= sizeof(numerator_buffer) || numerator_buffer_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", numerator_buffer_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } char denominator_buffer[11]; /* Max string size to hold a uint32_t. */ int denominator_buffer_length= snprintf(denominator_buffer, sizeof(denominator_buffer), "%u", server_job->denominator); if ((size_t)denominator_buffer_length >= sizeof(denominator_buffer) || denominator_buffer_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", denominator_buffer_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,"status,%.*s,known,%s,%.*s,%.*s", int(job_handle_length), job_handle, server_job->worker == NULL ? "quiet" : "running", int(numerator_buffer_length), numerator_buffer, int(denominator_buffer_length), denominator_buffer); ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_STATUS_RES, job_handle, (size_t)(job_handle_length +1), "1", (size_t)2, server_job->worker == NULL ? "0" : "1", (size_t)2, numerator_buffer, (size_t)(numerator_buffer_length +1), denominator_buffer, (size_t)(denominator_buffer_length), NULL); } if (ret != GEARMAN_SUCCESS) { gearmand_gerror("gearman_server_io_packet_add", ret); return ret; } } break; case GEARMAN_COMMAND_OPTION_REQ: { char option[GEARMAN_OPTION_SIZE]; /* This may not be NULL terminated, so copy to make sure it is. */ int option_length= snprintf(option, sizeof(option), "%.*s", (int)(packet->arg_size[0]), (char *)(packet->arg[0])); if (option_length >= GEARMAN_OPTION_SIZE || option_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", option_length); return _server_error_packet(server_con, "unknown_option", "Server does not recognize given option"); } if (strcasecmp(option, "exceptions") == 0) { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "'exceptions'"); server_con->is_exceptions= true; } else { return _server_error_packet(server_con, "unknown_option", "Server does not recognize given option"); } ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_OPTION_RES, packet->arg[0], packet->arg_size[0], NULL); if (ret != GEARMAN_SUCCESS) { gearmand_gerror("gearman_server_io_packet_add", ret); return ret; } } break; /* Worker requests. */ case GEARMAN_COMMAND_CAN_DO: gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Registering function: %.*s", packet->arg_size[0], packet->arg[0]); if (gearman_server_worker_add(server_con, (char *)(packet->arg[0]), packet->arg_size[0], 0) == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } break; case GEARMAN_COMMAND_CAN_DO_TIMEOUT: { char *endptr; long timeout= strtol((char *)packet->arg[1], &endptr, 10); if (timeout == LONG_MIN or timeout == LONG_MAX) { return gearmand_log_perror(GEARMAN_DEFAULT_LOG_PARAM, errno, "GEARMAN_COMMAND_CAN_DO_TIMEOUT:strtol"); } gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Registering function: %.*s with timeout %dl", packet->arg_size[0], packet->arg[0], timeout); if (gearman_server_worker_add(server_con, (char *)(packet->arg[0]), packet->arg_size[0] - 1, timeout) == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } } break; case GEARMAN_COMMAND_CANT_DO: gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Removing function: %.*s", packet->arg_size[0], packet->arg[0]); gearman_server_con_free_worker(server_con, (char *)(packet->arg[0]), packet->arg_size[0]); break; case GEARMAN_COMMAND_RESET_ABILITIES: gearman_server_con_free_workers(server_con); break; case GEARMAN_COMMAND_PRE_SLEEP: { gearman_server_job_st *server_job= gearman_server_job_peek(server_con); if (server_job == NULL) { server_con->is_sleeping= true; /* Remove any timeouts while sleeping */ gearman_server_con_delete_timeout(server_con); } else { /* If there are jobs that could be run, queue a NOOP packet to wake the worker up. This could be the result of a race codition. */ ret= gearman_server_io_packet_add(server_con, false, 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; gearman_server_job_st *server_job= gearman_server_job_take(server_con); if (server_job == NULL) { /* No jobs found, queue no job packet. */ ret= gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_NO_JOB, NULL); } 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. */ 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)(server_job->unique_length + 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), server_job->unique_length, server_job->unique, server_job->unique_length, (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_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, server_job->unique_length +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, server_job->unique_length +1, server_job->data, server_job->data_size, NULL); } else { gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Sending GEARMAN_COMMAND_JOB_ASSIGN Function: %.*s(%lu) with data sized (%lu)" , server_job->function->function_name_size, server_job->function->function_name, server_job->function->function_name_size, (unsigned long)server_job->data_size); /* 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); } if (gearmand_failed(ret)) { gearmand_gerror("gearman_server_io_packet_add", ret); if (server_job) { return gearman_server_job_queue(server_job); } return ret; } /* Since job is assigned, we should respect function timeout */ if (server_job != NULL) { gearman_server_con_add_job_timeout(server_con, server_job); } } break; case GEARMAN_COMMAND_WORK_DATA: case GEARMAN_COMMAND_WORK_WARNING: { gearman_server_job_st *server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), (size_t)strlen(packet->arg[0]), server_con); if (server_job == NULL) { return _server_error_packet(server_con, "job_not_found", "Job given in work result not found"); } /* Queue the data/warning packet for all clients. */ ret= _server_queue_work_data(server_job, packet, packet->command); if (gearmand_failed(ret)) { gearmand_gerror("_server_queue_work_data", ret); return ret; } } break; case GEARMAN_COMMAND_WORK_STATUS: { gearman_server_job_st *server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), (size_t)strlen(packet->arg[0]), server_con); if (server_job == NULL) { return _server_error_packet(server_con, "job_not_found", "Job given in work result not found"); } /* Update job status. */ server_job->numerator= (uint32_t)atoi((char *)(packet->arg[1])); /* This may not be NULL terminated, so copy to make sure it is. */ char denominator_buffer[11]; /* Max string size to hold a uint32_t. */ int denominator_buffer_length= snprintf(denominator_buffer, sizeof(denominator_buffer), "%.*s", (int)(packet->arg_size[2]), (char *)(packet->arg[2])); if ((size_t)denominator_buffer_length > sizeof(denominator_buffer) || denominator_buffer_length < 0) { gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", denominator_buffer_length); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } server_job->denominator= (uint32_t)atoi(denominator_buffer); /* Queue the status packet for all clients. */ for (server_client= server_job->client_list; server_client; server_client= server_client->job_next) { ret= gearman_server_io_packet_add(server_client->con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_WORK_STATUS, packet->arg[0], packet->arg_size[0], packet->arg[1], packet->arg_size[1], packet->arg[2], packet->arg_size[2], NULL); if (gearmand_failed(ret)) { gearmand_gerror("gearman_server_io_packet_add", ret); return ret; } } } break; case GEARMAN_COMMAND_WORK_COMPLETE: { gearman_server_job_st *server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), (size_t)strlen(packet->arg[0]), server_con); if (server_job == NULL) { return _server_error_packet(server_con, "job_not_found", "Job given in work result not found"); } /* Queue the complete packet for all clients. */ ret= _server_queue_work_data(server_job, packet, GEARMAN_COMMAND_WORK_COMPLETE); 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) { ret= gearman_queue_done(Server, server_job->unique, server_job->unique_length, 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_WORK_EXCEPTION: { gearman_server_job_st *server_job= gearman_server_job_get(Server, (char *)(packet->arg[0]), (size_t)strlen(packet->arg[0]), server_con); gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, "Exception being sent from: %.*s(%lu)", server_job->function->function_name_size, server_job->function->function_name, server_job->function->function_name_size); if (server_job == NULL) { return _server_error_packet(server_con, "job_not_found", "Job given in work result not found"); } /* Queue the exception packet for all clients. */ ret= _server_queue_work_data(server_job, packet, GEARMAN_COMMAND_WORK_EXCEPTION); if (gearmand_failed(ret)) { gearmand_gerror("_server_queue_work_data", ret); return ret; } } break; case GEARMAN_COMMAND_WORK_FAIL: { char job_handle[GEARMAND_JOB_HANDLE_SIZE]; /* This may not be NULL terminated, so copy to make sure it is. */ int job_handle_length= snprintf(job_handle, GEARMAND_JOB_HANDLE_SIZE, "%.*s", (int)(packet->arg_size[0]), (char *)(packet->arg[0])); if (job_handle_length >= GEARMAND_JOB_HANDLE_SIZE || job_handle_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"); } gearman_server_job_st *server_job= gearman_server_job_get(Server, job_handle, (size_t)job_handle_length, server_con); if (server_job == NULL) { return _server_error_packet(server_con, "job_not_found", "Job given in work result not found"); } /* Queue the fail packet for all clients. */ for (server_client= server_job->client_list; server_client; server_client= server_client->job_next) { ret= gearman_server_io_packet_add(server_client->con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_WORK_FAIL, packet->arg[0], packet->arg_size[0], NULL); 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) { ret= gearman_queue_done(Server, server_job->unique, server_job->unique_length, 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: gearman_server_con_set_id(server_con, (char *)(packet->arg[0]), packet->arg_size[0]); break; case GEARMAN_COMMAND_TEXT: return server_run_text(server_con, packet); case GEARMAN_COMMAND_UNUSED: case GEARMAN_COMMAND_NOOP: case GEARMAN_COMMAND_JOB_CREATED: case GEARMAN_COMMAND_NO_JOB: case GEARMAN_COMMAND_JOB_ASSIGN: case GEARMAN_COMMAND_ECHO_RES: case GEARMAN_COMMAND_ERROR: case GEARMAN_COMMAND_STATUS_RES: case GEARMAN_COMMAND_ALL_YOURS: case GEARMAN_COMMAND_OPTION_RES: case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: case GEARMAN_COMMAND_JOB_ASSIGN_ALL: case GEARMAN_COMMAND_MAX: case GEARMAN_COMMAND_STATUS_RES_UNIQUE: default: return _server_error_packet(server_con, "bad_command", "Command not expected"); } return GEARMAN_SUCCESS; } gearmand_error_t gearman_server_shutdown_graceful(gearman_server_st *server) { server->shutdown_graceful= true; if (server->job_count == 0) { return GEARMAN_SHUTDOWN; } return GEARMAN_SHUTDOWN_GRACEFUL; } static gearmand_error_t gearman_queue_replay(gearman_server_st& server) { assert(server.state.queue_startup == true); if (server.queue_version == QUEUE_VERSION_FUNCTION) { assert(server.queue.functions->_replay_fn); return (*(server.queue.functions->_replay_fn))(&server, (void *)server.queue.functions->_context, gearmand::queue::Context::replay_add, &server); } assert(server.queue.object); return server.queue.object->replay(&server); } gearmand_error_t gearman_server_queue_replay(gearman_server_st& server) { server.state.queue_startup= true; gearmand_error_t ret= gearman_queue_replay(server); assert(ret != GEARMAN_UNKNOWN_STATE); server.state.queue_startup= false; return ret; } void *gearman_server_queue_context(const gearman_server_st *server) { if (server->queue_version == QUEUE_VERSION_FUNCTION) { return (void *)server->queue.functions->_context; } return NULL; } namespace gearmand { namespace queue { gearmand_error_t Context::replay_add(gearman_server_st *server, void *context __attribute__ ((unused)), const char *unique, size_t unique_size, const char *function_name, size_t function_name_size, const void *data, size_t data_size, gearman_job_priority_t priority, int64_t when) { assert(server->state.queue_startup == true); gearmand_error_t ret= GEARMAN_UNKNOWN_STATE; (void)gearman_server_job_add(server, function_name, function_name_size, unique, unique_size, data, data_size, priority, NULL, &ret, when); if (gearmand_failed(ret)) { gearmand_gerror("gearman_server_job_add", ret); } return ret; } } // namespace queue } // namespace gearmand /* * Private definitions */ static gearmand_error_t _server_error_packet(gearman_server_con_st *server_con, const char *error_code, const char *error_string) { return gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE, GEARMAN_COMMAND_ERROR, error_code, (size_t)(strlen(error_code) + 1), error_string, (size_t)strlen(error_string), NULL); } static gearmand_error_t _server_queue_work_data(gearman_server_job_st *server_job, gearmand_packet_st *packet, gearman_command_t command) { gearman_server_client_st *server_client; 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"); } uint8_t *data; if (packet->data_size > 0) { if (packet->options.free_data and server_client->job_next == NULL) { data= (uint8_t *)(packet->data); packet->options.free_data= false; } else { data= (uint8_t *)malloc(packet->data_size); if (data == NULL) { return gearmand_perror(errno, "malloc"); } memcpy(data, packet->data, packet->data_size); } } else { data= NULL; } gearmand_error_t 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; } gearmand-1.0.6/libgearman-server/connection.h0000664000076400007640000001354212116617157021507 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 Declarations */ #pragma once #include #include #include struct gearman_server_job_st; #ifdef __cplusplus extern "C" { #endif /** * @addtogroup gearman_server_con Connection Declarations * @ingroup gearman_server * * This is a low level interface for gearman server connections. This is used * internally by the server interface, so you probably want to look there first. * * @{ */ /** * 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_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, gearmand_con_st *dcon, gearmand_error_t *ret); /** * Attempt to free a server connection structure. */ GEARMAN_API void gearman_server_con_attempt_free(gearman_server_con_st *con); /** * Actually free a server connection structure. */ GEARMAN_API void gearman_server_con_free(gearman_server_con_st *con); /** * Get gearman connection pointer the server connection uses. */ GEARMAN_API gearmand_io_st *gearman_server_con_con(gearman_server_con_st *con); /** * Get application data pointer. */ GEARMAN_API gearmand_con_st *gearman_server_con_data(gearman_server_con_st *con); /** * Get client id. */ GEARMAN_API const char *gearman_server_con_id(gearman_server_con_st *con); /** * Set client id. */ GEARMAN_API void gearman_server_con_set_id(gearman_server_con_st *con, char *id, size_t size); /** * Free server worker struction with name for a server connection. */ GEARMAN_API void gearman_server_con_free_worker(gearman_server_con_st *con, char *function_name, size_t function_name_size); /** * Free all server worker structures for a server connection. */ GEARMAN_API void gearman_server_con_free_workers(gearman_server_con_st *con); /** * Add connection to the to_be_freed thread list. */ GEARMAN_API void gearman_server_con_to_be_freed_add(gearman_server_con_st *con); /** * Pick out the next connection to free */ GEARMAN_API gearman_server_con_st * gearman_server_con_to_be_freed_next(gearman_server_thread_st *thread); /** * Add connection to the io thread list. */ GEARMAN_API void gearman_server_con_io_add(gearman_server_con_st *con); /** * Remove connection from the io thread list. */ GEARMAN_API void gearman_server_con_io_remove(gearman_server_con_st *con); /** * Get next connection from the io thread list. */ GEARMAN_API gearman_server_con_st * gearman_server_con_io_next(gearman_server_thread_st *thread); /** * Add connection to the proc thread list. */ GEARMAN_API void gearman_server_con_proc_add(gearman_server_con_st *con); /** * Remove connection from the proc thread list. */ GEARMAN_API void gearman_server_con_proc_remove(gearman_server_con_st *con); /** * Get next connection from the proc thread list. */ GEARMAN_API gearman_server_con_st * gearman_server_con_proc_next(gearman_server_thread_st *thread); /** * Set protocol context pointer. * Add worker timeout for a connection tied to a job */ GEARMAN_API gearmand_error_t gearman_server_con_add_job_timeout(gearman_server_con_st *con, gearman_server_job_st *job); /** * Delete timeout event for a server con */ GEARMAN_API void gearman_server_con_delete_timeout(gearman_server_con_st *con); void gearman_server_con_protocol_release(gearman_server_con_st *con); gearman_server_con_st* build_gearman_server_con_st(void); void destroy_gearman_server_con_st(gearman_server_con_st* arg); void gearmand_connection_list_init(gearmand_connection_list_st *source, gearmand_event_watch_fn *watch_fn, void *watch_context); gearman_server_con_st *gearmand_ready(gearmand_connection_list_st *gearman); /** @} */ #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/0000775000076400007640000000000012142673674016210 5ustar00brianbrian00000000000000gearmand-1.0.6/libhashkit-1.0/has.h0000664000076400007640000000353112107145705017124 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #ifdef __cplusplus extern "C" { #endif HASHKIT_API bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/include.am0000664000076400007640000000137312107145705020144 0ustar00brianbrian00000000000000# vim:ft=automake # included from Top Level Makefile.am # All paths should be given relative to the root # EXTRA_DIST+= libhashkit-1.0/configure.h.in BUILT_SOURCES+= libhashkit-1.0/configure.h noinst_HEADERS+= libhashkit-1.0/algorithm.h noinst_HEADERS+= libhashkit-1.0/behavior.h noinst_HEADERS+= libhashkit-1.0/configure.h noinst_HEADERS+= libhashkit-1.0/digest.h noinst_HEADERS+= libhashkit-1.0/function.h noinst_HEADERS+= libhashkit-1.0/has.h noinst_HEADERS+= libhashkit-1.0/hashkit.h noinst_HEADERS+= libhashkit-1.0/hashkit.hpp noinst_HEADERS+= libhashkit-1.0/strerror.h noinst_HEADERS+= libhashkit-1.0/string.h noinst_HEADERS+= libhashkit-1.0/str_algorithm.h noinst_HEADERS+= libhashkit-1.0/types.h noinst_HEADERS+= libhashkit-1.0/visibility.h gearmand-1.0.6/libhashkit-1.0/algorithm.h0000664000076400007640000000536612107145705020347 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 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. * */ /** * @file * @brief HashKit Header */ #pragma once #ifdef __cplusplus extern "C" { #endif HASHKIT_API uint32_t libhashkit_one_at_a_time(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_fnv1_64(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_fnv1a_64(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_fnv1_32(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_fnv1a_32(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_crc32(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_hsieh(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_murmur(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_murmur3(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_jenkins(const char *key, size_t key_length); HASHKIT_API uint32_t libhashkit_md5(const char *key, size_t key_length); HASHKIT_API void libhashkit_md5_signature(const unsigned char *key, size_t length, unsigned char *result); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/hashkit.h0000664000076400007640000000627212107145705020011 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #if !defined(__cplusplus) # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include struct hashkit_st { struct hashkit_function_st { hashkit_hash_fn function; void *context; } base_hash, distribution_hash; struct { bool is_base_same_distributed:1; } flags; struct { bool is_allocated:1; } options; void *_key; }; #ifdef __cplusplus extern "C" { #endif HASHKIT_API hashkit_st *hashkit_create(hashkit_st *hash); HASHKIT_API hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *ptr); HASHKIT_API bool hashkit_compare(const hashkit_st *first, const hashkit_st *second); HASHKIT_API void hashkit_free(hashkit_st *hash); HASHKIT_API hashkit_string_st *hashkit_encrypt(hashkit_st *, const char* source, size_t source_length); HASHKIT_API hashkit_string_st *hashkit_decrypt(hashkit_st *, const char* source, size_t source_length); HASHKIT_API bool hashkit_key(hashkit_st *, const char *key, const size_t key_length); #ifdef __cplusplus } // extern "C" #endif gearmand-1.0.6/libhashkit-1.0/hashkit.hpp0000664000076400007640000000536012107145705020346 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2006-2010 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 #include #include class Hashkit { public: Hashkit() { hashkit_create(&self); } Hashkit(const Hashkit& source) { hashkit_clone(&self, &source.self); } Hashkit& operator=(const Hashkit& source) { hashkit_free(&self); hashkit_clone(&self, &source.self); return *this; } friend bool operator==(const Hashkit &left, const Hashkit &right) { return hashkit_compare(&left.self, &right.self); } uint32_t digest(std::string& str) { return hashkit_digest(&self, str.c_str(), str.length()); } uint32_t digest(const char *key, size_t key_length) { return hashkit_digest(&self, key, key_length); } hashkit_return_t set_function(hashkit_hash_algorithm_t hash_algorithm) { return hashkit_set_function(&self, hash_algorithm); } hashkit_return_t set_distribution_function(hashkit_hash_algorithm_t hash_algorithm) { return hashkit_set_function(&self, hash_algorithm); } ~Hashkit() { hashkit_free(&self); } private: hashkit_st self; }; gearmand-1.0.6/libhashkit-1.0/configure.h.in0000664000076400007640000000360712107145705020743 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #define LIBHASHKIT_VERSION_STRING "@LIBHASHKIT_VERSION_STRING@" #define LIBHASHKIT_VERSION_HEX @LIBHASHKIT_VERSION_HEX@ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/str_algorithm.h0000664000076400007640000000342112107145705021225 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit * * 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 #ifdef __cplusplus extern "C" { #endif HASHKIT_API const char *libhashkit_string_hash(hashkit_hash_algorithm_t type); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/behavior.h0000664000076400007640000000346512107145705020156 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 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. * */ /** * @file * @brief HashKit Header */ #pragma once #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/digest.h0000664000076400007640000000411712107145705017631 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #ifdef __cplusplus extern "C" { #endif HASHKIT_API uint32_t hashkit_digest(const hashkit_st *self, const char *key, size_t key_length); /** This is a utilitly function provided so that you can directly access hashes with a hashkit_st. */ HASHKIT_API uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algorithm_t hash_algorithm); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/types.h0000664000076400007640000000574212107145705017523 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 typedef enum { HASHKIT_SUCCESS, HASHKIT_FAILURE, HASHKIT_MEMORY_ALLOCATION_FAILURE, HASHKIT_INVALID_HASH, HASHKIT_INVALID_ARGUMENT, HASHKIT_MAXIMUM_RETURN /* Always add new error code before */ } hashkit_return_t; static inline bool hashkit_success(const hashkit_return_t rc) { return (rc == HASHKIT_SUCCESS); } static inline bool hashkit_failed(const hashkit_return_t rc) { return (rc != HASHKIT_SUCCESS); } typedef enum { HASHKIT_HASH_DEFAULT= 0, // hashkit_one_at_a_time() HASHKIT_HASH_MD5, HASHKIT_HASH_CRC, HASHKIT_HASH_FNV1_64, HASHKIT_HASH_FNV1A_64, HASHKIT_HASH_FNV1_32, HASHKIT_HASH_FNV1A_32, HASHKIT_HASH_HSIEH, HASHKIT_HASH_MURMUR, HASHKIT_HASH_JENKINS, HASHKIT_HASH_MURMUR3, HASHKIT_HASH_CUSTOM, HASHKIT_HASH_MAX } hashkit_hash_algorithm_t; /** * Hash distributions that are available to use. */ typedef enum { HASHKIT_DISTRIBUTION_MODULA, HASHKIT_DISTRIBUTION_RANDOM, HASHKIT_DISTRIBUTION_KETAMA, HASHKIT_DISTRIBUTION_MAX /* Always add new values before this. */ } hashkit_distribution_t; #ifdef __cplusplus extern "C" { #endif typedef struct hashkit_st hashkit_st; typedef struct hashkit_string_st hashkit_string_st; typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *context); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/configure.h0000664000076400007640000000360712142673655020347 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #define LIBHASHKIT_VERSION_STRING "@LIBHASHKIT_VERSION_STRING@" #define LIBHASHKIT_VERSION_HEX @LIBHASHKIT_VERSION_HEX@ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/function.h0000664000076400007640000000504312107145705020176 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #ifdef __cplusplus extern "C" { #endif /** This sets/gets the default function we will be using. */ HASHKIT_API hashkit_return_t hashkit_set_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm); HASHKIT_API hashkit_return_t hashkit_set_custom_function(hashkit_st *hash, hashkit_hash_fn function, void *context); HASHKIT_API hashkit_hash_algorithm_t hashkit_get_function(const hashkit_st *hash); /** This sets/gets the function we use for distribution. */ HASHKIT_API hashkit_return_t hashkit_set_distribution_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm); HASHKIT_API hashkit_return_t hashkit_set_custom_distribution_function(hashkit_st *self, hashkit_hash_fn function, void *context); HASHKIT_API hashkit_hash_algorithm_t hashkit_get_distribution_function(const hashkit_st *self); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/visibility.h0000664000076400007640000000240412107145705020536 0ustar00brianbrian00000000000000/* * Summary: interface for HashKit functions * Description: visibitliy macros for HashKit library * * Use and distribution licensed under the BSD license. See * the COPYING file in this directory for full text. * * Author: Monty Taylor */ /** * @file * @brief Visibility control macros */ #pragma once /** * * HASHKIT_API is used for the public API symbols. It either DLL imports or * DLL exports (or does nothing for static build). * * HASHKIT_LOCAL is used for non-api symbols. */ #if defined(BUILDING_HASHKIT) # if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY # define HASHKIT_API __attribute__ ((visibility("default"))) # define HASHKIT_LOCAL __attribute__ ((visibility("hidden"))) # elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define HASHKIT_API __global # define HASHKIT_LOCAL __hidden # elif defined(_MSC_VER) # define HASHKIT_API extern __declspec(dllexport) # define HASHKIT_LOCAL # else # define HASHKIT_API # define HASHKIT_LOCAL # endif /* defined(HAVE_VISIBILITY) */ #else /* defined(BUILDING_HASHKIT) */ # if defined(_MSC_VER) # define HASHKIT_API extern __declspec(dllimport) # define HASHKIT_LOCAL # else # define HASHKIT_API # define HASHKIT_LOCAL # endif /* defined(_MSC_VER) */ #endif /* defined(BUILDING_HASHKIT) */ gearmand-1.0.6/libhashkit-1.0/strerror.h0000664000076400007640000000353612107145705020240 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #ifdef __cplusplus extern "C" { #endif HASHKIT_API const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit-1.0/string.h0000664000076400007640000000405012107145705017654 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009-2010 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 #ifdef __cplusplus struct hashkit_string_st; #endif #ifdef __cplusplus extern "C" { #endif HASHKIT_API void hashkit_string_free(hashkit_string_st *ptr); HASHKIT_API size_t hashkit_string_length(const hashkit_string_st *self); HASHKIT_API const char *hashkit_string_c_str(const hashkit_string_st* self); #ifdef __cplusplus } // extern "C" #endif gearmand-1.0.6/COPYING0000664000076400007640000000301712107145705014614 0ustar00brianbrian00000000000000Gearman server and 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. gearmand-1.0.6/m4/0000775000076400007640000000000012142673673014111 5ustar00brianbrian00000000000000gearmand-1.0.6/m4/ax_compare_version.m40000664000076400007640000001465212107145705020235 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_compare_version.html # =========================================================================== # # SYNOPSIS # # AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # # DESCRIPTION # # This macro compares two version strings. Due to the various number of # minor-version numbers that can exist, and the fact that string # comparisons are not compatible with numeric comparisons, this is not # necessarily trivial to do in a autoconf script. This macro makes doing # these comparisons easy. # # The six basic comparisons are available, as well as checking equality # limited to a certain number of minor-version levels. # # The operator OP determines what type of comparison to do, and can be one # of: # # eq - equal (test A == B) # ne - not equal (test A != B) # le - less than or equal (test A <= B) # ge - greater than or equal (test A >= B) # lt - less than (test A < B) # gt - greater than (test A > B) # # Additionally, the eq and ne operator can have a number after it to limit # the test to that number of minor versions. # # eq0 - equal up to the length of the shorter version # ne0 - not equal up to the length of the shorter version # eqN - equal up to N sub-version levels # neN - not equal up to N sub-version levels # # When the condition is true, shell commands ACTION-IF-TRUE are run, # otherwise shell commands ACTION-IF-FALSE are run. The environment # variable 'ax_compare_version' is always set to either 'true' or 'false' # as well. # # Examples: # # AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) # AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) # # would both be true. # # AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) # AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) # # would both be false. # # AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) # # would be true because it is only comparing two minor versions. # # AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) # # would be true because it is only comparing the lesser number of minor # versions of the two values. # # Note: The characters that separate the version numbers do not matter. An # empty string is the same as version 0. OP is evaluated by autoconf, not # configure, so must be a string, not a variable. # # The author would like to acknowledge Guido Draheim whose advice about # the m4_case and m4_ifvaln functions make this macro only include the # portions necessary to perform the specific comparison specified by the # OP argument in the final configure script. # # LICENSE # # Copyright (c) 2008 Tim Toolan # # 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. This file is offered as-is, without any # warranty. #serial 11 dnl ######################################################################### AC_DEFUN([AX_COMPARE_VERSION], [ AC_REQUIRE([AC_PROG_AWK]) # Used to indicate true or false condition ax_compare_version=false # Convert the two version strings to be compared into a format that # allows a simple string comparison. The end result is that a version # string of the form 1.12.5-r617 will be converted to the form # 0001001200050617. In other words, each number is zero padded to four # digits, and non digits are removed. AS_VAR_PUSHDEF([A],[ax_compare_version_A]) A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/[[^0-9]]//g'` AS_VAR_PUSHDEF([B],[ax_compare_version_B]) B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/[[^0-9]]//g'` dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary dnl # then the first line is used to determine if the condition is true. dnl # The sed right after the echo is to remove any indented white space. m4_case(m4_tolower($2), [lt],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` ], [gt],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` ], [le],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` ], [ge],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` ],[ dnl Split the operator from the subversion count if present. m4_bmatch(m4_substr($2,2), [0],[ # A count of zero means use the length of the shorter version. # Determine the number of characters in A and B. ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` # Set A to no more than B's length and B to no more than A's length. A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` ], [[0-9]+],[ # A count greater than zero means use only that many subversions A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` ], [.+],[ AC_WARNING( [illegal OP numeric parameter: $2]) ],[]) # Pad zeros at end of numbers to make same length. ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" B="$B`echo $A | sed 's/./0/g'`" A="$ax_compare_version_tmp_A" # Check for equality or inequality as necessary. m4_case(m4_tolower(m4_substr($2,0,2)), [eq],[ test "x$A" = "x$B" && ax_compare_version=true ], [ne],[ test "x$A" != "x$B" && ax_compare_version=true ],[ AC_WARNING([illegal OP parameter: $2]) ]) ]) AS_VAR_POPDEF([A])dnl AS_VAR_POPDEF([B])dnl dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. if test "$ax_compare_version" = "true" ; then m4_ifvaln([$4],[$4],[:])dnl m4_ifvaln([$5],[else $5])dnl fi ]) dnl AX_COMPARE_VERSION gearmand-1.0.6/m4/ax_restore_flags.m40000664000076400007640000000156112107145705017674 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html # =========================================================================== # # SYNOPSIS # # AX_RESTORE_FLAGS() # # DESCRIPTION # # Restore common compilation flags from temporary variables # # LICENSE # # Copyright (c) 2009 Filippo Giunchedi # # 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. This file is offered as-is, without any # warranty. #serial 3 AC_DEFUN([AX_RESTORE_FLAGS], [ CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" ]) gearmand-1.0.6/m4/ax_vcs_checkout.m40000664000076400007640000000556512107145705017525 0ustar00brianbrian00000000000000# =========================================================================== # http:// # =========================================================================== # # SYNOPSIS # # AX_VCS_CHECKOUT # # DESCRIPTION # # Discover whether or not we are operating with a tree which # has been checked out of a version control system. # # # LICENSE # # Copyright (C) 2012 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. #serial 6 AC_DEFUN([AX_VCS_SYSTEM], [AC_PREREQ([2.63])dnl AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system], [ac_cv_vcs_system="none" AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"]) AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"]) AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"]) AS_IF([test -d ".git"],[ac_cv_vcs_system="git"]) ]) AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system]) ]) AC_DEFUN([AX_VCS_CHECKOUT], [AC_PREREQ([2.63])dnl AC_REQUIRE([AX_VCS_SYSTEM]) AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout], [AS_IF([test "x$ac_cv_vcs_system" != "xnone"], [ac_cv_vcs_checkout=yes], [ac_cv_vcs_checkout=no]) ]) AM_CONDITIONAL([IS_VCS_CHECKOUT],[test "x$ac_cv_vcs_checkout" = "xyes"]) AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"], [AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])], [AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])]) ]) gearmand-1.0.6/m4/ax_am_jobserver.m40000664000076400007640000000401512107145705017510 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_am_jobserver.html # =========================================================================== # # SYNOPSIS # # AX_AM_JOBSERVER([default_value]) # # DESCRIPTION # # Enables the use of make's jobserver for the purpose of parallel building # by passing the -j option to make. # # The option --enable-jobserver is added to configure which can accept a # yes, no, or an integer. The integer is the number of separate jobs to # allow. If 'yes' is given, then the is assumed to be one more than the # number of CPUs (determined through AX_COUNT_CPUS). If the value of no is # given, then the jobserver is disabled. The default value is given by the # first argument of the macro, or 'yes' if the argument is omitted. # # This macro makes use of AX_AM_MACROS, so you must add the following line # # @INC_AMINCLUDE@ # # to your Makefile.am files. # # LICENSE # # Copyright (c) 2008 Michael Paul Bailey # # 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. This file is offered as-is, without any # warranty. #serial 7 AC_DEFUN([AX_AM_JOBSERVER], [ AC_REQUIRE([AX_COUNT_CPUS]) AC_REQUIRE([AX_AM_MACROS]) AC_ARG_ENABLE( jobserver, [ --enable-jobserver@<:@=no/yes/@%:@@:>@ default=m4_ifval([$1],[$1],[yes]) Enable up to @%:@ make jobs yes: enable one more than CPU count ],, [enable_jobserver=m4_ifval([$1],[$1],[yes])]) if test "x$enable_jobserver" = "xyes"; then enable_jobserver=$CPU_COUNT ((enable_jobserver++)) fi m4_pattern_allow(AM_MAKEFLAGS) if test "x$enable_jobserver" != "xno"; then AC_MSG_NOTICE([added jobserver support to make for $enable_jobserver jobs]) AX_ADD_AM_MACRO( AM_MAKEFLAGS += -j$enable_jobserver ) fi ]) gearmand-1.0.6/m4/ltsugar.m40000644000076400007640000001042412140672515016023 0ustar00brianbrian00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 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 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) gearmand-1.0.6/m4/include.am0000664000076400007640000000050212107145705016037 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2012 DataDifferential # # 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 gearmand-1.0.6/m4/ax_prog_sphinx_build.m40000664000076400007640000000265012137342236020555 0ustar00brianbrian00000000000000# =========================================================================== # https://github.com/BrianAker/ddm4 # =========================================================================== # # SYNOPSIS # # AX_PROG_SPHINX_BUILD([ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND]) # # DESCRIPTION # # Look for sphinx-build and make sure it is a recent version of it. # # LICENSE # # Copyright (c) 2012-2013 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 3 AC_DEFUN([AX_PROG_SPHINX_BUILD], [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:]) AS_IF([test x"SPHINXBUILD" = x":"], [SPHINXBUILD=], [AS_IF([test -x "$SPHINXBUILD"], [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent]) junk=`$SPHINXBUILD &> version_file` ax_sphinx_build_version=`head -1 version_file` rm version_file AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"]) $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1 AS_IF([test $? -eq 0], ,[SPHINXBUILD=]) rm -rf conftest.d ]) ]) AS_IF([test -n "${SPHINXBUILD}"], [AC_SUBST([SPHINXBUILD]) ifelse([$1], , :, [$1])], [ifelse([$2], , :, [$2])]) ]) gearmand-1.0.6/m4/ax_lib_curl.m40000664000076400007640000000223012107145705016622 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_curl.html # =========================================================================== # # SYNOPSIS # # AX_LIB_CURL([VERSION],[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE]) # # DESCRIPTION # # Checks for minimum curl library version VERSION. If successfull executes # ACTION-IF-SUCCESS otherwise ACTION-IF-FAILURE. # # Defines CURL_LIBS and CURL_CFLAGS. # # A simple example: # # AX_LIB_CURL([7.19.4],,[ # AC_MSG_ERROR([Your system lacks of libcurl >= 7.19.4]) # ]) # # This macro is a rearranged version of AC_LIB_CURL from Akos Maroy. # # LICENSE # # Copyright (c) 2009 Francesco Salvestrini # # 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. This file is offered as-is, without any # warranty. #serial 7 AU_ALIAS([AC_CHECK_CURL], [AX_LIB_CURL]) AC_DEFUN([AX_LIB_CURL], [ AX_PATH_GENERIC([curl],[$1],'s/^libcurl\ \+//',[$2],[$3]) ]) gearmand-1.0.6/m4/ax_libevent.m40000664000076400007640000001025612137131133016637 0ustar00brianbrian00000000000000# https://github.com/BrianAker/ddm4 # =========================================================================== # # SYNOPSIS # # AX_LIBEVENT([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # AX_LIBEVENT2() # AX_LIBEVENT2_EVHTTP() # # DESCRIPTION # # libevent library # # LICENSE # # Copyright (c) 2012 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 5 AC_DEFUN([AX_LIBEVENT], [AC_PREREQ([2.63])dnl AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent], [AX_SAVE_FLAGS LIBS="-levent $LIBS" AC_LANG_PUSH([C]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include ]],[[ struct event_base *tmp_event= event_init(); event_base_free(tmp_event); ]])], [ax_cv_libevent=yes], [ax_cv_libevent=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP AX_RESTORE_FLAGS ]) AS_IF([test "x$ax_cv_libevent" = "xyes"], [AC_SUBST([LIBEVENT_LIB],[-levent]) AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])], [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])]) AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes") # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: AS_IF([test "x$ax_cv_libevent" = xyes], [$1], [$2]) ]) AC_DEFUN([AX_LIBEVENT2], [AC_REQUIRE([AX_LIBEVENT]) AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2], [AX_SAVE_FLAGS LIBS="-levent $LIBS" AC_LANG_PUSH([C]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include ]],[[ struct event_base *___event_base= event_base_new(); event_base_free(___event_base); ]])], [ax_cv_libevent2=yes], [ax_cv_libevent2=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP([C]) AX_RESTORE_FLAGS ]) AS_IF([test "x$ax_cv_libevent2" = xyes], [AC_SUBST([LIBEVENT2_LIB],[-levent]) AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])], [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])]) AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: AS_IF([test "x$ax_cv_libevent2" = xyes], [$1], [$2]) ])dnl AX_LIBEVENT2 # AC_DEFUN([AX_LIBEVENT2_EVHTTP], [AC_REQUIRE([AX_LIBEVENT2]) AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp], [AX_SAVE_FLAGS LIBS="-levent $LIBS" AC_LANG_PUSH([C]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include #include ]],[[ struct event_base *___event_base= event_base_new(); struct evhttp *___evhttp= evhttp_new(___event_base); evhttp_free(___evhttp); event_base_free(___event_base); ]])], [ax_cv_libevent2_evhttp=yes], [ax_cv_libevent2_evhttp=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP([C]) AX_RESTORE_FLAGS ]) AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"], [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[1],[Define if event_init is present in event2/http.h.])], [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[0],[Define if event_init is present in event2/http.h.])]) AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: AS_IF([test "x$ax_cv_libevent2_evhttp" = xyes], [$1], [$2]) ])dnl AX_LIBEVENT2_EVHTTP gearmand-1.0.6/m4/ax_add_am_macro.m40000664000076400007640000000160112107145705017416 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_add_am_macro.html # =========================================================================== # # SYNOPSIS # # AX_ADD_AM_MACRO([RULE]) # # DESCRIPTION # # Adds the specified rule to $AMINCLUDE. This macro will only work # properly with implementations of Make which allow include statements. # See also AX_ADD_AM_MACRO_STATIC. # # LICENSE # # Copyright (c) 2009 Tom Howard # # 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. This file is offered as-is, without any # warranty. #serial 9 AC_DEFUN([AX_ADD_AM_MACRO],[ AC_REQUIRE([AX_AM_MACROS]) AX_APPEND_TO_FILE([$AMINCLUDE],[$1]) ]) gearmand-1.0.6/m4/ax_check_link_flag.m40000664000076400007640000000576012107145705020125 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # # DESCRIPTION # # Check whether the given FLAG works with the linker or gives an error. # (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the linker's default flags # when the check is done. The check is thus made with the flags: "LDFLAGS # EXTRA-FLAGS FLAG". This can for example be used to force the linker to # issue an error when a bad flag is given. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CHECK_LINK_FLAG], [AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $4 $1" AC_LINK_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) LDFLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_LINK_FLAGS gearmand-1.0.6/m4/ax_compiler_version.m40000664000076400007640000000741212107145705020415 0ustar00brianbrian00000000000000# =========================================================================== # https://github.com/BrianAker/ddm4/ # =========================================================================== # # SYNOPSIS # # AX_COMPILER_VERSION() # # DESCRIPTION # # Capture version of C/C++ compiler # # LICENSE # # Copyright (C) 2012 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. #serial 5 AC_DEFUN([_C_COMPILER_VERSION], [AC_MSG_CHECKING([C Compiler version]) AS_CASE(["$ax_cv_c_compiler_vendor"], [sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`], [intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`], [clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`], [gnu],[ax_c_compiler_version=`$CC --version | sed 1q`], [mingw],[ax_c_compiler_version=`$CC --version | sed 1q`], [ax_c_compiler_version="unknown: $ax_cv_c_compiler_vendor"]) AC_MSG_RESULT(["$ax_c_compiler_version"]) AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"]) AC_SUBST([CC_VERSION],["$ax_c_compiler_version"]) ]) AC_DEFUN([_CXX_COMPILER_VERSION], [AC_MSG_CHECKING([C++ Compiler version]) AS_CASE(["$ax_cv_c_compiler_vendor"], [sun],[ax_cxx_compiler_version=`$CXX -V 2>&1 | sed 1q`], [intel],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`], [clang],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`], [gnu],[ax_cxx_compiler_version=`$CXX --version | sed 1q`], [mingw],[ax_cxx_compiler_version=`$CXX --version | sed 1q`], [ax_cxx_compiler_version="unknown: $ax_cv_c_compiler_vendor"]) AC_MSG_RESULT(["$ax_cxx_compiler_version"]) AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"]) AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"]) ]) AC_DEFUN([AX_COMPILER_VERSION], [AC_REQUIRE([AX_COMPILER_VENDOR]) AC_MSG_CHECKING([MINGW]) AC_CHECK_DECL([__MINGW32__], [MINGW=yes ax_c_compiler_version_vendor=mingw], [MINGW=no]) AC_MSG_RESULT([$MINGW]) AC_REQUIRE([_C_COMPILER_VERSION]) AC_REQUIRE([_CXX_COMPILER_VERSION]) AS_IF([test "x$GCC" = xyes], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 7)) # error GCC is Too Old! #endif ]])], [ac_c_gcc_recent=yes], [ac_c_gcc_recent=no]) ]) ]) gearmand-1.0.6/m4/ax_print_to_file.m40000664000076400007640000000137012107145705017670 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_print_to_file.html # =========================================================================== # # SYNOPSIS # # AX_PRINT_TO_FILE([FILE],[DATA]) # # DESCRIPTION # # Writes the specified data to the specified file. # # LICENSE # # Copyright (c) 2008 Tom Howard # # 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. This file is offered as-is, without any # warranty. #serial 7 AC_DEFUN([AX_PRINT_TO_FILE],[ AC_REQUIRE([AX_FILE_ESCAPES]) printf "$2" > "$1" ]) gearmand-1.0.6/m4/ax_pthread_timedjoin_np.m40000664000076400007640000000266412107145705021230 0ustar00brianbrian00000000000000# =========================================================================== # http:// # =========================================================================== # # SYNOPSIS # # AX_PTHREAD_TIMEDJOIN_NP() # # DESCRIPTION # # Check for pthread_timedjoin_np support. # # LICENSE # # Copyright (c) 2012 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 6 AC_DEFUN([AX_PTHREAD_TIMEDJOIN_NP], [AC_PREREQ([2.63])dnl AC_REQUIRE([AX_PTHREAD]) AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np], [AX_SAVE_FLAGS CFLAGS="$PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS" AC_LANG_PUSH([C]) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #include #include ],[ pthread_t thread; pthread_timedjoin_np(thread, NULL, NULL); ])], [ax_cv_pthread_timedjoin_np=yes],[]) AC_LANG_POP AX_RESTORE_FLAGS ]) AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes], [AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])], [AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.])]) ]) gearmand-1.0.6/m4/ax_hex_version.m40000664000076400007640000000202112107145705017356 0ustar00brianbrian00000000000000# =========================================================================== # https://github.com/BrianAker/ddm4 # =========================================================================== # # SYNOPSIS # # AX_HEX_VERSION(VARIABLE_NAME, VERSION) # # DESCRIPTION # # Generate version information in HEX and STRING format. # # LICENSE # # Copyright (c) 2012 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 3 AC_DEFUN([AX_HEX_VERSION], [AC_PREREQ([2.63])dnl string_version_$1=`echo $2 | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'` hex_version_$1=`echo $2 | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "0x%0.2d%0.3d%0.3d", $[]1, $[]2, $[]3}'` AC_SUBST([$1_VERSION_STRING],["$string_version_$1"]) AC_SUBST([$1_VERSION_HEX],["$hex_version_$1"]) ]) gearmand-1.0.6/m4/hiredis.m40000664000076400007640000000141312107145705015770 0ustar00brianbrian00000000000000# Copyright (C) 2011 Brian Aker (brian@tangent.org) # # serial 2 AC_DEFUN([_SEARCH_HIREDIS], [AC_REQUIRE([AX_CHECK_LIBRARY]) AS_IF([test "x$ac_enable_hiredis" = "xyes"], [hiredis_header="hiredis/hiredis.h"], [hiredis_header="does_not_exist"]) AX_CHECK_LIBRARY([HIREDIS],[$hiredis_header],[hiredis],, [AC_DEFINE([HAVE_HIREDIS],[0],[Define to 1 if HIREDIS is found])]) AS_IF([test "x$ax_cv_have_HIREDIS" = xno],[ac_enable_hiredis="no"]) ]) AC_DEFUN([AX_ENABLE_LIBHIREDIS], [AC_ARG_ENABLE([hiredis], [AS_HELP_STRING([--disable-hiredis], [Build with hiredis support @<:@default=on@:>@])], [ac_enable_hiredis="$enableval"], [ac_enable_hiredis="yes"]) _SEARCH_HIREDIS ]) gearmand-1.0.6/m4/have_cstdint.m40000664000076400007640000000614412107145705017022 0ustar00brianbrian00000000000000# =========================================================================== # http://tangent.org/ # =========================================================================== # # SYNOPSIS # # AX_CXX_CSTDINT() # # DESCRIPTION # # Example: # # LICENSE # # Copyright (c) 2012 Brian Aker` # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CXX_CSTDINT], [ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], [ AC_LANG_PUSH([C++]) AX_SAVE_FLAGS CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ uint32_t t ])], [ac_cxx_cstdint_cstdint=""]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ uint32_t t ])], [ac_cxx_cstdint_tr1_cstdint=""]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ uint32_t t ])], [ac_cxx_cstdint_boost_cstdint_hpp=""]) AC_LANG_POP AX_RESTORE_FLAGS AS_IF([test -n "$ac_cxx_cstdint_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_cstdint], [test -n "$ac_cxx_cstdint_tr1_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_tr1_cstdint], [test -n "$ac_cxx_cstdint_boost_cstdint_hpp"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_boost_cstdint_hpp]) ]) AS_IF([test -n "$ac_cv_cxx_cstdint"], [AC_MSG_RESULT([$ac_cv_cxx_cstdint])], [ ac_cv_cxx_cstdint="" AC_MSG_WARN([Could not find a cstdint header.]) AC_MSG_RESULT([$ac_cv_cxx_cstdint]) ]) AC_DEFINE_UNQUOTED([CSTDINT_H],[$ac_cv_cxx_cstdint], [the location of ]) ]) gearmand-1.0.6/m4/drizzled.m40000664000076400007640000000077112107145705016176 0ustar00brianbrian00000000000000AX_WITH_PROG(DRIZZLED_BINARY,drizzled) AS_IF([test -f "$ac_cv_path_DRIZZLED_BINARY"], [ AC_DEFINE([HAVE_DRIZZLED_BINARY], [1], [If Memcached binary is available]) AC_DEFINE_UNQUOTED([DRIZZLED_BINARY], "$ac_cv_path_DRIZZLED_BINARY", [Name of the drizzled binary used in make test]) ], [ AC_DEFINE([HAVE_DRIZZLED_BINARY], [0], [If Memcached binary is available]) AC_DEFINE([DRIZZLED_BINARY], [0], [Name of the drizzled binary used in make test]) ]) gearmand-1.0.6/m4/ax_dlopen.m40000664000076400007640000000053312107145705016314 0ustar00brianbrian00000000000000#serial 2 AC_DEFUN([AX_DLOPEN], [AS_IF([test "x$enable_shared" = xyes], [AX_CHECK_LIBRARY([DL],[dlfcn.h],[dl], [AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen]) AC_CHECK_LIB([dl],[dlopen],[AC_DEFINE([HAVE_DLOPEN],[1],[Have dlopen])]) AC_CHECK_LIB([dl],[dladdr],[AC_DEFINE([HAVE_DLADDR],[1],[Have dladdr])])])]) ]) gearmand-1.0.6/m4/ax_endian.m40000664000076400007640000000201312107145705016264 0ustar00brianbrian00000000000000# https://github.com/BrianAker/ddm4 # =========================================================================== # # SYNOPSIS # # AX_ENDIAN() # # DESCRIPTION # # Generate to defines describing endian. # # LICENSE # # Copyright (c) 2012 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 1 AC_DEFUN([AX_ENDIAN],[ AC_C_BIGENDIAN([ AC_DEFINE([WORDS_BIGENDIAN],[1],[machine is big-endian]) AC_DEFINE([ENDIAN_BIG],[1],[machine is big-endian]) AC_DEFINE([ENDIAN_LITTLE],[0],[machine is little-endian])],[ ],[ AC_DEFINE([WORDS_BIGENDIAN],[0],[machine is big-endian]) AC_DEFINE([ENDIAN_BIG],[0],[machine is big-endian]) AC_DEFINE([ENDIAN_LITTLE],[1],[machine is little-endian]) ],[ AC_MSG_ERROR([unable to determine endian]) ]) ]) gearmand-1.0.6/m4/ax_save_flags.m40000664000076400007640000000154712107145705017153 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_save_flags.html # =========================================================================== # # SYNOPSIS # # AX_SAVE_FLAGS() # # DESCRIPTION # # Save common compilation flags into temporary variables # # LICENSE # # Copyright (c) 2009 Filippo Giunchedi # # 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. This file is offered as-is, without any # warranty. #serial 3 AC_DEFUN([AX_SAVE_FLAGS], [ CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" ]) gearmand-1.0.6/m4/ax_check_compile_flag.m40000664000076400007640000000625112107145705020614 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS gearmand-1.0.6/m4/ax_assert.m40000664000076400007640000000467412107145705016346 0ustar00brianbrian00000000000000# =========================================================================== # https://github.com/BrianAker/ddm4/ # =========================================================================== # # SYNOPSIS # # AX_ASSERT() # # DESCRIPTION # # --enable-assert # # LICENSE # # Copyright (C) 2012 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. #serial 6 AC_DEFUN([AX_ASSERT], [AC_PREREQ([2.63])dnl AC_REQUIRE([AX_DEBUG]) AC_REQUIRE([AX_VCS_CHECKOUT]) AC_ARG_ENABLE([assert], [AS_HELP_STRING([--enable-assert], [Enable assert, this will be overridden by --enable-debug (yes|no) @<:@default=no@:>@])], [ax_enable_assert=yes], [ax_enable_assert=no]) AS_IF([ test "$ax_enable_assert" = "yes" -o "$ax_enable_debug" = "yes" -o "$ac_cv_vcs_checkout" = "yes" ], [ax_enable_assert="yes"], [ax_enable_assert="no" AC_DEFINE(NDEBUG,[1],[Define to 1 to disable assert'ing code.])]) AC_MSG_CHECKING([for assert]) AC_MSG_RESULT([$ax_enable_assert]) ]) gearmand-1.0.6/m4/ax_file_escapes.m40000664000076400007640000000137312107145705017460 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_file_escapes.html # =========================================================================== # # SYNOPSIS # # AX_FILE_ESCAPES # # DESCRIPTION # # Writes the specified data to the specified file. # # LICENSE # # Copyright (c) 2008 Tom Howard # # 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. This file is offered as-is, without any # warranty. #serial 7 AC_DEFUN([AX_FILE_ESCAPES],[ AX_DOLLAR="\$" AX_SRB="\\135" AX_SLB="\\133" AX_BS="\\\\" AX_DQ="\"" ]) gearmand-1.0.6/m4/ax_lib_sqlite3.m40000664000076400007640000001203012107145705017240 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_sqlite3.html # =========================================================================== # # SYNOPSIS # # AX_LIB_SQLITE3([MINIMUM-VERSION]) # # DESCRIPTION # # Test for the SQLite 3 library of a particular version (or newer) # # This macro takes only one optional argument, required version of SQLite # 3 library. If required version is not passed, 3.0.0 is used in the test # of existance of SQLite 3. # # If no intallation prefix to the installed SQLite library is given the # macro searches under /usr, /usr/local, and /opt. # # This macro calls: # # AC_SUBST(SQLITE3_CFLAGS) # AC_SUBST(SQLITE3_LDFLAGS) # AC_SUBST(SQLITE3_VERSION) # # And sets: # # HAVE_SQLITE3 # # LICENSE # # Copyright (c) 2008 Mateusz Loskot # # 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. This file is offered as-is, without any # warranty. #serial 14 AC_DEFUN([AX_LIB_SQLITE3], [ AC_ARG_WITH([sqlite3], AS_HELP_STRING( [--with-sqlite3=@<:@ARG@:>@], [use SQLite 3 library @<:@default=yes@:>@, optionally specify the prefix for sqlite3 library] ), [ if test "$withval" = "no"; then WANT_SQLITE3="no" elif test "$withval" = "yes"; then WANT_SQLITE3="yes" ac_sqlite3_path="" else WANT_SQLITE3="yes" ac_sqlite3_path="$withval" fi ], [WANT_SQLITE3="yes"] ) SQLITE3_CFLAGS="" SQLITE3_LDFLAGS="" SQLITE3_VERSION="" if test "x$WANT_SQLITE3" = "xyes"; then ac_sqlite3_header="sqlite3.h" sqlite3_version_req=ifelse([$1], [], [3.0.0], [$1]) sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([[0-9]]*\.[[0-9]]*\)'` sqlite3_version_req_major=`expr $sqlite3_version_req : '\([[0-9]]*\)'` sqlite3_version_req_minor=`expr $sqlite3_version_req : '[[0-9]]*\.\([[0-9]]*\)'` sqlite3_version_req_micro=`expr $sqlite3_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$sqlite3_version_req_micro" = "x" ; then sqlite3_version_req_micro="0" fi sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ \+ $sqlite3_version_req_minor \* 1000 \ \+ $sqlite3_version_req_micro` AC_MSG_CHECKING([for SQLite3 library >= $sqlite3_version_req]) if test "$ac_sqlite3_path" != ""; then ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" else for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then ac_sqlite3_path=$ac_sqlite3_path_tmp ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include" ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib" break; fi done fi ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3" saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags" AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM([[@%:@include ]], [[ #if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) // Everything is okay #else # error SQLite version is too old #endif ]] ) ], [ AC_MSG_RESULT([yes]) success="yes" ], [ AC_MSG_RESULT([not found]) success="no" WANT_SQLITE3="no" ] ) AC_LANG_POP(C) CPPFLAGS="$saved_CPPFLAGS" if test "$success" = "yes"; then SQLITE3_CFLAGS="$ac_sqlite3_cppflags" SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" dnl Retrieve SQLite release version if test "x$ac_sqlite3_header_path" != "x"; then ac_sqlite3_version=`cat $ac_sqlite3_header_path \ | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ | sed -e 's/"//'` if test $ac_sqlite3_version != ""; then SQLITE3_VERSION=$ac_sqlite3_version else AC_MSG_WARN([Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!]) fi fi AC_SUBST(SQLITE3_CFLAGS) AC_SUBST(SQLITE3_LDFLAGS) AC_SUBST(SQLITE3_VERSION) AC_DEFINE([HAVE_SQLITE3], [], [Have the SQLITE3 library]) fi fi ]) gearmand-1.0.6/m4/ax_platform.m40000664000076400007640000000432512137131133016653 0ustar00brianbrian00000000000000# =========================================================================== # http:// # =========================================================================== # # SYNOPSIS # # AX_PLATFORM # # DESCRIPTION # # Provide target and host defines. # # LICENSE # # Copyright (c) 2012-2013 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 3 # AC_DEFUN([AX_PLATFORM], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_TARGET]) AC_DEFINE_UNQUOTED([HOST_VENDOR],["$host_vendor"],[Vendor of Build System]) AC_DEFINE_UNQUOTED([HOST_OS],["$host_os"], [OS of Build System]) AC_DEFINE_UNQUOTED([HOST_CPU],["$host_cpu"], [CPU of Build System]) AC_DEFINE_UNQUOTED([TARGET_VENDOR],["$target_vendor"],[Vendor of Target System]) AC_DEFINE_UNQUOTED([TARGET_OS],["$target_os"], [OS of Target System]) AC_DEFINE_UNQUOTED([TARGET_CPU],["$target_cpu"], [CPU of Target System]) AS_CASE([$target_os], [*mingw*], [TARGET_WINDOWS="true" AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows]) 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 ])], [*freebsd*],[AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD]) AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])], [*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])], [*darwin*], [TARGET_OSX="true"], [*linux*], [TARGET_LINUX="true" AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])]) AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"]) AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"]) AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"]) AM_CONDITIONAL([TARGET_FREEBSD],[test "x${TARGET_OS_FREEBSD}" = "xtrue"]) ]) gearmand-1.0.6/m4/ax_compiler_vendor.m40000664000076400007640000000662012107145705020225 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html # =========================================================================== # # SYNOPSIS # # AX_COMPILER_VENDOR() # # DESCRIPTION # # Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, # hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, # watcom, etc. The vendor is returned in the cache variable # $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2008 Matteo Frigo # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 11 AC_DEFUN([AX_COMPILER_VENDOR], [AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [# note: don't check for gcc first since some other compilers define __GNUC__ vendors="intel: __ICC,__ECC,__INTEL_COMPILER ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale: __PATHCC__,__PATHSCALE__ clang: __clang__ gnu: __GNUC__ sun: __SUNPRO_C,__SUNPRO_CC hp: __HP_cc,__HP_aCC dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland: __BORLANDC__,__TURBOC__ comeau: __COMO__ cray: _CRAYC kai: __KCC lcc: __LCC__ sgi: __sgi,sgi microsoft: _MSC_VER metrowerks: __MWERKS__ watcom: __WATCOMC__ portland: __PGI unknown: UNKNOWN" for ventest in $vendors; do case $ventest in *:) vendor=$ventest; continue ;; *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; esac AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ #if !($vencpp) thisisanerror; #endif ])], [break]) done ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` ]) ]) gearmand-1.0.6/m4/ax_with_prog.m40000664000076400007640000000471112107145705017037 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_with_prog.html # =========================================================================== # # SYNOPSIS # # AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH]) # # DESCRIPTION # # Locates an installed program binary, placing the result in the precious # variable VARIABLE. Accepts a present VARIABLE, then --with-program, and # failing that searches for program in the given path (which defaults to # the system path). If program is found, VARIABLE is set to the full path # of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND # if provided, unchanged otherwise. # # A typical example could be the following one: # # AX_WITH_PROG(PERL,perl) # # NOTE: This macro is based upon the original AX_WITH_PYTHON macro from # Dustin J. Mitchell . # # LICENSE # # Copyright (c) 2008 Francesco Salvestrini # Copyright (c) 2008 Dustin J. Mitchell # # 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. This file is offered as-is, without any # warranty. #serial 16 AC_DEFUN([AX_WITH_PROG],[ AC_PREREQ([2.61]) pushdef([VARIABLE],$1) pushdef([EXECUTABLE],$2) pushdef([VALUE_IF_NOT_FOUND],$3) pushdef([PATH_PROG],$4) AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable) AS_IF(test -z "$VARIABLE",[ AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided) AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[PATH]]]],absolute path to EXECUTABLE executable), [ AS_IF([test "$withval" != yes && test "$withval" != no],[ VARIABLE="$withval" AC_MSG_RESULT($VARIABLE) ],[ VARIABLE="" AC_MSG_RESULT([no]) AS_IF([test "$withval" != no], [ AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[]) ]) ]) ],[ AC_MSG_RESULT([no]) AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[]) ]) ]) popdef([PATH_PROG]) popdef([VALUE_IF_NOT_FOUND]) popdef([EXECUTABLE]) popdef([VARIABLE]) ]) gearmand-1.0.6/m4/extensions.m40000664000076400007640000000633112107145705016544 0ustar00brianbrian00000000000000# serial 6 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2008 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. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf # 2.62 or later everywhere, but since CVS Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. # AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. # Remember that #undef in AH_VERBATIM gets replaced with #define by # AC_DEFINE. The goal here is to define all known feature-enabling # macros, then, if reports of conflicts are made, disable macros that # cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_HEADER([minix/gear_config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], [Define to 1 if you need to in order for `stat' and other things to work.]) AC_DEFINE([_POSIX_1_SOURCE], [2], [Define to 2 if the system does not provide POSIX.1 features except with this defined.]) AC_DEFINE([_MINIX], [1], [Define to 1 if on MINIX.]) fi dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already dnl provided. case "$host_os" in hpux*) AC_DEFINE([_XOPEN_SOURCE], [500], [Define to 500 only on HP-UX.]) ;; esac AH_VERBATIM([__EXTENSIONS__], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif ]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ # define __EXTENSIONS__ 1 ]AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) ])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) gearmand-1.0.6/m4/have_cinttypes.m40000664000076400007640000000671612107145705017401 0ustar00brianbrian00000000000000# =========================================================================== # http://tangent.org/ # =========================================================================== # # SYNOPSIS # # AX_CXX_CINTTYPES() # # DESCRIPTION # # Example: # # LICENSE # # Copyright (c) 2012 Brian Aker` # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CXX_CINTTYPES], [ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) AC_REQUIRE([AX_CXX_CSTDINT]) AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], [ AX_SAVE_FLAGS CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ uint32_t foo= UINT32_C(1); ])], [ac_cxx_cinttypes_cinttypes=""]) # Look for tr1/cinttypes AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ uint32_t foo= UINT32_C(1); ])], [ac_cxx_cinttypes_tr1_cinttypes=""]) # Look for boost/cinttypes.hpp AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ uint32_t foo= UINT32_C(1); ])], [ac_cxx_cinttypes_boost_cinttypes_hpp=""]) AC_LANG_POP AX_RESTORE_FLAGS AS_IF([test -n "$ac_cxx_cinttypes_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_cinttypes], [test -n "$ac_cxx_cinttypes_tr1_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_tr1_cinttypes], [test -n "$ac_cxx_cinttypes_boost_cinttypes_hpp"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_boost_cinttypes_hpp]) ]) AS_IF([ test -n "$ac_cv_cxx_cinttypes"], [ AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) ],[ ac_cv_cxx_cinttypes="" AC_MSG_WARN([Could not find a cinttypes header.]) AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) ]) AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++]) AC_DEFINE_UNQUOTED([CINTTYPES_H],[$ac_cv_cxx_cinttypes],[the location of ]) ]) gearmand-1.0.6/m4/ax_count_cpus.m40000664000076400007640000000342412107145705017217 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_count_cpus.html # =========================================================================== # # SYNOPSIS # # AX_COUNT_CPUS # # DESCRIPTION # # Attempt to count the number of processors present on the machine. If the # detection fails, then a value of 1 is assumed. # # The value is placed in the CPU_COUNT variable. # # LICENSE # # Copyright (c) 2012 Brian Aker # Copyright (c) 2008 Michael Paul Bailey # Copyright (c) 2008 Christophe Tournayre # # 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. This file is offered as-is, without any # warranty. #serial 10 AC_DEFUN([AX_COUNT_CPUS],[ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_EGREP]) AC_MSG_CHECKING([the number of available CPUs]) CPU_COUNT="0" AS_CASE([$host_os],[ *darwin*],[ AS_IF([test -x /usr/sbin/sysctl],[ sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu` AS_IF([test sysctl_a],[ CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu` ]) ])],[ *linux*],[ AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo` ]) ]) ]) AS_IF([test "x$CPU_COUNT" = "x0"],[ CPU_COUNT="1" AC_MSG_RESULT( [unable to detect (assuming 1)] ) ],[ AC_MSG_RESULT( $CPU_COUNT ) ]) ]) gearmand-1.0.6/m4/ax_am_macros.m40000664000076400007640000000222712107145705016776 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_am_macros.html # =========================================================================== # # SYNOPSIS # # AX_AM_MACROS # # DESCRIPTION # # Adds support for macros that create Make rules. You must manually add # the following line # # @INC_AMINCLUDE@ # # to your Makefile.in (or Makefile.am if you use Automake) files. # # LICENSE # # Copyright (c) 2009 Tom Howard # # 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. This file is offered as-is, without any # warranty. #serial 9 AC_DEFUN([AX_AM_MACROS], [ AC_MSG_NOTICE([adding automake macro support]) AMINCLUDE="aminclude.am" AC_SUBST(AMINCLUDE) AC_MSG_NOTICE([creating $AMINCLUDE]) AMINCLUDE_TIME=`date` AX_PRINT_TO_FILE([$AMINCLUDE],[[ # generated automatically by configure from AX_AUTOMAKE_MACROS # on $AMINCLUDE_TIME ]]) INC_AMINCLUDE="include \$(top_builddir)/$AMINCLUDE" AC_SUBST(INC_AMINCLUDE) ]) gearmand-1.0.6/m4/pandora_have_libtokyocabinet.m40000664000076400007640000000226512107145705022240 0ustar00brianbrian00000000000000# Copyright (C) 2009 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. # Provides support for finding libtokyocabinet. # # serial 2 AC_DEFUN([_PANDORA_SEARCH_LIBTOKYOCABINET], [AC_REQUIRE([AX_CHECK_LIBRARY]) AS_IF([test "x$ac_enable_libtokyocabinet" = "xyes"], [tokyocabinet_header="tcadb.h"], [tokyocabinet_header="does_not_exist"]) AX_CHECK_LIBRARY([TOKYOCABINET],[$tokyocabinet_header],[tokyocabinet],, [AC_DEFINE([HAVE_TOKYOCABINET],[0],[Define to 1 if TOKYOCABINET is found])]) AS_IF([test "x$ax_cv_have_TOKYOCABINET" = xno],[ac_enable_libtokyocabinet="no"]) ]) AC_DEFUN([PANDORA_HAVE_LIBTOKYOCABINET], [AC_ARG_ENABLE([libtokyocabinet], [AS_HELP_STRING([--disable-libtokyocabinet], [Build with libtokyocabinet support @<:@default=on@:>@])], [ac_enable_libtokyocabinet="$enableval"], [ac_enable_libtokyocabinet="yes"]) _PANDORA_SEARCH_LIBTOKYOCABINET AM_CONDITIONAL([HAVE_TOKYOCABINET],[test "x${ac_enable_libtokyocabinet}" = "xyes"]) ]) gearmand-1.0.6/m4/ax_harden_compiler_flags.m40000664000076400007640000004253612137504377021362 0ustar00brianbrian00000000000000# vim:expandtab:shiftwidth=2:tabstop=2:smarttab: # =========================================================================== # https://github.com/BrianAker/ddm4/ # =========================================================================== # # SYNOPSIS # # AX_HARDEN_COMPILER_FLAGS() AX_HARDEN_LINKER_FLAGS() # # DESCRIPTION # # Any compiler flag that "hardens" or tests code. C99 is assumed. # # NOTE: Implementation based on AX_APPEND_FLAG. # # LICENSE # # Copyright (C) 2012-2013 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. # # Notes: # We do not test for c99 or c++11, that is out of scope. # The Following flags are not checked for # -Wdeclaration-after-statement is counter to C99 # _APPEND_COMPILE_FLAGS_ERROR([-pedantic]) #serial 10 AC_DEFUN([_WARNINGS_AS_ERRORS], [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ac_cv_warnings_as_errors=yes], [ac_cv_warnings_as_errors=no]) ]) ]) # Note: Should this be LIBS or LDFLAGS? AC_DEFUN([_APPEND_LINK_FLAGS_ERROR], [AC_REQUIRE([AX_APPEND_LINK_FLAGS]) AX_APPEND_LINK_FLAGS([$1],[LDFLAGS],[-Werror]) ]) AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR], [AC_REQUIRE([AX_APPEND_COMPILE_FLAGS]) AX_APPEND_COMPILE_FLAGS([$1],,[-Werror]) ]) # Everything above this does the heavy lifting, while what follows does the specifics. AC_DEFUN([_HARDEN_LINKER_FLAGS], [AS_IF([test "$CC" != "clang"], [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],[AX_APPEND_LINK_FLAGS([-Werror])]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[_APPEND_LINK_FLAGS_ERROR([-rdynamic])]) ]) ]) AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], [AC_LANG_PUSH([C])dnl AS_IF([test "x$ax_enable_debug" = xyes], [CFLAGS='' _APPEND_COMPILE_FLAGS_ERROR([-H]) _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O0]), _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) ],[ _APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O2]) ]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) AS_IF([test "$CC" = "clang"],[_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])]) _APPEND_COMPILE_FLAGS_ERROR([-Wall]) _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) _APPEND_COMPILE_FLAGS_ERROR([-Weverything]) _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail]) # Anything below this comment please keep sorted. # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) _APPEND_COMPILE_FLAGS_ERROR([-Wunsuffixed-float-constants]) _APPEND_COMPILE_FLAGS_ERROR([-Wjump-misses-init]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes]) _APPEND_COMPILE_FLAGS_ERROR([-Waddress]) _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs]) _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds]) _APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast]) # Not in use -Wc++-compat _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts]) _APPEND_COMPILE_FLAGS_ERROR([-Wcomment]) _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k]) _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op]) _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized]) _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers]) AS_IF([test "x$MINGW" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])], [_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])]) _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-prototypes]) _APPEND_COMPILE_FLAGS_ERROR([-Wnested-externs]) _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id]) _APPEND_COMPILE_FLAGS_ERROR([-Woverride-init]) _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith]) _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-sign]) AS_IF([test "x$MINGW" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=pure]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])], [_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])]) _APPEND_COMPILE_FLAGS_ERROR([-Wshadow]) _APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32]) _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare]) _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1]) _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes]) _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum]) _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines]) _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) AS_IF([test "x$MINGW" != xyes],[ AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ AS_IF([test "x$enable_shared" = "xyes"],[ _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) ]) ]) ]) _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs]) _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings]) _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all]) _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) _APPEND_COMPILE_FLAGS_ERROR([-pipe]) _APPEND_COMPILE_FLAGS_ERROR([-fPIE -pie]) _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) _APPEND_COMPILE_FLAGS_ERROR([-Wpacked]) # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [AS_IF([test "x${target_os}" != "xmingw"], [AS_IF([test "x$ac_c_gcc_recent" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector --param=ssp-buffer-size=4]) _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) ])])])]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], [AX_APPEND_FLAG([-Werror])]) AC_LANG_POP([C]) ]) AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], [AC_LANG_PUSH([C++]) AC_REQUIRE([_APPEND_COMPILE_FLAGS_ERROR]) AS_IF([test "x$ax_enable_debug" = xyes], [CXXFLAGS='' _APPEND_COMPILE_FLAGS_ERROR([-H]) _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O0]), _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) ],[ _APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O2]) ]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) AS_IF([test "$CXX" = "clang++"],[_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])]) _APPEND_COMPILE_FLAGS_ERROR([-Wall]) _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) _APPEND_COMPILE_FLAGS_ERROR([-Weverything]) _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail]) # Anything below this comment please keep sorted. # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes]) _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs]) _APPEND_COMPILE_FLAGS_ERROR([-Waddress]) _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds]) _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts]) _APPEND_COMPILE_FLAGS_ERROR([-Wcomment]) _APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy]) _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k]) _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized]) _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers]) _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op]) _APPEND_COMPILE_FLAGS_ERROR([-Wnon-virtual-dtor]) _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id]) _APPEND_COMPILE_FLAGS_ERROR([-Woverloaded-virtual]) _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith]) AS_IF([test "x$MINGW" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn]) _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-error=suggest-attribute=noreturn]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])], [_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])]) _APPEND_COMPILE_FLAGS_ERROR([-Wshadow]) _APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32]) _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare]) _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1]) _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum]) _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines]) _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat]) # _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) AS_IF([test "x$MINGW" != xyes],[ AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ AS_IF([test "x$enable_shared" = "xyes"],[ _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) ]) ]) ]) # _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs]) _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security]) _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all]) _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) _APPEND_COMPILE_FLAGS_ERROR([-pipe]) _APPEND_COMPILE_FLAGS_ERROR([-fPIE -pie]) _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) _APPEND_COMPILE_FLAGS_ERROR([-Wpacked]) # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [AS_IF([test "x${target_os}" != "xmingw"], [AS_IF([test "x$ac_c_gcc_recent" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector --param=ssp-buffer-size=4]) _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) ])])])]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], [AX_APPEND_FLAG([-Werror])]) AC_LANG_POP([C++]) ]) # All of the heavy lifting happens in _HARDEN_LINKER_FLAGS, # _HARDEN_CC_COMPILER_FLAGS, _HARDEN_CXX_COMPILER_FLAGS AC_DEFUN([AX_HARDEN_COMPILER_FLAGS], [AC_PREREQ([2.63])dnl AC_REQUIRE([_WARNINGS_AS_ERRORS]) AC_REQUIRE([AX_APPEND_LINK_FLAGS]) AC_REQUIRE([AX_COMPILER_VERSION]) AC_REQUIRE([AX_DEBUG]) AC_REQUIRE([AX_VCS_CHECKOUT]) AC_REQUIRE([gl_VISIBILITY]) AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"]) AC_REQUIRE([_HARDEN_LINKER_FLAGS]) AC_REQUIRE([_HARDEN_CC_COMPILER_FLAGS]) AC_REQUIRE([_HARDEN_CXX_COMPILER_FLAGS]) ]) gearmand-1.0.6/m4/socket_send_flags.m40000664000076400007640000000364712137131133020022 0ustar00brianbrian00000000000000# Copyright (C) 2012-2013 Data Differential LLC # Copyright (C) 2011 Trond Norbye # This file is free software; Trond Norbye and Data Differential # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # --------------------------------------------------------------------------- # Macro: SOCKET_SEND_FLAGS # --------------------------------------------------------------------------- # #serial 2 AC_DEFUN([SOCKET_SEND_FLAGS], [AC_CACHE_CHECK([for MSG_NOSIGNAL],[ac_cv_msg_nosignal], [AC_LANG_PUSH([C]) AX_SAVE_FLAGS CFLAGS="$CFLAGS -I${srcdir}" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [int flags= MSG_NOSIGNAL])], [ac_cv_msg_nosignal="yes"]) AC_LANG_POP AX_RESTORE_FLAGS]) AC_CACHE_CHECK([for MSG_DONTWAIT],[ac_cv_msg_dontwait], [AC_LANG_PUSH([C]) AX_SAVE_FLAGS CFLAGS="$CFLAGS -I${srcdir}" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[int flags= MSG_DONTWAIT])],[ac_cv_msg_dontwait="yes"]) AC_LANG_POP AX_RESTORE_FLAGS]) AC_CACHE_CHECK([for MSG_MORE],[ac_cv_msg_more], [AC_LANG_PUSH([C]) AX_SAVE_FLAGS CFLAGS="$CFLAGS -I${srcdir}" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [int flags= MSG_MORE])], [ac_cv_msg_more="yes"]) AC_LANG_POP AX_RESTORE_FLAGS]) 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])]) AS_IF([test "x$ac_cv_msg_more" = "xyes"],[AC_DEFINE([HAVE_MSG_MORE],[1],[Define to 1 if you have a MSG_MORE])]) ]) # --------------------------------------------------------------------------- # End Macro: SOCKET_SEND_FLAGS # --------------------------------------------------------------------------- gearmand-1.0.6/m4/bottom.m40000664000076400007640000000274312107145705015654 0ustar00brianbrian00000000000000AC_DEFUN([CONFIG_EXTRA], [ AH_TOP([ #pragma once /* _SYS_FEATURE_TESTS_H is Solaris, _FEATURES_H is GCC */ #if defined( _SYS_FEATURE_TESTS_H) || defined(_FEATURES_H) #error "You should include gear_config.h as your first include file" #endif ]) AH_BOTTOM([ /* This seems to be required for older compilers @note http://stackoverflow.com/questions/8132399/how-to-printf-uint64-t */ #ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS #endif #if defined(__cplusplus) # include CINTTYPES_H #else # 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 #define closesocket(a) close(a) #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 ]) ])dnl CONFIG_EXTRA gearmand-1.0.6/m4/have_libpq.m40000664000076400007640000000126012107145705016453 0ustar00brianbrian00000000000000dnl Copyright (C) 2011 Brian Aker (brian@tangent.org) AC_DEFUN([AX_HAVE_LIBPQ],[ AC_ARG_ENABLE([libpq], [AS_HELP_STRING([--disable-libpq], [Build with libpq, ie Postgres, support @<:@default=on@:>@])], [ac_cv_libpq="$enableval"], [ac_cv_libpq="yes"]) AC_REQUIRE([AX_LIB_POSTGRESQL]) AS_IF([test "x$ac_cv_libpq" = "xyes" -a "x$found_postgresql" = "xyes"], [ AC_DEFINE([HAVE_LIBPQ], [ 1 ], [Enable libpq support]) ], [ AC_DEFINE([HAVE_LIBPQ], [ 0 ], [Enable libpq support]) # if --enable-libpq, but no Postgres, force --disable-libpq ac_cv_libpq="no" ]) AM_CONDITIONAL(HAVE_LIBPQ, [test "x$ac_cv_libpq" = "xyes"]) ]) gearmand-1.0.6/m4/ax_memcached.m40000664000076400007640000000605112140642767016751 0ustar00brianbrian00000000000000# vim:expandtab:shiftwidth=2:tabstop=2:smarttab: # =========================================================================== # https://github.com/BrianAker/ddm4/ # =========================================================================== # # SYNOPSIS # # AX_PROG_MEMCACHED # # DESCRIPTION # # Check for memcached and list version # # LICENSE # # Copyright (C) 2013 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. #serial 4 AC_DEFUN([AX_PROG_MEMCACHED], [AX_WITH_PROG([MEMCACHED_BINARY],[memcached],[unknown]) ax_memcached_success= AS_IF([test x"$MEMCACHED_BINARY" != xunknown], [AS_IF([test -x "$MEMCACHED_BINARY"], [ax_memcached_version=`$MEMCACHED_BINARY -h | sed 1q | awk '{print \$ 2 }' | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'` AS_IF([test -n "$ax_memcached_version"], [ax_memcached_success='ok' AC_MSG_RESULT([memcached version "$ax_memcached_version"]) AC_DEFINE_UNQUOTED([MEMCACHED_VERSION],"$ax_memcached_version",[Memcached binary version])]) ]) ]) AS_IF([test -n "$ax_memcached_success"], [AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available]) AC_DEFINE_UNQUOTED([MEMCACHED_BINARY],"$MEMCACHED_BINARY",[Name of the memcached binary used in make test]) ], [AC_DEFINE([HAVE_MEMCACHED_BINARY], [0], [If Memcached binary is available]) MEMCACHED_BINARY= ]) ]) gearmand-1.0.6/m4/ax_cxx_gcc_abi_demangle.m40000664000076400007640000000377312137131133021122 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_cxx_gcc_abi_demangle.html # =========================================================================== # # SYNOPSIS # # AX_CXX_GCC_ABI_DEMANGLE # # DESCRIPTION # # If the compiler supports GCC C++ ABI name demangling (has header # cxxabi.h and abi::__cxa_demangle() function), define # HAVE_GCC_ABI_DEMANGLE # # Adapted from AX_CXX_RTTI by Luc Maisonobe # # LICENSE # # Copyright (c) 2012 Brian Aker # Copyright (c) 2008 Neil Ferguson # # 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. This file is offered as-is, without any # warranty. #serial 10 AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE], [AC_PREREQ([2.63])dnl AC_CACHE_CHECK([whether the compiler supports GCC C++ ABI name demangling], [ax_cv_cxx_gcc_abi_demangle], [AC_LANG_PUSH([C++]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include #include #include #include template class A {};]], [[A instance; #if defined(_WIN32) return EXIT_FAILURE; #endif int status = 0; char* c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status); std::string name(c_name); ::free(c_name); if (name.compare("A") != 0) { return EXIT_FAILURE; }]])], [ax_cv_cxx_gcc_abi_demangle=yes], [ax_cv_cxx_gcc_abi_demangle=no], [ax_cv_cxx_gcc_abi_demangle=no]) AC_LANG_POP]) AC_MSG_CHECKING([checking for cxx_gcc_abi_demangle]) AC_MSG_RESULT(["$ax_cv_cxx_gcc_abi_demangle"]) AS_IF([test "x$ax_cv_cxx_gcc_abi_demangle" = xyes], [AC_DEFINE([HAVE_GCC_ABI_DEMANGLE],[1],[define if the compiler supports GCC C++ ABI name demangling])]) ]) gearmand-1.0.6/m4/ax_append_flag.m40000664000076400007640000000530412107145705017274 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_append_flag.html # =========================================================================== # # SYNOPSIS # # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) # # DESCRIPTION # # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space # added in between. # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly # FLAG. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_APPEND_FLAG], [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl AS_VAR_SET_IF(FLAGS, [case " AS_VAR_GET(FLAGS) " in *" $1 "*) AC_RUN_LOG([: FLAGS already contains $1]) ;; *) AC_RUN_LOG([: FLAGS="$FLAGS $1"]) AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) ;; esac], [AS_VAR_SET(FLAGS,["$1"])]) AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_APPEND_FLAG gearmand-1.0.6/m4/ax_append_link_flags.m40000664000076400007640000000542512107145705020500 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html # =========================================================================== # # SYNOPSIS # # AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) # # DESCRIPTION # # For every FLAG1, FLAG2 it is checked whether the linker works with the # flag. If it does, the flag is added FLAGS-VARIABLE # # If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is # used. During the check the flag is always added to the linker's flags. # # If EXTRA-FLAGS is defined, it is added to the linker's default flags # when the check is done. The check is thus made with the flags: "LDFLAGS # EXTRA-FLAGS FLAG". This can for example be used to force the linker to # issue an error when a bad flag is given. # # NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. # Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. # # LICENSE # # Copyright (c) 2011 Maarten Bosmans # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 3 AC_DEFUN([AX_APPEND_LINK_FLAGS], [AC_REQUIRE([AX_CHECK_LINK_FLAG]) AC_REQUIRE([AX_APPEND_FLAG]) for flag in $1; do AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3]) done ])dnl AX_APPEND_LINK_FLAGS gearmand-1.0.6/m4/fcntl_flags.m40000664000076400007640000000212412107145705016623 0ustar00brianbrian00000000000000dnl Copyright (C) 2012 Data Differential LLC dnl Copyright (C) 2011 Keyur Govande dnl This file is free software; Keyur Govande 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: FCNTL_FLAGS dnl --------------------------------------------------------------------------- AC_DEFUN([FCNTL_FLAGS], [ AC_CACHE_CHECK([for O_CLOEXEC], [ac_cv_o_cloexec], [ AC_LANG_PUSH([C]) save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -I${srcdir}" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ int flags= O_CLOEXEC])], [ac_cv_o_cloexec="yes"], [ac_cv_o_cloexec="no"]) AC_LANG_POP CFLAGS="$save_CFLAGS" ]) AS_IF([test "x$ac_cv_o_cloexec" = "xyes"],[ AC_DEFINE(HAVE_O_CLOEXEC, 1, [Define to 1 if you have O_CLOEXEC defined])]) ]) dnl --------------------------------------------------------------------------- dnl End Macro: FCNTL_FLAGS dnl --------------------------------------------------------------------------- gearmand-1.0.6/m4/ltoptions.m40000644000076400007640000003007312140672515016377 0ustar00brianbrian00000000000000# Helper functions for option handling. -*- Autoconf -*- # # 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 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])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [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], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [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], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [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], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) gearmand-1.0.6/m4/ax_pthread.m40000664000076400007640000003050212107145705016461 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS # # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. It # sets the PTHREAD_LIBS output variable to the threads library and linker # flags, and the PTHREAD_CFLAGS output variable to any special C compiler # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). (This # is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also link it with them as well. e.g. you should link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threads programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name # (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the # PTHREAD_PRIO_INHERIT symbol is defined when compiling with # PTHREAD_CFLAGS. # # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action # will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or if # you have any other suggestions or comments. This macro was based on work # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # # Updated for Autoconf 2.68 by Daniel Richard G. # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2011 Daniel Richard G. # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 19 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_PUSH([C]) ax_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" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) AC_MSG_RESULT($ax_pthread_ok) if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" 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). # 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. ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # 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_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: ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; darwin12*) ax_pthread_flags="$ax_pthread_flags" ;; darwin*) ax_pthread_flags="-pthread $ax_pthread_flags" ;; esac if test x"$ax_pthread_ok" = xno; then for flag in $ax_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) if test x"$ax_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) 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. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; }], [pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */])], [ax_pthread_ok=yes], []) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($ax_pthread_ok) if test "x$ax_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_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. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int attr = $attr; return attr /* ; */])], [attr_name=$attr; break], []) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case ${host_os} in aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; osf* | hpux*) flag="-D_REENTRANT";; solaris*) if test "$GCC" = "yes"; then flag="-D_REENTRANT" else flag="-mt -D_REENTRANT" fi ;; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], ax_cv_PTHREAD_PRIO_INHERIT, [ AC_LINK_IFELSE([ AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$ax_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else ax_pthread_ok=no $2 fi AC_LANG_POP ])dnl AX_PTHREAD gearmand-1.0.6/m4/ax_debug.m40000664000076400007640000000464612107145705016132 0ustar00brianbrian00000000000000# =========================================================================== # https://github.com/BrianAker/ddm4/ # =========================================================================== # # SYNOPSIS # # AX_DEBUG() # # DESCRIPTION # # --enable-debug # # LICENSE # # Copyright (C) 2012 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. #serial 5 AC_DEFUN([AX_DEBUG], [AC_PREREQ([2.63])dnl AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], [ax_enable_debug=yes AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.]) AX_CHECK_LIBRARY([MCHECK],[mcheck.h],[mcheck],[AX_APPEND_LINK_FLAGS([-lmcheck])])], [ax_enable_debug=no AC_SUBST([MCHECK]) AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) AC_MSG_CHECKING([for debug]) AC_MSG_RESULT([$ax_enable_debug]) AM_CONDITIONAL([DEBUG],[test "x${ax_enable_debug}" = "xyes"])]) gearmand-1.0.6/m4/ax_lib_postgresql.m40000664000076400007640000001200712107145705020063 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html # =========================================================================== # # SYNOPSIS # # AX_LIB_POSTGRESQL([MINIMUM-VERSION]) # # DESCRIPTION # # This macro provides tests of availability of PostgreSQL 'libpq' library # of particular version or newer. # # AX_LIB_POSTGRESQL macro takes only one argument which is optional. If # there is no required version passed, then macro does not run version # test. # # The --with-postgresql option takes one of three possible values: # # no - do not check for PostgreSQL client library # # yes - do check for PostgreSQL library in standard locations (pg_config # should be in the PATH) # # path - complete path to pg_config utility, use this option if pg_config # can't be found in the PATH # # This macro calls: # # AC_SUBST(POSTGRESQL_CFLAGS) # AC_SUBST(POSTGRESQL_LDFLAGS) # AC_SUBST(POSTGRESQL_VERSION) # # And sets: # # HAVE_POSTGRESQL # # LICENSE # # Copyright (c) 2008 Mateusz Loskot # # 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. This file is offered as-is, without any # warranty. #serial 11 AC_DEFUN([AX_LIB_POSTGRESQL], [ AC_ARG_WITH([postgresql], AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@], [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config] ), [ if test "$withval" = "no"; then want_postgresql="no" elif test "$withval" = "yes"; then want_postgresql="yes" else want_postgresql="yes" PG_CONFIG="$withval" fi ], [want_postgresql="yes"] ) POSTGRESQL_CFLAGS="" POSTGRESQL_LDFLAGS="" POSTGRESQL_VERSION="" dnl dnl Check PostgreSQL libraries (libpq) dnl if test "$want_postgresql" = "yes"; then if test -z "$PG_CONFIG" -o test; then AC_PATH_PROG([PG_CONFIG], [pg_config], []) fi if test ! -x "$PG_CONFIG"; then AC_MSG_WARN([$PG_CONFIG does not exist or it is not an exectuable file]) PG_CONFIG="no" found_postgresql="no" fi if test "$PG_CONFIG" != "no"; then AC_MSG_CHECKING([for PostgreSQL libraries]) POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`" POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq" POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'` AC_DEFINE([HAVE_POSTGRESQL], [1], [Define to 1 if PostgreSQL libraries are available]) found_postgresql="yes" AC_MSG_RESULT([yes]) else found_postgresql="no" AC_MSG_RESULT([no]) fi fi dnl dnl Check if required version of PostgreSQL is available dnl postgresql_version_req=ifelse([$1], [], [], [$1]) if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then AC_MSG_CHECKING([if PostgreSQL version is >= $postgresql_version_req]) dnl Decompose required version string of PostgreSQL dnl and calculate its number representation postgresql_version_req_major=`expr $postgresql_version_req : '\([[0-9]]*\)'` postgresql_version_req_minor=`expr $postgresql_version_req : '[[0-9]]*\.\([[0-9]]*\)'` postgresql_version_req_micro=`expr $postgresql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$postgresql_version_req_micro" = "x"; then postgresql_version_req_micro="0" fi postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \ \+ $postgresql_version_req_minor \* 1000 \ \+ $postgresql_version_req_micro` dnl Decompose version string of installed PostgreSQL dnl and calculate its number representation postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([[0-9]]*\)'` postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'` postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$postgresql_version_micro" = "x"; then postgresql_version_micro="0" fi postgresql_version_number=`expr $postgresql_version_major \* 1000000 \ \+ $postgresql_version_minor \* 1000 \ \+ $postgresql_version_micro` postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number` if test "$postgresql_version_check" = "1"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi fi AC_SUBST([POSTGRESQL_VERSION]) AC_SUBST([POSTGRESQL_CFLAGS]) AC_SUBST([POSTGRESQL_LDFLAGS]) ]) gearmand-1.0.6/m4/ltversion.m40000644000076400007640000000126212140672516016370 0ustar00brianbrian00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 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. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) gearmand-1.0.6/m4/libtool.m40000644000076400007640000105743212140672515016021 0ustar00brianbrian00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # 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. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ 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 m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl 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]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- 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([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _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' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # 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 "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$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)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # 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 sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS 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 lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _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 # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # 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. 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 # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) 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 # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [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 -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; 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' ;; 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 # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported 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\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) 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 ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then 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}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # 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], [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 # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac 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" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. 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 *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_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 # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -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:$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:$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 "$_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 fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" 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>&AS_MESSAGE_LOG_FD $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 fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). 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. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # 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"`env 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` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* 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)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -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:$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:$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 "$_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 fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl 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], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac 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 '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= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ 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 ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # 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]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; 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=`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 ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in 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}' 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}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. 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 # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor 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 need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # 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]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' 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 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 # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # 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;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 # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor 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=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor 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=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. 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], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl 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], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) 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 AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [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 &1 /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 # 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*) # 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' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) 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 ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' 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])(-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_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. 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" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl 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:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&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:$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" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then 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, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- 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 m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF 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 # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # 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. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; 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 # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; 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' ;; *) case `$CC -V 2>&1 | sed 5q` in *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)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in 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' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _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 # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _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 ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; 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,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; 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\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # 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)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *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)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in 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") || (\$ 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 ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; 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}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= 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 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** 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 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 ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _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 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no 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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _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 | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' 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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; 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' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; 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; 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 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$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~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in 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)='${wl}-rpath ${wl}$libdir' _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 $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" 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") || (\$ 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 aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _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 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' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -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' 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' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # 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 $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # 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 `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. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${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' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) 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' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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 if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_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' # 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. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_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 ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _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' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _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(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" && 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" && 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' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; 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} $pic_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" && 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 "-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' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _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' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _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' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # 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_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 ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_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_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _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], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])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 _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _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 # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # 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 -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _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 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' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -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' 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' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # 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 $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _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 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; 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)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _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' ;; irix5* | irix6*) 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" && 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 # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -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 $pic_flag -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 ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *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 | 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 | 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 | 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 | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # 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' ;; esac _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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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=`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* | 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' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$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~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _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; 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='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _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=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) 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" && 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" && 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 "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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=`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" && 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 $pic_flag -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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # 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 -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in 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' _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)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes 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 # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # 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 -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # 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 -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in 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(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in 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' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in 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 # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _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_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)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _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 # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _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_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)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _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 # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _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 ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _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 ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS gearmand-1.0.6/m4/ax_append_to_file.m40000664000076400007640000000137512107145705020010 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_append_to_file.html # =========================================================================== # # SYNOPSIS # # AX_APPEND_TO_FILE([FILE],[DATA]) # # DESCRIPTION # # Appends the specified data to the specified file. # # LICENSE # # Copyright (c) 2008 Tom Howard # # 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. This file is offered as-is, without any # warranty. #serial 7 AC_DEFUN([AX_APPEND_TO_FILE],[ AC_REQUIRE([AX_FILE_ESCAPES]) printf "$2" >> "$1" ]) gearmand-1.0.6/m4/libdrizzle.m40000664000076400007640000000112012107145705016506 0ustar00brianbrian00000000000000# serial 1 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"], [AX_CHECK_LIBRARY([LIBDRIZZLE],[libdrizzle-5.1/drizzle_client.h],[drizzle],, [AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Have libdrizzle])])], [AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Have libdrizzle])]) ]) AC_DEFUN([WITH_LIBDRIZZLE], [ AC_REQUIRE([_WITH_LIBDRIZZLE]) ]) gearmand-1.0.6/m4/pandora_enable_dtrace.m40000664000076400007640000000436612107145705020627 0ustar00brianbrian00000000000000dnl 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 --------------------------------------------------------------------------- dnl Macro: PANDORA_ENABLE_DTRACE dnl --------------------------------------------------------------------------- AC_DEFUN([PANDORA_ENABLE_DTRACE],[ AC_ARG_ENABLE([dtrace], [AS_HELP_STRING([--enable-dtrace], [Build with support for the DTRACE. @<:@default=no@:>@])], [ac_cv_enable_dtrace="$enableval"], [ac_cv_enable_dtrace="no"]) AS_IF([test "$ac_cv_enable_dtrace" = "yes"],[ AC_CHECK_PROGS([DTRACE], [dtrace]) 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], [ac_cv_dtrace_needs_objects=no]) 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_dtrace_works" = "xyes"]) AM_CONDITIONAL([DTRACE_NEEDS_OBJECTS], [test "x$ac_cv_dtrace_needs_objects" = "xyes"]) ]) dnl --------------------------------------------------------------------------- dnl End Macro: PANDORA_ENABLE_DTRACE dnl --------------------------------------------------------------------------- gearmand-1.0.6/m4/ax_path_generic.m40000664000076400007640000001262512107145705017470 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_path_generic.html # =========================================================================== # # SYNOPSIS # # AX_PATH_GENERIC(LIBRARY,[MINIMUM-VERSION,[SED-EXPR-EXTRACTOR]],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[CONFIG-SCRIPTS],[CFLAGS-ARG],[LIBS-ARG]) # # DESCRIPTION # # Runs the LIBRARY-config script and defines LIBRARY_CFLAGS and # LIBRARY_LIBS unless the user had predefined them in the environment. # # The script must support `--cflags' and `--libs' args. If MINIMUM-VERSION # is specified, the script must also support the `--version' arg. If the # `--with-library-[exec-]prefix' arguments to ./configure are given, it # must also support `--prefix' and `--exec-prefix'. Prefereable use # CONFIG-SCRIPTS as config script, CFLAGS-ARG instead of `--cflags` and # LIBS-ARG instead of `--libs`, if given. # # The SED-EXPR-EXTRACTOR parameter representes the expression used in sed # to extract the version number. Use it if your 'foo-config --version' # dumps something like 'Foo library v1.0.0 (alfa)' instead of '1.0.0'. # # The macro respects LIBRARY_CONFIG, LIBRARY_CFLAGS and LIBRARY_LIBS # variables. If the first one is defined, it specifies the name of the # config script to use. If the latter two are defined, the script is not # ran at all and their values are used instead (if only one of them is # defined, the empty value of the remaining one is still used). # # Example: # # AX_PATH_GENERIC(Foo, 1.0.0) # # would run `foo-config --version' and check that it is at least 1.0.0, if # successful the following variables would be defined and substituted: # # FOO_CFLAGS to `foo-config --cflags` # FOO_LIBS to `foo-config --libs` # # Example: # # AX_PATH_GENERIC([Bar],,,[ # AC_MSG_ERROR([Cannot find Bar library]) # ]) # # would check for bar-config program, defining and substituting the # following variables: # # BAR_CFLAGS to `bar-config --cflags` # BAR_LIBS to `bar-config --libs` # # Example: # # ./configure BAZ_LIBS=/usr/lib/libbaz.a # # would link with a static version of baz library even if `baz-config # --libs` returns just "-lbaz" that would normally result in using the # shared library. # # This macro is a rearranged version of AC_PATH_GENERIC from Angus Lees. # # LICENSE # # Copyright (c) 2009 Francesco Salvestrini # # 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. This file is offered as-is, without any # warranty. #serial 11 AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC]) AC_DEFUN([AX_PATH_GENERIC],[ AC_REQUIRE([AC_PROG_SED]) dnl we're going to need uppercase and lowercase versions of the dnl string `LIBRARY' pushdef([UP], translit([$1], [a-z], [A-Z]))dnl pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl AC_ARG_WITH(DOWN-prefix,[AS_HELP_STRING([--with-]DOWN[-prefix=PREFIX], [Prefix where $1 is installed (optional)])], DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") AC_ARG_WITH(DOWN-exec-prefix,[AS_HELP_STRING([--with-]DOWN[-exec-prefix=EPREFIX], [Exec prefix where $1 is installed (optional)])], DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") AC_ARG_VAR(UP[]_CONFIG, [config script used for $1]) AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1]) AC_ARG_VAR(UP[]_LIBS, [LIBS used for $1]) AS_IF([test x$UP[]_CFLAGS != x -o x$UP[]_LIBS != x],[ dnl Don't run config script at all, use user-provided values instead. AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_LIBS) : $4 ],[ AS_IF([test x$DOWN[]_config_exec_prefix != x],[ DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" AS_IF([test x${UP[]_CONFIG+set} != xset],[ UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config ]) ]) AS_IF([test x$DOWN[]_config_prefix != x],[ DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" AS_IF([test x${UP[]_CONFIG+set} != xset],[ UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config ]) ]) AC_PATH_PROGS(UP[]_CONFIG,[$6 DOWN-config],[no]) AS_IF([test "$UP[]_CONFIG" == "no"],[ : $5 ],[ dnl Get the CFLAGS from LIBRARY-config script AS_IF([test x"$7" == x],[ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" ],[ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args $7`" ]) dnl Get the LIBS from LIBRARY-config script AS_IF([test x"$8" == x],[ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" ],[ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args $8`" ]) AS_IF([test x"$2" != x],[ dnl Check for provided library version AS_IF([test x"$3" != x],[ dnl Use provided sed expression DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e $3`" ],[ DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`" ]) AC_MSG_CHECKING([for $1 ($DOWN[]_version) >= $2]) AX_COMPARE_VERSION($DOWN[]_version,[ge],[$2],[ AC_MSG_RESULT([yes]) AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_LIBS) : $4 ],[ AC_MSG_RESULT([no]) : $5 ]) ],[ AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_LIBS) : $4 ]) ]) ]) popdef([UP]) popdef([DOWN]) ]) gearmand-1.0.6/m4/ax_append_compile_flags.m40000664000076400007640000000551112107145705021167 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html # =========================================================================== # # SYNOPSIS # # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) # # DESCRIPTION # # For every FLAG1, FLAG2 it is checked whether the compiler works with the # flag. If it does, the flag is added FLAGS-VARIABLE # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. During the check the flag is always added to the # current language's flags. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # NOTE: This macro depends on the AX_APPEND_FLAG and # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with # AX_APPEND_LINK_FLAGS. # # LICENSE # # Copyright (c) 2011 Maarten Bosmans # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 3 AC_DEFUN([AX_APPEND_COMPILE_FLAGS], [AC_REQUIRE([AX_CHECK_COMPILE_FLAG]) AC_REQUIRE([AX_APPEND_FLAG]) for flag in $1; do AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3]) done ])dnl AX_APPEND_COMPILE_FLAGS gearmand-1.0.6/m4/boost.m40000664000076400007640000012655212107145705015503 0ustar00brianbrian00000000000000# 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], [AS_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_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_CHRONO() # ------------------ # Look for Boost.Chrono BOOST_DEFUN([Chrono], [# 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([chrono], [$1], [boost/chrono.hpp], [boost::chrono::thread_clock d;]) 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_CHRONO # 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_LOG([PREFERRED-RT-OPT]) # ----------------------------- # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the # documentation of BOOST_FIND_LIB above. BOOST_DEFUN([Log], [BOOST_FIND_LIB([log], [$1], [boost/log/core/core.hpp], [boost::log::attribute a; a.get_value();]) ])# BOOST_LOG # BOOST_LOG_SETUP([PREFERRED-RT-OPT]) # ----------------------------------- # Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the # documentation of BOOST_FIND_LIB above. BOOST_DEFUN([Log_Setup], [AC_REQUIRE([BOOST_LOG])dnl BOOST_FIND_LIB([log_setup], [$1], [boost/log/utility/init/from_settings.hpp], [boost::log::basic_settings bs; bs.empty();]) ])# BOOST_LOG_SETUP # 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_SERIALIZATION # 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_LDFLAGS=$LDFLAGS boost_threads_save_CPPFLAGS=$CPPFLAGS # Link-time dependency from thread to system was added as of 1.49.0. if test $boost_major_version -ge 149; then BOOST_SYSTEM([$1]) fi # end of the Boost.System check. m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag" LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" # 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" # When compiling for the Windows platform, the threads library is named # differently. case $host_os in (*mingw*) BOOST_FIND_LIB([thread_win32], [$1], [boost/thread.hpp], [boost::thread t; boost::mutex m;]) BOOST_THREAD_LDFLAGS=$BOOST_THREAD_WIN32_LDFLAGS BOOST_THREAD_LDPATH=$BOOST_THREAD_WIN32_LDPATH BOOST_THREAD_LIBS=$BOOST_THREAD_WIN32_LIBS ;; (*) BOOST_FIND_LIB([thread], [$1], [boost/thread.hpp], [boost::thread t; boost::mutex m;]) ;; esac BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag" BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS" BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" LIBS=$boost_threads_save_LIBS LDFLAGS=$boost_threads_save_LDFLAGS 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, 8) \ _BOOST_gcc_test(4, 7) \ _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: gearmand-1.0.6/m4/lt~obsolete.m40000644000076400007640000001375612140672516016730 0ustar00brianbrian00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # 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 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 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_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])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 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])]) gearmand-1.0.6/m4/ax_uuid.m40000664000076400007640000001023712137131133015774 0ustar00brianbrian00000000000000# vim:expandtab:shiftwidth=2:tabstop=2:smarttab: # =========================================================================== # https://github.com/BrianAker/ddm4 # =========================================================================== # # SYNOPSIS # # AX_UUID() # AX_UUID_GENERATE_TIME() # AX_UUID_GENERATE_TIME_SAFE() # # DESCRIPTION # # Check for uuid, uuid_generate_time, and uuid_generate_time_safe support. # # LICENSE # # Copyright (c) 2012-2013 Brian Aker # # 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. This file is offered as-is, without any # warranty. #serial 7 AC_DEFUN([AX_UUID], [AC_PREREQ([2.63])dnl AC_CHECK_HEADER([uuid/uuid.h],[ AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_is_required], [AC_LANG_PUSH([C]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([#include ], [ uuid_t out; uuid_generate(out); ])], [ax_cv_libuuid_is_required=no], [ax_cv_libuuid_is_required=yes], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP ]) AS_IF([test "$ax_cv_libuuid_is_required" = yes], [AC_CACHE_CHECK([check to see if -luuid is needed], [ax_cv_libuuid_works], [AX_SAVE_FLAGS LIBS="-luuid $LIBS" AC_LANG_PUSH([C]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([#include ], [ uuid_t out; uuid_generate(out); ])], [ax_cv_libuuid_works=yes], [ax_cv_libuuid_works=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP AX_RESTORE_FLAGS]) ]) AS_IF([test "$ax_cv_libuuid_is_required" = yes], [AS_IF([test "$ax_cv_libuuid_works" = yes],[ax_libuuid=yes])], [ax_libuuid=yes]) ],[ax_libuuid=no]) AS_IF([test "x$ax_libuuid" = xyes], [AC_DEFINE([HAVE_UUID_UUID_H],[1],[Have uuid/uuid.h]) AS_IF([test "x$ax_cv_libuuid_is_required" = xyes],[ LIBUUID_LIB='-luuid' ])], [AC_DEFINE([HAVE_UUID_UUID_H],[0],[Have uuid/uuid.h]) ]) AC_SUBST([LIBUUID_LIB]) AM_CONDITIONAL([HAVE_LIBUUID],[test "x$ax_libuuid" = xyes]) ]) AC_DEFUN([AX_UUID_GENERATE_TIME], [AC_PREREQ([2.63])dnl AC_REQUIRE([AX_UUID])dnl AC_CACHE_CHECK([for uuid_generate_time], [ax_cv_uuid_generate_time], [AX_SAVE_FLAGS LIBS="$LIBUUID_LIB $LIBS" AC_LANG_PUSH([C]) AC_RUN_IFELSE([ AC_LANG_PROGRAM([#include ],[ uuid_t out; uuid_generate_time(out); ])], [ax_cv_uuid_generate_time=yes], [ax_cv_uuid_generate_time=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP AX_RESTORE_FLAGS ]) AS_IF([test "$ax_cv_uuid_generate_time" = yes], [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[1],[Define if uuid_generate_time is present in uuid/uuid.h.])], [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[0],[Define if uuid_generate_time is present in uuid/uuid.h.])]) ]) AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [AC_PREREQ([2.63])dnl AC_REQUIRE([AX_UUID])dnl AC_CACHE_CHECK([for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [AX_SAVE_FLAGS LIBS="$LIBUUID_LIB $LIBS" AC_LANG_PUSH([C]) AC_RUN_IFELSE([ AC_LANG_PROGRAM([#include ],[ uuid_t out; uuid_generate_time_safe(out); ])], [ax_cv_uuid_generate_time_safe=yes], [ax_cv_uuid_generate_time_safe=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP AX_RESTORE_FLAGS ]) AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes], [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])], [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])]) ]) gearmand-1.0.6/m4/visibility.m40000664000076400007640000000642612107145705016541 0ustar00brianbrian00000000000000# visibility.m4 serial 4 (gettext-0.18.2) dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Tests whether the compiler supports the command-line option dnl -fvisibility=hidden and the function and variable attributes dnl __attribute__((__visibility__("hidden"))) and dnl __attribute__((__visibility__("default"))). dnl Does *not* test for __visibility__("protected") - which has tricky dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on dnl MacOS X. dnl Does *not* test for __visibility__("internal") - which has processor dnl dependent semantics. dnl Does *not* test for #pragma GCC visibility push(hidden) - which is dnl "really only recommended for legacy code". dnl Set the variable CFLAG_VISIBILITY. dnl Defines and sets the variable HAVE_VISIBILITY. AC_DEFUN([gl_VISIBILITY], [ AC_REQUIRE([AC_PROG_CC]) CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then dnl First, check whether -Werror can be added to the command line, or dnl whether it leads to an error because of some other option that the dnl user has put into $CC $CFLAGS $CPPFLAGS. AC_MSG_CHECKING([whether the -Werror option is usable]) AC_CACHE_VAL([gl_cv_cc_vis_werror], [ gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[]])], [gl_cv_cc_vis_werror=yes], [gl_cv_cc_vis_werror=no]) CFLAGS="$gl_save_CFLAGS"]) AC_MSG_RESULT([$gl_cv_cc_vis_werror]) dnl Now check whether visibility declarations are supported. AC_MSG_CHECKING([for simple visibility declarations]) AC_CACHE_VAL([gl_cv_cc_visibility], [ gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" dnl We use the option -Werror and a function dummyfunc, because on some dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning dnl "visibility attribute not supported in this configuration; ignored" dnl at the first function definition in every compilation unit, and we dnl don't want to use the option in this case. if test $gl_cv_cc_vis_werror = yes; then CFLAGS="$CFLAGS -Werror" fi AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[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); void dummyfunc (void) {} ]], [[]])], [gl_cv_cc_visibility=yes], [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" HAVE_VISIBILITY=1 fi fi AC_SUBST([CFLAG_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.]) ]) gearmand-1.0.6/m4/ax_check_library.m40000664000076400007640000000747212107145705017645 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_library.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_LIBRARY(VARIABLE-PREFIX, HEADER-FILE, LIBRARY-FILE, # [ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND]) # # DESCRIPTION # # Provides a generic test for a given library, similar in concept to the # PKG_CHECK_MODULES macro used by pkg-config. # # Most simplest libraries can be checked against simply through the # presence of a header file and a library to link to. This macro allows to # wrap around the test so that it doesn't have to be recreated each time. # # Rather than define --with-$LIBRARY arguments, it uses variables in the # same way that PKG_CHECK_MODULES does. It doesn't, though, use the same # names, since you shouldn't provide a value for LIBS or CFLAGS but rather # for LDFLAGS and CPPFLAGS, to tell the linker and compiler where to find # libraries and headers respectively. # # If the library is find, HAVE_PREFIX is defined, and in all cases # PREFIX_LDFLAGS and PREFIX_CPPFLAGS are substituted. # # Example: # # AX_CHECK_LIBRARY([LIBEVENT], [event.h], [event], [], # [AC_MSG_ERROR([Unable to find libevent])]) # # LICENSE # # Copyright (c) 2012 Brian Aker # Copyright (c) 2010 Diego Elio Petteno` # # 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. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 7 AC_DEFUN([AX_CHECK_LIBRARY], [AC_ARG_VAR($1[_CPPFLAGS],[C preprocessor flags for ]$1[ headers]) AC_ARG_VAR($1[_LDFLAGS],[linker flags for ]$1[ libraries]) AC_CACHE_VAL(AS_TR_SH([ax_cv_have_]$1), [AX_SAVE_FLAGS AS_IF([test "x$]$1[_CPPFLAGS" != "x"], [CPPFLAGS="$CPPFLAGS $]$1[_CPPFLAGS"]) AS_IF([test "x$]$1[_LDFLAGS" != "x"], [LDFLAGS="$LDFLAGS $]$1[_LDFLAGS"]) AC_CHECK_HEADER($2, [ AC_CHECK_LIB($3, [main], [AS_TR_SH([ax_cv_have_]$1)=yes], [AS_TR_SH([ax_cv_have_]$1)=no]) ], [AS_TR_SH([ax_cv_have_]$1)=no]) AX_RESTORE_FLAGS ]) AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"], [AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found]) AC_SUBST($1[_CPPFLAGS]) AC_SUBST($1[_LDFLAGS]) AC_SUBST($1[_LIB],[-l]$3) ifelse([$4], , :, [$4])], [ifelse([$5], , :, [$5])]) ]) gearmand-1.0.6/m4/ax_libmemcached.m40000664000076400007640000001247612107145705017441 0ustar00brianbrian00000000000000# =========================================================================== # https//libmemcached.org/ # =========================================================================== # # SYNOPSIS # # AX_LIBMEMCACHED, AX_LIBMEMCACHED_UTIL, AX_ENABLE_LIBMEMCACHED # # DESCRIPTION # # Checked for installation of libmemcached # # AC_SUBST(LIBMEMCACHED_CFLAGS) # AC_SUBST(LIBMEMCACHED_LIB) # AC_SUBST(LIBMEMCACHED_UTIL_LIB) # # NOTE: Implementation uses AC_CHECK_HEADER. # # LICENSE # # Copyright (C) 2012 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. #serial 2 AC_DEFUN([AX_LIBMEMCACHED], [ AC_CHECK_HEADER([libmemcached-1.0/memcached.h], [ AC_CACHE_CHECK([check for -lmemcached], [ax_cv_libmemcached], [ AC_LANG_PUSH([C]) AX_SAVE_FLAGS LIBS="-lmemcached $LIBS" AC_RUN_IFELSE([ AC_LANG_PROGRAM([#include ], [ memcached_st *memc; memc= memcached(NULL, 0); memcached_free(memc); ])], [ax_cv_libmemcached=yes], [ax_cv_libmemcached=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP AX_RESTORE_FLAGS ]) ]) AS_IF([test "x$ax_cv_libmemcached" = "xyes"], [ AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [1], [Have libmemcached-1.0/memcached.h]) ],[ AC_DEFINE([HAVE_LIBMEMCACHED_MEMCACHED_H], [0], [Have libmemcached-1.0/memcached.h]) ]) ]) AC_DEFUN([AX_LIBMEMCACHED_UTIL], [ AC_REQUIRE([AX_LIBMEMCACHED]) AS_IF([test "$ax_cv_libmemcached" = yes], [ AC_CHECK_HEADER([libmemcachedutil-1.0/util.h], [ AC_CACHE_CHECK([check for -lmemcachedutil], [ax_cv_libmemcached_util], [ AX_SAVE_FLAGS AC_LANG_PUSH([C]) LIBS="-lmemcachedutil -lmemcached $LIBS" AC_RUN_IFELSE([ AC_LANG_PROGRAM([#include ], [ memcached_pool_st *memc_pool= memcached_pool_create(NULL, 0, 3); memcached_pool_destroy(memc_pool); ])], [ax_cv_libmemcached_util=yes], [ax_cv_libmemcached_util=no], [AC_MSG_WARN([test program execution failed])]) AC_LANG_POP AX_RESTORE_FLAGS ]) ]) ]) AS_IF([test "x$ax_cv_libmemcached_util" = "xyes"], [ AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [1], [Have libmemcachedutil-1.0/util.h]) ],[ AC_DEFINE([HAVE_LIBMEMCACHED_UTIL_H], [0], [Have libmemcachedutil-1.0/util.h]) ]) ]) AC_DEFUN([_ENABLE_LIBMEMCACHED], [ AC_REQUIRE([AX_LIBMEMCACHED_UTIL]) AC_ARG_ENABLE([libmemcached], [AS_HELP_STRING([--disable-libmemcached], [Build with libmemcached support @<:@default=on@:>@])], [ax_enable_libmemcached="$enableval"], [ax_enable_libmemcached="yes"]) AS_IF([test "x$ax_cv_libmemcached" != "xyes"], [ ax_enable_libmemcached="not found" ]) AS_IF([test "x$ax_enable_libmemcached" = "xyes"], [ AC_DEFINE([HAVE_LIBMEMCACHED], [1], [Enable libmemcached support]) LIBMEMCACHED_CFLAGS= AC_SUBST([LIBMEMCACHED_CFLAGS]) LIBMEMCACHED_LIB="-lmemcached" AC_SUBST([LIBMEMCACHED_LIB]) AS_IF([test "x$ax_cv_libmemcached_util" = "xyes"], [ LIBMEMCACHED_UTIL_LIB="-lmemcached -lmemcachedutil" AC_SUBST([LIBMEMCACHED_UTIL_LIB]) ]) ],[ AC_DEFINE([HAVE_LIBMEMCACHED], [0], [Enable libmemcached support]) ]) AM_CONDITIONAL(HAVE_LIBMEMCACHED, test "x${ax_enable_libmemcached}" = "xyes") ]) AC_DEFUN([AX_ENABLE_LIBMEMCACHED], [ AC_REQUIRE([_ENABLE_LIBMEMCACHED]) ]) gearmand-1.0.6/rpm.am0000664000076400007640000000223112107145705014673 0ustar00brianbrian00000000000000# vim:ft=automake rpm-build: support/$(PACKAGE).spec clean-rpm $(MAKE) $(AM_MAKEFLAGS) dist @rm -f *.rpm @rm -f ~/rpmbuild/RPMS/x86_64/$(PACKAGE)-$(VERSION)*.rpm @rm -f ~/rpmbuild/SRPMS/$(PACKAGE)-$(VERSION)*.rpm @mkdir -p ~/rpmbuild/BUILD/ @mkdir -p ~/rpmbuild/RPMS/i386/ @mkdir -p ~/rpmbuild/RPMS/i686/ @mkdir -p ~/rpmbuild/RPMS/noarch/ @mkdir -p ~/rpmbuild/RPMS/x86_64/ @mkdir -p ~/rpmbuild/SOURCES/ @mkdir -p ~/rpmbuild/SPECS/ @mkdir -p ~/rpmbuild/SRPMS/ @cp $(PACKAGE)-$(VERSION).tar.gz ~/rpmbuild/SOURCES/ @cp support/$(PACKAGE).init ~/rpmbuild/SOURCES/ @rpmbuild -ba support/$(PACKAGE).spec @cp ~/rpmbuild/RPMS/x86_64/$(PACKAGE)-$(VERSION)*.rpm . @cp ~/rpmbuild/RPMS/x86_64/$(PACKAGE)-devel-$(VERSION)*.rpm . -cp ~/rpmbuild/RPMS/x86_64/$(PACKAGE)-debuginfo-$(VERSION)*.rpm . @cp ~/rpmbuild/RPMS/x86_64/$(PACKAGE)-server-$(VERSION)*.rpm . @cp ~/rpmbuild/SRPMS/$(PACKAGE)-$(VERSION)*.rpm . rpm-sign: rpm-build @rpm --addsign *.rpm @rpm --checksig *.rpm clean-rpm: @rm -f *.tar.gz @rm -f *.src.rpm @rm -f *.rpm rpm: clean-rpm support/$(PACKAGE).spec rpm-build release: rpm rpm-sign auto-rpmbuild: @auto-br-rpmbuild -ba support/gearmand.spec gearmand-1.0.6/man/0000775000076400007640000000000012142673673014344 5ustar00brianbrian00000000000000gearmand-1.0.6/man/gearman_client_options.30000664000076400007640000000557212142673663021163 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .INDENT 0.0 .TP .B GEARMAN_CLIENT_GENERATE_UNIQUE .UNINDENT .sp Generate a unique id for each task created by generating a UUID. .SH RETURN VALUE .sp Various .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_servers.30000664000076400007640000000451112142673662021760 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_SERVERS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_add_server(gearman_client_st\fI\ *client\fP, const char\fI\ *host\fP, in_port_t\fI\ port\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_add_servers(gearman_client_st\fI\ *client\fP, const char\fI\ *servers\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_remove_servers(gearman_client_st\fI\ *client\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the client will take work from. .sp \fI\%gearman_client_remove_servers()\fP will remove all servers from the \fBgearman_client_st\fP. .sp \fI\%gearman_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 \fI\%gearman_client_add_server()\fP and \fI\%gearman_client_remove_servers()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_created_fn.30000664000076400007640000001054012142673662022423 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_CREATED_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_take_workload.30000664000076400007640000001052312142673664021603 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_TAKE_WORKLOAD" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_task_context_free_fn.30000664000076400007640000001000012142673663024513 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_TASK_CONTEXT_FREE_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_verbose_t.30000664000076400007640000000365312142673666020123 0ustar00brianbrian00000000000000.TH "GEARMAN_VERBOSE_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_verbose_t .UNINDENT .INDENT 0.0 .TP .B const char *gearman_verbose_name(\fI\%gearman_verbose_t\fP\fI\ verbose\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_verbose_name()\fP takes a \fI\%gearman_verbose_t\fP and returns a character representation of it. .sp Possible values of \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_return_t.30000664000076400007640000002125512142673665017772 0ustar00brianbrian00000000000000.TH "GEARMAN_RETURN_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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_worker_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 .UNINDENT .INDENT 0.0 .TP .B GEARMAN_FAIL The function failed to complete the job. \fI\%GEARMAN_FATAL\fP is the deprecated name for \fI\%GEARMAN_FAIL\fP .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 .INDENT 0.0 .TP .B GEARMAN_UNKNOWN_OPTION Default state of task return value. .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 .SS DEPRECATED .INDENT 0.0 .TP .B GEARMAN_IGNORE_PACKET .UNINDENT .INDENT 0.0 .TP .B GEARMAN_MAX_RETURN .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_function_exist.30000664000076400007640000001021112142673667022552 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_FUNCTION_EXIST" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_low_background.30000664000076400007640000001002612142673663023140 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_LOW_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_priority_t .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_do_background(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, char\fI\ *job_handle\fP) .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\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, gearman_job_handle_t\fI\ job_handle\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_do_low_background(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, gearman_job_handle_t\fI\ job_handle\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_do_background()\fP executes a single request to the gearmand server and returns the status via \fBgearman_return_t\fP. .sp \fBgearman_client_add_task_high_background()\fP and \fBgearman_client_add_task_low_background()\fP are identical to \fI\%gearman_client_do_background()\fP, only they set the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_memory_allocators.30000664000076400007640000000456712142673662024100 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_MEMORY_ALLOCATORS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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\fI\ *\fP, \fI\%gearman_malloc_fn\fP\fI\ *malloc_fn\fP, \fI\%gearman_free_fn\fP\fI\ *free_fn\fP, \fI\%gearman_realloc_fn\fP\fI\ *realloc_fn\fP, \fI\%gearman_calloc_fn\fP\fI\ *calloc_fn\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st\fI\ *\fP, \fI\%gearman_malloc_fn\fP\fI\ *malloc_fn\fP, \fI\%gearman_free_fn\fP\fI\ *free_fn\fP, \fI\%gearman_realloc_fn\fP\fI\ *realloc_fn\fP, \fI\%gearman_calloc_fn\fP\fI\ *calloc_fn\fP, void\fI\ *context\fP) .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 \fI\%gearman_client_set_memory_allocators()\fP and \fI\%gearman_worker_set_memory_allocators()\fP to set your own custom allocators. .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_run_tasks.30000664000076400007640000000400512142673663021467 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_RUN_TASKS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_run_tasks(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_parse_servers.30000664000076400007640000000336212142673664021011 0ustar00brianbrian00000000000000.TH "GEARMAN_PARSE_SERVERS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_parse_server_fn .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_parse_servers(const char\fI\ *servers\fP, \fI\%gearman_parse_server_fn\fP\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_parse_servers()\fP parses a list of servers and call the \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_allocator_t.30000664000076400007640000000452512142673662020431 0ustar00brianbrian00000000000000.TH "GEARMAN_ALLOCATOR_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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\fI\ *\fP, \fI\%gearman_malloc_fn\fP\fI\ *malloc_fn\fP, \fI\%gearman_free_fn\fP\fI\ *free_fn\fP, \fI\%gearman_realloc_fn\fP\fI\ *realloc_fn\fP, \fI\%gearman_calloc_fn\fP\fI\ *calloc_fn\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st\fI\ *\fP, \fI\%gearman_malloc_fn\fP\fI\ *malloc_fn\fP, \fI\%gearman_free_fn\fP\fI\ *free_fn\fP, \fI\%gearman_realloc_fn\fP\fI\ *realloc_fn\fP, \fI\%gearman_calloc_fn\fP\fI\ *calloc_fn\fP, void\fI\ *context\fP) .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 \fI\%gearman_client_set_memory_allocators()\fP and \fI\%gearman_worker_set_memory_allocators()\fP to set your own custom allocators. .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/include.am0000664000076400007640000001664312137424056016311 0ustar00brianbrian00000000000000# vim:ft=automake # included from Top Level Makefile.am # All paths should be given relative to the root # Build rule for documentation $(dist_man_MANS): $(top_srcdir)/configure.ac $(MAKE) $(AM_MAKEFLAGS) man .NOTPARALLEL: $(dist_man_MANS) dist_man_MANS+= man/gearadmin.1 dist_man_MANS+= man/gearman.1 dist_man_MANS+= man/gearmand.8 dist_man_MANS+= man/gearman_allocator_t.3 dist_man_MANS+= man/gearman_client_set_memory_allocators.3 dist_man_MANS+= man/gearman_worker_set_memory_allocators.3 dist_man_MANS+= man/gearman_actions_t.3 dist_man_MANS+= man/gearman_argument_make.3 dist_man_MANS+= man/gearman_argument_t.3 dist_man_MANS+= man/gearman_bugreport.3 dist_man_MANS+= man/gearman_client_add_options.3 dist_man_MANS+= man/gearman_client_add_server.3 dist_man_MANS+= man/gearman_client_add_servers.3 dist_man_MANS+= man/gearman_client_add_task.3 dist_man_MANS+= man/gearman_client_add_task_background.3 dist_man_MANS+= man/gearman_client_add_task_high.3 dist_man_MANS+= man/gearman_client_add_task_high_background.3 dist_man_MANS+= man/gearman_client_add_task_low.3 dist_man_MANS+= man/gearman_client_add_task_low_background.3 dist_man_MANS+= man/gearman_client_add_task_status.3 dist_man_MANS+= man/gearman_client_clear_fn.3 dist_man_MANS+= man/gearman_client_clone.3 dist_man_MANS+= man/gearman_client_context.3 dist_man_MANS+= man/gearman_client_create.3 dist_man_MANS+= man/gearman_client_do.3 dist_man_MANS+= man/gearman_client_do_background.3 dist_man_MANS+= man/gearman_client_do_high.3 dist_man_MANS+= man/gearman_client_do_high_background.3 dist_man_MANS+= man/gearman_client_do_job_handle.3 dist_man_MANS+= man/gearman_client_do_low.3 dist_man_MANS+= man/gearman_client_do_low_background.3 dist_man_MANS+= man/gearman_client_do_status.3 dist_man_MANS+= man/gearman_client_echo.3 dist_man_MANS+= man/gearman_client_errno.3 dist_man_MANS+= man/gearman_client_error.3 dist_man_MANS+= man/gearman_client_free.3 dist_man_MANS+= man/gearman_client_job_status.3 dist_man_MANS+= man/gearman_client_options.3 dist_man_MANS+= man/gearman_client_remove_options.3 dist_man_MANS+= man/gearman_client_remove_servers.3 dist_man_MANS+= man/gearman_client_run_tasks.3 dist_man_MANS+= man/gearman_client_set_complete_fn.3 dist_man_MANS+= man/gearman_client_set_context.3 dist_man_MANS+= man/gearman_client_set_created_fn.3 dist_man_MANS+= man/gearman_client_set_data_fn.3 dist_man_MANS+= man/gearman_client_set_exception_fn.3 dist_man_MANS+= man/gearman_client_set_fail_fn.3 dist_man_MANS+= man/gearman_client_set_log_fn.3 dist_man_MANS+= man/gearman_client_set_namespace.3 dist_man_MANS+= man/gearman_client_set_options.3 dist_man_MANS+= man/gearman_client_set_status_fn.3 dist_man_MANS+= man/gearman_client_set_task_context_free_fn.3 dist_man_MANS+= man/gearman_client_set_timeout.3 dist_man_MANS+= man/gearman_client_set_warning_fn.3 dist_man_MANS+= man/gearman_client_set_workload_fn.3 dist_man_MANS+= man/gearman_client_set_workload_free_fn.3 dist_man_MANS+= man/gearman_client_set_workload_malloc_fn.3 dist_man_MANS+= man/gearman_client_st.3 dist_man_MANS+= man/gearman_client_task_free_all.3 dist_man_MANS+= man/gearman_client_timeout.3 dist_man_MANS+= man/gearman_client_wait.3 dist_man_MANS+= man/gearman_continue.3 dist_man_MANS+= man/gearman_execute.3 dist_man_MANS+= man/gearman_failed.3 dist_man_MANS+= man/gearman_job_free.3 dist_man_MANS+= man/gearman_job_free_all.3 dist_man_MANS+= man/gearman_job_function_name.3 dist_man_MANS+= man/gearman_job_handle.3 dist_man_MANS+= man/gearman_job_handle_t.3 dist_man_MANS+= man/gearman_job_send_complete.3 dist_man_MANS+= man/gearman_job_send_data.3 dist_man_MANS+= man/gearman_job_send_exception.3 dist_man_MANS+= man/gearman_job_send_fail.3 dist_man_MANS+= man/gearman_job_send_status.3 dist_man_MANS+= man/gearman_job_send_warning.3 dist_man_MANS+= man/gearman_job_st.3 dist_man_MANS+= man/gearman_job_take_workload.3 dist_man_MANS+= man/gearman_job_unique.3 dist_man_MANS+= man/gearman_job_workload.3 dist_man_MANS+= man/gearman_job_workload_size.3 dist_man_MANS+= man/gearman_log_fn.3 dist_man_MANS+= man/gearman_parse_servers.3 dist_man_MANS+= man/gearman_result_boolean.3 dist_man_MANS+= man/gearman_result_integer.3 dist_man_MANS+= man/gearman_result_is_null.3 dist_man_MANS+= man/gearman_result_size.3 dist_man_MANS+= man/gearman_result_store_integer.3 dist_man_MANS+= man/gearman_result_store_string.3 dist_man_MANS+= man/gearman_result_store_value.3 dist_man_MANS+= man/gearman_result_string.3 dist_man_MANS+= man/gearman_return_t.3 dist_man_MANS+= man/gearman_strerror.3 dist_man_MANS+= man/gearman_string_t.3 dist_man_MANS+= man/gearman_success.3 dist_man_MANS+= man/gearman_task_context.3 dist_man_MANS+= man/gearman_task_data.3 dist_man_MANS+= man/gearman_task_data_size.3 dist_man_MANS+= man/gearman_task_denominator.3 dist_man_MANS+= man/gearman_task_error.3 dist_man_MANS+= man/gearman_task_free.3 dist_man_MANS+= man/gearman_task_function_name.3 dist_man_MANS+= man/gearman_task_give_workload.3 dist_man_MANS+= man/gearman_task_is_known.3 dist_man_MANS+= man/gearman_task_is_running.3 dist_man_MANS+= man/gearman_task_job_handle.3 dist_man_MANS+= man/gearman_task_numerator.3 dist_man_MANS+= man/gearman_task_recv_data.3 dist_man_MANS+= man/gearman_task_return.3 dist_man_MANS+= man/gearman_task_send_workload.3 dist_man_MANS+= man/gearman_task_set_context.3 dist_man_MANS+= man/gearman_task_st.3 dist_man_MANS+= man/gearman_task_take_data.3 dist_man_MANS+= man/gearman_task_unique.3 dist_man_MANS+= man/gearman_verbose_name.3 dist_man_MANS+= man/gearman_verbose_t.3 dist_man_MANS+= man/gearman_version.3 dist_man_MANS+= man/gearman_worker_add_function.3 dist_man_MANS+= man/gearman_worker_add_options.3 dist_man_MANS+= man/gearman_worker_add_server.3 dist_man_MANS+= man/gearman_worker_add_servers.3 dist_man_MANS+= man/gearman_worker_clone.3 dist_man_MANS+= man/gearman_worker_context.3 dist_man_MANS+= man/gearman_worker_create.3 dist_man_MANS+= man/gearman_worker_define_function.3 dist_man_MANS+= man/gearman_worker_echo.3 dist_man_MANS+= man/gearman_worker_errno.3 dist_man_MANS+= man/gearman_worker_error.3 dist_man_MANS+= man/gearman_worker_free.3 dist_man_MANS+= man/gearman_worker_function_exist.3 dist_man_MANS+= man/gearman_worker_grab_job.3 dist_man_MANS+= man/gearman_worker_options.3 dist_man_MANS+= man/gearman_worker_register.3 dist_man_MANS+= man/gearman_worker_remove_options.3 dist_man_MANS+= man/gearman_worker_remove_servers.3 dist_man_MANS+= man/gearman_worker_set_context.3 dist_man_MANS+= man/gearman_worker_set_log_fn.3 dist_man_MANS+= man/gearman_worker_set_namespace.3 dist_man_MANS+= man/gearman_worker_set_options.3 dist_man_MANS+= man/gearman_worker_set_timeout.3 dist_man_MANS+= man/gearman_client_has_option.3 dist_man_MANS+= man/gearman_client_options_t.3 dist_man_MANS+= man/gearman_task_attr_init.3 dist_man_MANS+= man/gearman_task_attr_init_background.3 dist_man_MANS+= man/gearman_task_attr_init_epoch.3 dist_man_MANS+= man/gearman_task_attr_t.3 dist_man_MANS+= man/gearman_worker_set_identifier.3 dist_man_MANS+= man/gearman_worker_set_workload_free_fn.3 dist_man_MANS+= man/gearman_worker_set_workload_malloc_fn.3 dist_man_MANS+= man/gearman_worker_st.3 dist_man_MANS+= man/gearman_worker_timeout.3 dist_man_MANS+= man/gearman_worker_unregister.3 dist_man_MANS+= man/gearman_worker_unregister_all.3 dist_man_MANS+= man/gearman_worker_wait.3 dist_man_MANS+= man/gearman_worker_work.3 dist_man_MANS+= man/libgearman.3 gearmand-1.0.6/man/gearman_task_is_known.30000664000076400007640000001306612142673665021002 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_IS_KNOWN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_create.30000664000076400007640000000634012142673662020724 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_CREATE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 libgearman 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_create\fP returns a pointer to the gearman_client_st that was created (or initialized). On an allocation failure, it returns NULL. .sp \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_st(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_st.30000664000076400007640000001047512142673664017411 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_ST" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_argument_make.30000664000076400007640000000344212142673662020742 0ustar00brianbrian00000000000000.TH "GEARMAN_ARGUMENT_MAKE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_context.30000664000076400007640000001020312142673667022051 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_CONTEXT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_exception_fn.30000664000076400007640000001054412142673662023016 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_EXCEPTION_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task_high_background.30000664000076400007640000000637412142673662024440 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK_HIGH_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_background(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_high_background(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_low_background(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_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 \fI\%gearman_client_add_task_high_background()\fP and \fI\%gearman_client_add_task_low_background()\fP are identical to \fBgearman_client_do()\fP, only they set the priority to either high or low. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 You may wish to avoid using \fI\%gearman_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. .UNINDENT .UNINDENT .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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_function_name.30000664000076400007640000001310012142673665021765 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_FUNCTION_NAME" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_namespace.30000664000076400007640000000354212142673667022331 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_NAMESPACE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 namespace_key can see one anothers workloads and functions. .sp By setting namespace_key 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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_strerror.30000664000076400007640000002125512142673665020012 0ustar00brianbrian00000000000000.TH "GEARMAN_STRERROR" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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_worker_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 .UNINDENT .INDENT 0.0 .TP .B GEARMAN_FAIL The function failed to complete the job. \fI\%GEARMAN_FATAL\fP is the deprecated name for \fI\%GEARMAN_FAIL\fP .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 .INDENT 0.0 .TP .B GEARMAN_UNKNOWN_OPTION Default state of task return value. .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 .SS DEPRECATED .INDENT 0.0 .TP .B GEARMAN_IGNORE_PACKET .UNINDENT .INDENT 0.0 .TP .B GEARMAN_MAX_RETURN .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_function_name.30000664000076400007640000001052312142673664021602 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_FUNCTION_NAME" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task_high.30000664000076400007640000000542512142673662022235 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK_HIGH" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_high(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_low(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 \fI\%gearman_client_add_task_high()\fP and \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_send_status.30000664000076400007640000001051712142673664021314 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_SEND_STATUS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_send_exception.30000664000076400007640000001052512142673664021766 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_SEND_EXCEPTION" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_echo.30000664000076400007640000000363712142673663020406 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ECHO" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_echo(gearman_client_st\fI\ *client\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_echo(gearman_worker_st\fI\ *worker\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_echo()\fP and \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_send_warning.30000664000076400007640000001052112142673664021431 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_SEND_WARNING" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_workload_free_fn.30000664000076400007640000000777012142673663023653 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_WORKLOAD_FREE_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_errno.30000664000076400007640000000344212142673663020607 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ERRNO" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B const char *gearman_client_error(const gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B int gearman_client_errno(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Ling with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_client_error()\fP and \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_error.30000664000076400007640000001306012142673665020276 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_ERROR" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_register.30000664000076400007640000001017512142673667021346 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_REGISTER" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_options.30000664000076400007640000000560212142673663021765 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .INDENT 0.0 .TP .B GEARMAN_CLIENT_GENERATE_UNIQUE .UNINDENT .sp Generate a unique id for each task created by generating a UUID. .SH RETURN VALUE .sp Various .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_free.30000664000076400007640000000621112142673666020436 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_FREE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st *gearman_worker_create(gearman_worker_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_worker_st *gearman_worker_clone(gearman_worker_st\fI\ *client\fP, const gearman_worker_st\fI\ *from\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_free(gearman_worker_st\fI\ *client\fP) .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 \fI\%gearman_worker_clone()\fP is similar to \fI\%gearman_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 \fI\%gearman_worker_free()\fP when you are finished using it. \fI\%gearman_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 \fI\%gearman_worker_create()\fP or \fI\%gearman_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 \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_argument_t.30000664000076400007640000000343412142673662020271 0ustar00brianbrian00000000000000.TH "GEARMAN_ARGUMENT_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_warning_fn.30000664000076400007640000001054012142673662022461 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_WARNING_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_data_size.30000664000076400007640000001307012142673665021111 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_DATA_SIZE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_job_handle.30000664000076400007640000000775212142673663022241 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_JOB_HANDLE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_set_context.30000664000076400007640000001307412142673666021512 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_SET_CONTEXT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_denominator.30000664000076400007640000001307412142673665021471 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_DENOMINATOR" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_st.30000664000076400007640000001305212142673666017575 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_ST" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_add_servers.30000664000076400007640000000461212142673666022021 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ADD_SERVERS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_worker_add_server(gearman_worker_st\fI\ *worker\fP, const char\fI\ *host\fP, in_port_t\fI\ port\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_add_servers(gearman_worker_st\fI\ *worker\fP, const char\fI\ *servers\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_servers(gearman_worker_st\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the worker will take work from. .sp \fI\%gearman_worker_remove_servers()\fP will remove all servers from the \fBgearman_worker_st\fP. .sp \fI\%gearman_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: .INDENT 0.0 .INDENT 3.5 .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 .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_worker_add_server()\fP and \fI\%gearman_worker_remove_servers()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_free.30000664000076400007640000001050112142673663017671 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_FREE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/libgearman.30000664000076400007640000000761212142673662016535 0ustar00brianbrian00000000000000.TH "LIBGEARMAN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 <\fBhttps://launchpad.net/gearmand\fP> .SH SEE ALSO .sp \fIgearmand(8)\fP \fIlibgearman_examples(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_background.30000664000076400007640000001001612142673663022256 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_priority_t .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_do_background(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, char\fI\ *job_handle\fP) .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\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, gearman_job_handle_t\fI\ job_handle\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_do_low_background(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, gearman_job_handle_t\fI\ job_handle\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_do_background()\fP executes a single request to the gearmand server and returns the status via \fBgearman_return_t\fP. .sp \fBgearman_client_add_task_high_background()\fP and \fBgearman_client_add_task_low_background()\fP are identical to \fI\%gearman_client_do_background()\fP, only they set the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_job_status.30000664000076400007640000000563512142673663021645 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_JOB_STATUS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_job_status(gearman_client_st\fI\ *client\fP, gearman_job_handle_t\fI\ job_handle\fP, bool\fI\ *is_known\fP, bool\fI\ *is_running\fP, uint32_t\fI\ *numerator\fP, uint32_t\fI\ *denominator\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_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 omitted 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 \fI\%gearman_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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP \fIgearman_job_handle_t(3)\fP \fIgearman_continue(3\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_wait.30000664000076400007640000000302512142673663020423 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_WAIT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_wait(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp Calling \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_send_workload.30000664000076400007640000001310012142673666021774 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_SEND_WORKLOAD" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_job_handle.30000664000076400007640000001307212142673666021236 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_JOB_HANDLE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_free.30000664000076400007640000001305612142673665020073 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_FREE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_remove_servers.30000664000076400007640000000462012142673666022565 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_REMOVE_SERVERS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_worker_add_server(gearman_worker_st\fI\ *worker\fP, const char\fI\ *host\fP, in_port_t\fI\ port\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_add_servers(gearman_worker_st\fI\ *worker\fP, const char\fI\ *servers\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_servers(gearman_worker_st\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the worker will take work from. .sp \fI\%gearman_worker_remove_servers()\fP will remove all servers from the \fBgearman_worker_st\fP. .sp \fI\%gearman_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: .INDENT 0.0 .INDENT 3.5 .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 .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_worker_add_server()\fP and \fI\%gearman_worker_remove_servers()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_st.30000664000076400007640000001016112142673667020143 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ST" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_status.30000664000076400007640000000774212142673663021476 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_STATUS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_workload_free_fn.30000664000076400007640000001022512142673667023677 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_WORKLOAD_FREE_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_timeout.30000664000076400007640000000774612142673663022036 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_TIMEOUT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_attr_t.30000664000076400007640000000410212142673666020440 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_ATTR_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_work_t .UNINDENT .INDENT 0.0 .TP .B gearman_job_priority_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_epoch(time_t\fI\ epoch\fP, \fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_background(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. .sp \fI\%gearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. .sp \fI\%gearman_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 \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_attr_init.30000664000076400007640000000411012142673666021137 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_ATTR_INIT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_work_t .UNINDENT .INDENT 0.0 .TP .B gearman_job_priority_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_epoch(time_t\fI\ epoch\fP, \fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_background(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. .sp \fI\%gearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. .sp \fI\%gearman_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 \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_high_background.30000664000076400007640000001003012142673663023251 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_HIGH_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_priority_t .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_do_background(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, char\fI\ *job_handle\fP) .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\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, gearman_job_handle_t\fI\ job_handle\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_do_low_background(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, gearman_job_handle_t\fI\ job_handle\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_do_background()\fP executes a single request to the gearmand server and returns the status via \fBgearman_return_t\fP. .sp \fBgearman_client_add_task_high_background()\fP and \fBgearman_client_add_task_low_background()\fP are identical to \fI\%gearman_client_do_background()\fP, only they set the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_bugreport.30000664000076400007640000000265312142673662020137 0ustar00brianbrian00000000000000.TH "GEARMAN_BUGREPORT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_send_complete.30000664000076400007640000001052312142673664021576 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_SEND_COMPLETE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_actions_t.30000664000076400007640000001051012142673662020100 0ustar00brianbrian00000000000000.TH "GEARMAN_ACTIONS_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_workload_fn.30000664000076400007640000000775612142673663022656 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_WORKLOAD_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_has_option.30000664000076400007640000000560012142673663021623 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_HAS_OPTION" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .INDENT 0.0 .TP .B GEARMAN_CLIENT_GENERATE_UNIQUE .UNINDENT .sp Generate a unique id for each task created by generating a UUID. .SH RETURN VALUE .sp Various .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_remove_options.30000664000076400007640000000500412142673666022564 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_REMOVE_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_options_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_worker_options_t\fP 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, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .sp Deprecated since version 0.21. .SH DESCRIPTION .sp \fI\%gearman_worker_options()\fP returns the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_server.30000664000076400007640000000450712142673662021602 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_SERVER" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_add_server(gearman_client_st\fI\ *client\fP, const char\fI\ *host\fP, in_port_t\fI\ port\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_add_servers(gearman_client_st\fI\ *client\fP, const char\fI\ *servers\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_remove_servers(gearman_client_st\fI\ *client\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the client will take work from. .sp \fI\%gearman_client_remove_servers()\fP will remove all servers from the \fBgearman_client_st\fP. .sp \fI\%gearman_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 \fI\%gearman_client_add_server()\fP and \fI\%gearman_client_remove_servers()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_free.30000664000076400007640000000633412142673662020405 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_FREE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 libgearman 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_create\fP returns a pointer to the gearman_client_st that was created (or initialized). On an allocation failure, it returns NULL. .sp \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_st(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_context.30000664000076400007640000001053212142673662022016 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_CONTEXT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_add_server.30000664000076400007640000000461012142673666021634 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ADD_SERVER" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_worker_add_server(gearman_worker_st\fI\ *worker\fP, const char\fI\ *host\fP, in_port_t\fI\ port\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_add_servers(gearman_worker_st\fI\ *worker\fP, const char\fI\ *servers\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_servers(gearman_worker_st\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the worker will take work from. .sp \fI\%gearman_worker_remove_servers()\fP will remove all servers from the \fBgearman_worker_st\fP. .sp \fI\%gearman_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: .INDENT 0.0 .INDENT 3.5 .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 .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_worker_add_server()\fP and \fI\%gearman_worker_remove_servers()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_unique.30000664000076400007640000001050512142673664020263 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_UNIQUE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_integer.30000664000076400007640000000545712142673664021170 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_INTEGER" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_failed.30000664000076400007640000002125112142673665017350 0ustar00brianbrian00000000000000.TH "GEARMAN_FAILED" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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_worker_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 .UNINDENT .INDENT 0.0 .TP .B GEARMAN_FAIL The function failed to complete the job. \fI\%GEARMAN_FATAL\fP is the deprecated name for \fI\%GEARMAN_FAIL\fP .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 .INDENT 0.0 .TP .B GEARMAN_UNKNOWN_OPTION Default state of task return value. .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 .SS DEPRECATED .INDENT 0.0 .TP .B GEARMAN_IGNORE_PACKET .UNINDENT .INDENT 0.0 .TP .B GEARMAN_MAX_RETURN .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_context.30000664000076400007640000000773612142673663021160 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_CONTEXT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_high.30000664000076400007640000000745212142673662021067 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_HIGH" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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\fI\ *ret_ptr\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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_log_fn.30000664000076400007640000000361112142673666021635 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_LOG_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B void gearman_worker_set_log_fn(gearman_worker_st\fI\ *worker\fP, gearman_log_fn\fI\ *function\fP, void\fI\ *context\fP, gearman_verbose_t\fI\ verbose\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_worker_set_log_fn()\fP is similar to \fBgearman_client_set_log_fn()\fP but it used with workers, aka, \fBgearman_worker_st\fP. \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_fail_fn.30000664000076400007640000001053212142673662021730 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_FAIL_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_store_integer.30000664000076400007640000000547312142673664022402 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_STORE_INTEGER" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_attr_init_background.30000664000076400007640000000413612142673666023346 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_ATTR_INIT_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_work_t .UNINDENT .INDENT 0.0 .TP .B gearman_job_priority_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_epoch(time_t\fI\ epoch\fP, \fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_background(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. .sp \fI\%gearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. .sp \fI\%gearman_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 \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task_background.30000664000076400007640000000636212142673662023436 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_background(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_high_background(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_low_background(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_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 \fI\%gearman_client_add_task_high_background()\fP and \fI\%gearman_client_add_task_low_background()\fP are identical to \fBgearman_client_do()\fP, only they set the priority to either high or low. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 You may wish to avoid using \fI\%gearman_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. .UNINDENT .UNINDENT .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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_unregister_all.30000664000076400007640000001021112142673667022530 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_UNREGISTER_ALL" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_give_workload.30000664000076400007640000001310012142673665021774 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_GIVE_WORKLOAD" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_attr_init_epoch.30000664000076400007640000000412412142673666022322 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_ATTR_INIT_EPOCH" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_work_t .UNINDENT .INDENT 0.0 .TP .B gearman_job_priority_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_epoch(time_t\fI\ epoch\fP, \fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_work_t\fP gearman_work_background(\fI\%gearman_job_priority_t\fP\fI\ priority\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_work_t\fP describe work for \fBgearman_execute()\fP. .sp \fI\%gearman_work()\fP creates a \fI\%gearman_work_t\fP with a priority. .sp \fI\%gearman_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 \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_clone.30000664000076400007640000000633612142673662020566 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_CLONE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 libgearman 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_create\fP returns a pointer to the gearman_client_st that was created (or initialized). On an allocation failure, it returns NULL. .sp \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP \fIgearman_client_st(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_continue.30000664000076400007640000002125512142673665017754 0ustar00brianbrian00000000000000.TH "GEARMAN_CONTINUE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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_worker_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 .UNINDENT .INDENT 0.0 .TP .B GEARMAN_FAIL The function failed to complete the job. \fI\%GEARMAN_FATAL\fP is the deprecated name for \fI\%GEARMAN_FAIL\fP .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 .INDENT 0.0 .TP .B GEARMAN_UNKNOWN_OPTION Default state of task return value. .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 .SS DEPRECATED .INDENT 0.0 .TP .B GEARMAN_IGNORE_PACKET .UNINDENT .INDENT 0.0 .TP .B GEARMAN_MAX_RETURN .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_errno.30000664000076400007640000000344212142673666020645 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ERRNO" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B const char *gearman_worker_error(const gearman_worker_st\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_errno(gearman_worker_st\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_error()\fP and \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_free_all.30000664000076400007640000001051112142673664020523 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_FREE_ALL" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task.30000664000076400007640000000541312142673662021233 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_high(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_low(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 \fI\%gearman_client_add_task_high()\fP and \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_work.30000664000076400007640000001016512142673667020503 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_WORK" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_size.30000664000076400007640000000545112142673664020477 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_SIZE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman.10000664000076400007640000000515612142673662016045 0ustar00brianbrian00000000000000.TH "GEARMAN" "1" "May 09, 2013" "1.0.6" "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 reStructuredText. . .sp Command line client for Gearmand .SH SYNOPSIS .sp \fBCommon options\fP .INDENT 0.0 .TP .B \-f Function name to use for jobs (can give many) .UNINDENT .INDENT 0.0 .TP .B \-h Job server host .UNINDENT .INDENT 0.0 .TP .B \-H Print this help menu .UNINDENT .INDENT 0.0 .TP .B \-p Gearman server port .UNINDENT .INDENT 0.0 .TP .B \-t Timeout in milliseconds .UNINDENT .INDENT 0.0 .TP .B \-i 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 Unique key to use for job .UNINDENT .sp \fIWorker options*\fP .INDENT 0.0 .TP .B \-c 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. .sp The environmental variable GEARMAN_SERVER can be used to specify multiple gearmand servers. Please see the c:func:\(aqgearman_client_add_servers\(aq for an explanation of the required syntax. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_execute.30000664000076400007640000001174612142673663017574 0ustar00brianbrian00000000000000.TH "GEARMAN_EXECUTE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* Example code to show how to send a string to a function called "reverse" and print the results. */ /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_workload_malloc_fn.30000664000076400007640000000777412142673663024205 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_WORKLOAD_MALLOC_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_log_fn.30000664000076400007640000000352312142673663021601 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_LOG_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B void gearman_client_set_log_fn(gearman_worker_st\fI\ *worker\fP, gearman_log_fn\fI\ *function\fP, void\fI\ *context\fP, gearman_verbose_t\fI\ verbose\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_set_log_fn()\fP is similar to \fBgearman_worker_set_log_fn()\fP but it used with clients, aka, \fBgearman_client_st\fP. \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_log_fn.30000664000076400007640000000277212142673664017376 0ustar00brianbrian00000000000000.TH "GEARMAN_LOG_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_log_fn .UNINDENT .SH DESCRIPTION .sp :c:type:gearman_log_fn is defined as: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C void (gearman_log_fn)(const char *line, gearman_verbose_t verbose, void *context) .ft P .fi .UNINDENT .UNINDENT .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_options_t.30000664000076400007640000000557612142673663021512 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_OPTIONS_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .INDENT 0.0 .TP .B GEARMAN_CLIENT_GENERATE_UNIQUE .UNINDENT .sp Generate a unique id for each task created by generating a UUID. .SH RETURN VALUE .sp Various .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_workload_size.30000664000076400007640000001052312142673664021631 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_WORKLOAD_SIZE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_workload.30000664000076400007640000001051112142673664020574 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_WORKLOAD" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_store_string.30000664000076400007640000000547112142673664022251 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_STORE_STRING" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_remove_options.30000664000076400007640000000561012142673663022531 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_REMOVE_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .INDENT 0.0 .TP .B GEARMAN_CLIENT_GENERATE_UNIQUE .UNINDENT .sp Generate a unique id for each task created by generating a UUID. .SH RETURN VALUE .sp Various .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_return.30000664000076400007640000001306212142673665020466 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_RETURN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_send_fail.30000664000076400007640000001051312142673664020700 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_SEND_FAIL" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_status_fn.30000664000076400007640000001053612142673662022344 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_STATUS_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_string_t.30000664000076400007640000000305012142673665017752 0ustar00brianbrian00000000000000.TH "GEARMAN_STRING_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_string_t .UNINDENT .INDENT 0.0 .TP .B size_t gearman_size(\fI\%gearman_string_t\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_c_str(\fI\%gearman_string_t\fP) .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_add_function.30000664000076400007640000001020512142673666022150 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ADD_FUNCTION" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_data.30000664000076400007640000001305612142673665020063 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_DATA" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_st.30000664000076400007640000000772412142673663020117 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ST" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_namespace.30000664000076400007640000000354212142673667022276 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_NAMESPACE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 namespace_key can see one anothers workloads and functions. .sp By setting namespace_key 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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_verbose_name.30000664000076400007640000000366112142673666020577 0ustar00brianbrian00000000000000.TH "GEARMAN_VERBOSE_NAME" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_verbose_t .UNINDENT .INDENT 0.0 .TP .B const char *gearman_verbose_name(\fI\%gearman_verbose_t\fP\fI\ verbose\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_verbose_name()\fP takes a \fI\%gearman_verbose_t\fP and returns a character representation of it. .sp Possible values of \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearmand.80000664000076400007640000003200412142673662016210 0ustar00brianbrian00000000000000.TH "GEARMAND" "8" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp \fBGeneral options\fP .INDENT 0.0 .TP .B \-b [ \-\-backlog ] arg (=32) 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 ] Daemon, detach and run in the background. .UNINDENT .INDENT 0.0 .TP .B \-f [ \-\-file\-descriptors ] arg 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 ] Print this help menu. .UNINDENT .INDENT 0.0 .TP .B \-j [ \-\-job\-retries ] arg (=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. .UNINDENT .INDENT 0.0 .TP .B \-l [ \-\-log\-file ] arg 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 Address the server should listen on. Default is INADDR_ANY. .UNINDENT .INDENT 0.0 .TP .B \-p [ \-\-port ] arg (=4730) Port the server should listen on. .UNINDENT .INDENT 0.0 .TP .B \-P [ \-\-pid\-file ] arg File to write process ID out to. .UNINDENT .INDENT 0.0 .TP .B \-r [ \-\-protocol ] arg Load protocol module. .UNINDENT .INDENT 0.0 .TP .B \-R [ \-\-round\-robin ] 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 Persistent queue type to use. .UNINDENT .INDENT 0.0 .TP .B \-t [ \-\-threads ] arg (=4) Number of I/O threads to use. Default=4. .UNINDENT .INDENT 0.0 .TP .B \-u [ \-\-user ] arg Switch to given user after startup. .UNINDENT .INDENT 0.0 .TP .B \-v [ \-\-verbose ] arg (=v) Increase verbosity level by one. .UNINDENT .INDENT 0.0 .TP .B \-V [ \-\-version ] Display the version of gearmand and exit. .UNINDENT .INDENT 0.0 .TP .B \-w [ \-\-worker\-wakeup ] arg (=0) 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) Port to listen on. .UNINDENT .sp \fBsqlite\fP .INDENT 0.0 .TP .B \-\-libsqlite3\-db arg Database file to use. .UNINDENT .INDENT 0.0 .TP .B \-\-libsqlite3\-table arg (=gearman_queue) Table to use. .UNINDENT .sp \fBMemcached(libmemcached)\fP .INDENT 0.0 .TP .B \-\-libmemcached\-servers arg List of Memcached servers to use. .UNINDENT .sp \fBDrizzle/MySQL(libdrizzle)\fP .INDENT 0.0 .TP .B \-host arg Host of server. .UNINDENT .INDENT 0.0 .TP .B \-port arg Port of server. (by default Drizzle) .UNINDENT .INDENT 0.0 .TP .B \-uds arg Unix domain socket for server. .UNINDENT .INDENT 0.0 .TP .B \-user arg User name for authentication. .UNINDENT .INDENT 0.0 .TP .B \-password arg Password for authentication. .UNINDENT .INDENT 0.0 .TP .B \-db arg Schema/Database to use. .UNINDENT .INDENT 0.0 .TP .B \-table arg Table to use. .UNINDENT .INDENT 0.0 .TP .B \-mysql arg Use MySQL protocol. .UNINDENT .sp \fBPostgres\fP .INDENT 0.0 .TP .B \-\-libpq\-conninfo arg PostgreSQL connection information string. .UNINDENT .INDENT 0.0 .TP .B \-\-libpq\-table arg (=queue) Table to use. .UNINDENT .sp \fBtokyocabinet\fP .INDENT 0.0 .TP .B \-\-libtokyocabinet\-file arg 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. .sp For thread safety to work when UUID are generated, you must be running the uuidd daemon. .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 receive 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: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C POST /reverse HTTP/1.1 Content\-Length: 12 Hello world! .ft P .fi .UNINDENT .UNINDENT .sp Is translated into a job submission request for the function “reverse” and workload “Hello world!”. This will respond with: .INDENT 0.0 .INDENT 3.5 .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 .UNINDENT .UNINDENT .sp The following headers can be passed to change the behavior of the job: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C * X\-Gearman\-Unique: * X\-Gearman\-Background: true * X\-Gearman\-Priority: .ft P .fi .UNINDENT .UNINDENT .sp For example, to run a low priority background job, the following request can be sent: .INDENT 0.0 .INDENT 3.5 .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 .UNINDENT .UNINDENT .sp The response for this request will not have any data associated with it since it was a background job: .INDENT 0.0 .INDENT 3.5 .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 .UNINDENT .UNINDENT .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_take_data.30000664000076400007640000001307012142673666021064 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_TAKE_DATA" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_unregister.30000664000076400007640000001020112142673667021677 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_UNREGISTER" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_options.30000664000076400007640000000476612142673666021225 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_options_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_worker_options_t\fP 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, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .sp Deprecated since version 0.21. .SH DESCRIPTION .sp \fI\%gearman_worker_options()\fP returns the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do_low.30000664000076400007640000000745012142673662020747 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO_LOW" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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\fI\ *ret_ptr\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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_is_null.30000664000076400007640000000545712142673664021200 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_IS_NULL" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_grab_job.30000664000076400007640000001017512142673667021267 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_GRAB_JOB" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_error.30000664000076400007640000000344212142673663020613 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ERROR" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B const char *gearman_client_error(const gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B int gearman_client_errno(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Ling with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_client_error()\fP and \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_define_function.30000664000076400007640000000645712142673666022670 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_DEFINE_FUNCTION" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_function_t .UNINDENT .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 \fI\%gearman_function_t\fP\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_FAIL\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_FAIL\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_error.30000664000076400007640000000344212142673666020651 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ERROR" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B const char *gearman_worker_error(const gearman_worker_st\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_errno(gearman_worker_st\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_error()\fP and \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_is_running.30000664000076400007640000001307212142673666021324 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_IS_RUNNING" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_task_free_all.30000664000076400007640000000775212142673663022265 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_TASK_FREE_ALL" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_timeout.30000664000076400007640000001020312142673667022053 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_TIMEOUT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task_low.30000664000076400007640000000542312142673662022115 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK_LOW" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_high(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_low(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 \fI\%gearman_client_add_task_high()\fP and \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_complete_fn.30000664000076400007640000001054212142673662022626 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_COMPLETE_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_echo.30000664000076400007640000000363712142673663020441 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ECHO" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_echo(gearman_client_st\fI\ *client\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_echo(gearman_worker_st\fI\ *worker\fP, const void\fI\ *workload\fP, size_t\fI\ workload_size\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_echo()\fP and \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_string.30000664000076400007640000000545512142673664021037 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_STRING" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearadmin.10000664000076400007640000000400212142673662016347 0ustar00brianbrian00000000000000.TH "GEARADMIN" "1" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 Connect to the host .UNINDENT .INDENT 0.0 .TP .B \-p [ \-\-port ] arg (=4730) 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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_store_value.30000664000076400007640000000546712142673664022064 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_STORE_VALUE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_clear_fn.30000664000076400007640000001052412142673662021231 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_CLEAR_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_options.30000664000076400007640000000560212142673663022030 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .INDENT 0.0 .TP .B GEARMAN_CLIENT_GENERATE_UNIQUE .UNINDENT .sp Generate a unique id for each task created by generating a UUID. .SH RETURN VALUE .sp Various .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_clone.30000664000076400007640000000621312142673666020617 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_CLONE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st *gearman_worker_create(gearman_worker_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_worker_st *gearman_worker_clone(gearman_worker_st\fI\ *client\fP, const gearman_worker_st\fI\ *from\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_free(gearman_worker_st\fI\ *client\fP) .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 \fI\%gearman_worker_clone()\fP is similar to \fI\%gearman_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 \fI\%gearman_worker_free()\fP when you are finished using it. \fI\%gearman_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 \fI\%gearman_worker_create()\fP or \fI\%gearman_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 \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task_low_background.30000664000076400007640000000637212142673662024320 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK_LOW_BACKGROUND" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_background(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_high_background(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 .INDENT 0.0 .TP .B gearman_task_st *gearman_client_add_task_low_background(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_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 \fI\%gearman_client_add_task_high_background()\fP and \fI\%gearman_client_add_task_low_background()\fP are identical to \fBgearman_client_do()\fP, only they set the priority to either high or low. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 You may wish to avoid using \fI\%gearman_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. .UNINDENT .UNINDENT .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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_add_task_status.30000664000076400007640000000423512142673662022637 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_ADD_TASK_STATUS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_task_st(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_add_options.30000664000076400007640000000477612142673666022036 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_ADD_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_options_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_worker_options_t\fP 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, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .sp Deprecated since version 0.21. .SH DESCRIPTION .sp \fI\%gearman_worker_options()\fP returns the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_options.30000664000076400007640000000477612142673666022101 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_OPTIONS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_options_t .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_worker_options_t\fP 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, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_remove_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_options(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_worker_options_t\fP\fI\ options\fP) .UNINDENT .sp Deprecated since version 0.21. .SH DESCRIPTION .sp \fI\%gearman_worker_options()\fP returns the \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_handle_t.30000664000076400007640000000324012142673663020530 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_HANDLE_T" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_remove_servers.30000664000076400007640000000451712142673662022533 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_REMOVE_SERVERS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_client_add_server(gearman_client_st\fI\ *client\fP, const char\fI\ *host\fP, in_port_t\fI\ port\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_client_add_servers(gearman_client_st\fI\ *client\fP, const char\fI\ *servers\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_remove_servers(gearman_client_st\fI\ *client\fP) .UNINDENT .SH DESCRIPTION .sp \fI\%gearman_client_add_server()\fP will add an additional \fBgearmand\fP server to the list of servers that the client will take work from. .sp \fI\%gearman_client_remove_servers()\fP will remove all servers from the \fBgearman_client_st\fP. .sp \fI\%gearman_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 \fI\%gearman_client_add_server()\fP and \fI\%gearman_client_remove_servers()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_unique.30000664000076400007640000001306212142673666020456 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_UNIQUE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_handle.30000664000076400007640000001050512142673664020210 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_HANDLE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_version.30000664000076400007640000000263012142673666017612 0ustar00brianbrian00000000000000.TH "GEARMAN_VERSION" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_memory_allocators.30000664000076400007640000000456712142673662024133 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_MEMORY_ALLOCATORS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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\fI\ *\fP, \fI\%gearman_malloc_fn\fP\fI\ *malloc_fn\fP, \fI\%gearman_free_fn\fP\fI\ *free_fn\fP, \fI\%gearman_realloc_fn\fP\fI\ *realloc_fn\fP, \fI\%gearman_calloc_fn\fP\fI\ *calloc_fn\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st\fI\ *\fP, \fI\%gearman_malloc_fn\fP\fI\ *malloc_fn\fP, \fI\%gearman_free_fn\fP\fI\ *free_fn\fP, \fI\%gearman_realloc_fn\fP\fI\ *realloc_fn\fP, \fI\%gearman_calloc_fn\fP\fI\ *calloc_fn\fP, void\fI\ *context\fP) .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 \fI\%gearman_client_set_memory_allocators()\fP and \fI\%gearman_worker_set_memory_allocators()\fP to set your own custom allocators. .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_st(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_context.30000664000076400007640000001017312142673666021203 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_CONTEXT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_job_send_data.30000664000076400007640000001051312142673664020676 0ustar00brianbrian00000000000000.TH "GEARMAN_JOB_SEND_DATA" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_job_st .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_data(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *data\fP, size_t\fI\ data_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_warning(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *warning\fP, size_t\fI\ warning_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_status(\fI\%gearman_job_st\fP\fI\ *job\fP, uint32_t\fI\ numerator\fP, uint32_t\fI\ denominator\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_complete(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *result\fP, size_t\fI\ result_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_exception(\fI\%gearman_job_st\fP\fI\ *job\fP, const void\fI\ *exception\fP, size_t\fI\ exception_size\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_job_send_fail(\fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_handle(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_function_name(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_job_unique(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B const void *gearman_job_workload(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B size_t gearman_job_workload_size(const \fI\%gearman_job_st\fP\fI\ *job\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_job_take_workload(\fI\%gearman_job_st\fP\fI\ *job\fP, size_t\fI\ *data_size\fP) .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_job_st\fP *gearman_worker_grab_job(gearman_worker_st\fI\ *worker\fP, \fI\%gearman_job_st\fP\fI\ *job\fP, gearman_return_t\fI\ *ret_ptr\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_job_st\fP are passed to worker functions to represent jobs that are being run by \fBgearman_worker_work()\fP. .sp \fI\%gearman_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 \fI\%gearman_job_handle()\fP returns the job handle(see \fBgearman_job_handle_t\fP for more information). .sp \fI\%gearman_job_function_name()\fP return the name of the function that the job was set to execute against. .sp \fI\%gearman_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 \fI\%gearman_job_workload_size()\fP. \fI\%gearman_job_take_workload()\fP is the same as \fI\%gearman_job_workload()\fP with the exception that the result must be \fIfree(3)\fP by the caller. .sp \fI\%gearman_worker_grab_job()\fP Takes a job from one of the job servers. It is the responsibility of the caller to free the job once they are done. This interface is used in testing, and is very rarely the correct interface to program against. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_recv_data.30000664000076400007640000001307012142673666021077 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_RECV_DATA" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_do.30000664000076400007640000000744012142673662020065 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_DO" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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\fI\ *ret_ptr\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 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /* # Gearman server and library # Copyright (C) 2012 Data Differential, http://datadifferential.com/ # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. */ #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 .UNINDENT .UNINDENT .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_result_boolean.30000664000076400007640000000545712142673664021152 0ustar00brianbrian00000000000000.TH "GEARMAN_RESULT_BOOLEAN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_result_st .UNINDENT .INDENT 0.0 .TP .B \fI\%gearman_result_st\fP *gearman_task_result(gearman_task_st\fI\ *task\fP) .UNINDENT .INDENT 0.0 .TP .B int64_t gearman_result_integer(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_boolean(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_string_t gearman_result_string(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_string(\fI\%gearman_result_st\fP\fI\ *self\fP, gearman_string_t\fI\ arg\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_result_store_integer(\fI\%gearman_result_st\fP\fI\ *self\fP, int64_t\fI\ value\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_result_store_value(\fI\%gearman_result_st\fP\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 \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_result_value(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_result_is_null(const \fI\%gearman_result_st\fP\fI\ *self\fP) .UNINDENT .sp Compile and link with \-lgearman .SH DESCRIPTION .sp The \fI\%gearman_result_st\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 \fI\%gearman_task_result()\fP returns \fI\%gearman_result_st\fP from a \fBgearman_task_st\fP. .sp A \fI\%gearman_result_st\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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_context.30000664000076400007640000001306412142673665020635 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_CONTEXT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_identifier.30000664000076400007640000000321612142673666022514 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_IDENTIFIER" "3" "May 09, 2013" "1.0.6" "Gearmand" .SH NAME gearman_worker_set_identifier \- 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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_return_t gearman_worker_set_identifier(gearman_worker_st\fI\ *worker\fP, const char\fI\ *id\fP, size_t\fI\ id_size\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_set_identifier()\fP sets the identifier that the server uses to identify the worker. .SH RETURN VALUE .sp \fI\%gearman_worker_set_identifier()\fP return \fBgearman_return_t\fP. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fBgearmand\fP \fB../libgearman\fP \fBgearman_worker_st\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_timeout.30000664000076400007640000000773612142673663021162 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_TIMEOUT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_client_st .UNINDENT .INDENT 0.0 .TP .B gearman_task_context_free_fn .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, \fI\%gearman_task_context_free_fn\fP\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 connection 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. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .SH RETURN VALUE .sp \fI\%gearman_client_timeout()\fP returns an integer representing the amount of time in milliseconds to wait for a connection before throwing an error. A value of \-1 means an infinite timeout value. .SH HOME .sp To find out more information please check: \fI\%http://gearman.info/\fP .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_create(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_client_set_data_fn.30000664000076400007640000001053212142673662021726 0ustar00brianbrian00000000000000.TH "GEARMAN_CLIENT_SET_DATA_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_actions_t .UNINDENT .INDENT 0.0 .TP .B gearman_workload_fn .UNINDENT .INDENT 0.0 .TP .B gearman_created_fn .UNINDENT .INDENT 0.0 .TP .B gearman_data_fn .UNINDENT .INDENT 0.0 .TP .B gearman_warning_fn .UNINDENT .INDENT 0.0 .TP .B gearman_universal_status_fn .UNINDENT .INDENT 0.0 .TP .B gearman_exception_fn .UNINDENT .INDENT 0.0 .TP .B gearman_fail_fn .UNINDENT .INDENT 0.0 .TP .B gearman_complete_fn .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_workload_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_workload_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_created_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_created_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_data_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_data_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_warning_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_warning_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_status_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_universal_status_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_complete_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_complete_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_exception_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_exception_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_set_fail_fn(gearman_client_st\fI\ *client\fP, \fI\%gearman_fail_fn\fP\fI\ *function\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_client_clear_fn(gearman_client_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B const char *gearman_client_do_job_handle(gearman_client_st\fI\ *client\fP) .UNINDENT .sp Link to \-lgearman .SH DESCRIPTION .sp Callbacks for client execution task states. .sp \fI\%gearman_client_set_data_fn()\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_do_job_handle()\fP gest the job handle for the running task. This should be used between repeated \fBgearman_client_do()\fP (and related) calls to get information. .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. .sp \fI\%gearman_client_set_exception_fn()\fP will only be called if exceptions are enabled on the server. You can do this by calling \fBgearman_client_set_server_option()\fP. .sp An example of this: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C const char *EXCEPTIONS="exceptions"; gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS)); .ft P .fi .UNINDENT .UNINDENT .SH RETURN VALUE .sp None .INDENT 0.0 .INDENT 3.5 .IP "See also" .UNINDENT .UNINDENT .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_client_error(3)\fP or \fIgearman_worker_error(3)\fP .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_set_workload_malloc_fn.30000664000076400007640000001023112142673667024222 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_SET_WORKLOAD_MALLOC_FN" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_wait.30000664000076400007640000001016512142673667020465 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_WAIT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_task_numerator.30000664000076400007640000001307012142673666021163 0ustar00brianbrian00000000000000.TH "GEARMAN_TASK_NUMERATOR" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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 receives 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, or that no function was available if the job has been submitted. .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_timeout.30000664000076400007640000001017312142673667021206 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_TIMEOUT" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st .UNINDENT .INDENT 0.0 .TP .B gearman_worker_set_task_context_free_fn .UNINDENT .INDENT 0.0 .TP .B int gearman_worker_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_timeout(\fI\%gearman_worker_st\fP\fI\ *worker\fP, int\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B void *gearman_worker_context(const \fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_context(\fI\%gearman_worker_st\fP\fI\ *worker\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_malloc_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_malloc_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_set_workload_free_fn(\fI\%gearman_worker_st\fP\fI\ *worker\fP, gearman_free_fn\fI\ *function\fP, void\fI\ *context\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_wait(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_register(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, uint32_t\fI\ timeout\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_unregister_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_job_free_all(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .INDENT 0.0 .TP .B bool gearman_worker_function_exist(\fI\%gearman_worker_st\fP\fI\ *worker\fP, const char\fI\ *function_name\fP, size_t\fI\ function_length\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_return_t gearman_worker_work(\fI\%gearman_worker_st\fP\fI\ *worker\fP) .UNINDENT .sp Link with \-lgearman .SH DESCRIPTION .sp \fI\%gearman_worker_st\fP is used for worker communication with the server. .sp \fI\%gearman_worker_context()\fP and \fI\%gearman_worker_set_context()\fP can be used to store an arbitrary object for the user. .sp \fI\%gearman_worker_set_task_context_free_fn()\fP sets a trigger that will be called when a \fBgearman_task_st\fP is released. .sp \fI\%gearman_worker_timeout()\fP and \fI\%gearman_worker_set_timeout()\fP get and set the current timeout value, in milliseconds, for the worker. .sp \fI\%gearman_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. \fI\%gearman_worker_set_workload_malloc_fn()\fP and \fI\%gearman_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 \fI\%gearman_worker_unregister_all()\fP to remove all functions that the worker has told the \fBgearmand\fP server about, or you can use \fI\%gearman_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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_success.30000664000076400007640000002125312142673665017576 0ustar00brianbrian00000000000000.TH "GEARMAN_SUCCESS" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .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_worker_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 .UNINDENT .INDENT 0.0 .TP .B GEARMAN_FAIL The function failed to complete the job. \fI\%GEARMAN_FATAL\fP is the deprecated name for \fI\%GEARMAN_FAIL\fP .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 .INDENT 0.0 .TP .B GEARMAN_UNKNOWN_OPTION Default state of task return value. .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 .SS DEPRECATED .INDENT 0.0 .TP .B GEARMAN_IGNORE_PACKET .UNINDENT .INDENT 0.0 .TP .B GEARMAN_MAX_RETURN .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://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/man/gearman_worker_create.30000664000076400007640000000621512142673666020764 0ustar00brianbrian00000000000000.TH "GEARMAN_WORKER_CREATE" "3" "May 09, 2013" "1.0.6" "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 reStructuredText. . .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B gearman_worker_st *gearman_worker_create(gearman_worker_st\fI\ *client\fP) .UNINDENT .INDENT 0.0 .TP .B gearman_worker_st *gearman_worker_clone(gearman_worker_st\fI\ *client\fP, const gearman_worker_st\fI\ *from\fP) .UNINDENT .INDENT 0.0 .TP .B void gearman_worker_free(gearman_worker_st\fI\ *client\fP) .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 \fI\%gearman_worker_clone()\fP is similar to \fI\%gearman_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 \fI\%gearman_worker_free()\fP when you are finished using it. \fI\%gearman_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 \fI\%gearman_worker_create()\fP or \fI\%gearman_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 \fI\%gearman_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 \fI\%gearman_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 .INDENT 0.0 .INDENT 3.5 .IP "See also" .sp \fIgearmand(8)\fP \fIlibgearman(3)\fP \fIgearman_strerror(3)\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2013, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. . gearmand-1.0.6/README0000664000076400007640000000433012107145705014440 0ustar00brianbrian00000000000000Hi! You've most likely downloaded this package as a tar.gz distribution, so you'll want to read Getting Started. If you are interested in developing or submitting patches to the project, read the Contributing and Coding Style sections. Getting Started --------------- You can grab a released version of Gearman from http://launchpad.net/gearmand/. If you want to work on the latest code, please read the file HACKING. To build, you can follow the normal: ./configure make make install You can also run 'make test' before installing to make sure everything checks out ok. Once you have it installed, you can start the Gearman job server with: gearmand -v This will start it while printing some verbose messages. To try running a job through it, look in the examples/ directory of this source and run: ./reverse_worker Once that is running, you can run your first job with: ./reverse_client "Hello, Gearman!" If all goes well, the reverse_worker application should have output: Job=H:lap:1 Workload=Hello, Gearman! Result=!namraeG ,olleH While the reverse_client returned: Result=!namraeG ,olleH If you want to start writing your own client and workers, be sure to check out the developer API at: http://gearman.info/libgearman.html You can also find other useful resources related to the project at: http://www.gearman.org/ Enjoy! Contributing ------------ If you are getting this code from https://launchpad.net/gearmand then continue reading. Otherwise these directions are not for you (well maybe...). To obtain code from https://launchpad.net/gearmand you will need to issue the following command: bzr branch lp:gearmand Once the tree is branched you will need to build the "configure" script. You can do this by running the script: ./config/autorun.sh It will set up all of the files you need to build the package. At that point it is just the typical "./configure; make; make test; make install" For a tarball release do a "make dist" and for an RPM type "make rpm". For patches please create a branch on launchpad and propose it to be merged into the trunk. You can find out more information on how to do this at the launchpad help site: https://help.launchpad.net/ Thanks and keep hacking! Cheers, -Brian Seattle, WA. gearmand-1.0.6/libhashkit/0000775000076400007640000000000012142673675015715 5ustar00brianbrian00000000000000gearmand-1.0.6/libhashkit/common.h0000664000076400007640000000430112107145705017341 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit 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 #include "libhashkit/hashkitcon.h" #include #include #include #include #include #ifndef __WORDSIZE # ifdef __MINGW32__ # define __WORDSIZE 32 # endif #endif #include #include "libhashkit/algorithm.h" #include "libhashkit/is.h" #include "libhashkit/string.h" #include "libhashkit/aes.h" #ifdef __cplusplus extern "C" { #endif void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result); int update_continuum(hashkit_st *hashkit); #ifdef __cplusplus } #endif gearmand-1.0.6/libhashkit/jenkins.cc0000664000076400007640000002035012107145705017652 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ /* * * By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this * code any way you wish, private, educational, or commercial. It's free. * Use for hash table lookup, or anything where one collision in 2^^32 is * acceptable. Do NOT use for cryptographic purposes. * http://burtleburtle.net/bob/hash/index.html * * Modified by Brian Pontz for libmemcached * TODO: * Add big endian support */ #include #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) #define mix(a,b,c) \ { \ a -= c; a ^= rot(c, 4); c += b; \ b -= a; b ^= rot(a, 6); a += c; \ c -= b; c ^= rot(b, 8); b += a; \ a -= c; a ^= rot(c,16); c += b; \ b -= a; b ^= rot(a,19); a += c; \ c -= b; c ^= rot(b, 4); b += a; \ } #define final(a,b,c) \ { \ c ^= b; c -= rot(b,14); \ a ^= c; a -= rot(c,11); \ b ^= a; b -= rot(a,25); \ c ^= b; c -= rot(b,16); \ a ^= c; a -= rot(c,4); \ b ^= a; b -= rot(a,14); \ c ^= b; c -= rot(b,24); \ } #define JENKINS_INITVAL 13 /* jenkins_hash() -- hash a variable-length key into a 32-bit value k : the key (the unaligned variable-length array of bytes) length : the length of the key, counting by bytes initval : can be any 4-byte value Returns a 32-bit value. Every bit of the key affects every bit of the return value. Two keys differing by one or two bits will have totally different hash values. The best hash table sizes are powers of 2. There is no need to do mod a prime (mod is sooo slow!). If you need less than 32 bits, use a bitmask. For example, if you need only 10 bits, do h = (h & hashmask(10)); In which case, the hash table should have hashsize(10) elements. */ uint32_t hashkit_jenkins(const char *key, size_t length, void *) { uint32_t a,b,c; /* internal state */ #ifndef WORDS_BIGENDIAN union { const void *ptr; size_t i; } u; u.ptr = key; #endif /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)length) + JENKINS_INITVAL; #ifndef WORDS_BIGENDIAN if ((u.i & 0x3) == 0) { const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ while (length > 12) { a += k[0]; b += k[1]; c += k[2]; mix(a,b,c); length -= 12; k += 3; } /*----------------------------- handle the last (probably partial) block */ /* * "k[2]&0xffffff" actually reads beyond the end of the string, but * then masks off the part it's not allowed to read. Because the * string is aligned, the masked-off tail is in the same word as the * rest of the string. Every machine with memory protection I've seen * does it on word boundaries, so is OK with this. But VALGRIND will * still catch it and complain. The masking trick does make the hash * noticably faster for short strings (like English words). */ switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; case 8 : b+=k[1]; a+=k[0]; break; case 7 : b+=k[1]&0xffffff; a+=k[0]; break; case 6 : b+=k[1]&0xffff; a+=k[0]; break; case 5 : b+=k[1]&0xff; a+=k[0]; break; case 4 : a+=k[0]; break; case 3 : a+=k[0]&0xffffff; break; case 2 : a+=k[0]&0xffff; break; case 1 : a+=k[0]&0xff; break; case 0 : return c; /* zero length strings require no mixing */ default: return c; } } else if ((u.i & 0x1) == 0) { const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ const uint8_t *k8; /*--------------- all but last block: aligned reads and different mixing */ while (length > 12) { a += k[0] + (((uint32_t)k[1])<<16); b += k[2] + (((uint32_t)k[3])<<16); c += k[4] + (((uint32_t)k[5])<<16); mix(a,b,c); length -= 12; k += 6; } /*----------------------------- handle the last (probably partial) block */ k8 = (const uint8_t *)k; switch(length) { case 12: c+=k[4]+(((uint32_t)k[5])<<16); b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ case 10: c+=k[4]; b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; case 9 : c+=k8[8]; /* fall through */ case 8 : b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ case 6 : b+=k[2]; a+=k[0]+(((uint32_t)k[1])<<16); break; case 5 : b+=k8[4]; /* fall through */ case 4 : a+=k[0]+(((uint32_t)k[1])<<16); break; case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ case 2 : a+=k[0]; break; case 1 : a+=k8[0]; break; case 0 : return c; /* zero length requires no mixing */ default: return c; } } else { /* need to read the key one byte at a time */ #endif /* little endian */ const uint8_t *k = (const uint8_t *)key; /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ while (length > 12) { a += k[0]; a += ((uint32_t)k[1])<<8; a += ((uint32_t)k[2])<<16; a += ((uint32_t)k[3])<<24; b += k[4]; b += ((uint32_t)k[5])<<8; b += ((uint32_t)k[6])<<16; b += ((uint32_t)k[7])<<24; c += k[8]; c += ((uint32_t)k[9])<<8; c += ((uint32_t)k[10])<<16; c += ((uint32_t)k[11])<<24; mix(a,b,c); length -= 12; k += 12; } /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { case 12: c+=((uint32_t)k[11])<<24; case 11: c+=((uint32_t)k[10])<<16; case 10: c+=((uint32_t)k[9])<<8; case 9 : c+=k[8]; case 8 : b+=((uint32_t)k[7])<<24; case 7 : b+=((uint32_t)k[6])<<16; case 6 : b+=((uint32_t)k[5])<<8; case 5 : b+=k[4]; case 4 : a+=((uint32_t)k[3])<<24; case 3 : a+=((uint32_t)k[2])<<16; case 2 : a+=((uint32_t)k[1])<<8; case 1 : a+=k[0]; break; case 0 : return c; default : return c; } #ifndef WORDS_BIGENDIAN } #endif final(a,b,c); return c; } gearmand-1.0.6/libhashkit/one_at_a_time.cc0000664000076400007640000000430012107145705020771 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ /* This has is Jenkin's "One at A time Hash". http://en.wikipedia.org/wiki/Jenkins_hash_function */ #include uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context) { const char *ptr= key; uint32_t value= 0; (void)context; 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; } gearmand-1.0.6/libhashkit/include.am0000664000076400007640000000506212107145705017647 0ustar00brianbrian00000000000000# vim:ft=automake # included from Top Level Makefile.am # All paths should be given relative to the root # # HashKit # Copyright (C) 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. noinst_LTLIBRARIES+= libhashkit/libhashkit.la noinst_HEADERS+= libhashkit/aes.h noinst_HEADERS+= libhashkit/algorithm.h noinst_HEADERS+= libhashkit/murmur3.h noinst_HEADERS+= libhashkit/common.h noinst_HEADERS+= libhashkit/is.h noinst_HEADERS+= libhashkit/rijndael.hpp noinst_HEADERS+= libhashkit/string.h noinst_HEADERS+= libhashkit/hashkit.h libhashkit_libhashkit_la_LIBADD= libhashkit_libhashkit_la_SOURCES= libhashkit_libhashkit_la_CXXFLAGS= libhashkit_libhashkit_la_CFLAGS= libhashkit_libhashkit_la_CXXFLAGS+= -DCONFIG_HEADER=@CONFIG_HEADER@ libhashkit_libhashkit_la_CFLAGS+= -DCONFIG_HEADER=@CONFIG_HEADER@ libhashkit_libhashkit_la_SOURCES+= libhashkit/aes.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/algorithm.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/behavior.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/crc32.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/digest.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/encrypt.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/fnv_32.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/fnv_64.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/function.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/has.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/hashkit.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/jenkins.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/ketama.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/md5.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/murmur.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/murmur3.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/murmur3_api.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/one_at_a_time.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/rijndael.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/str_algorithm.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/strerror.cc libhashkit_libhashkit_la_SOURCES+= libhashkit/string.cc if INCLUDE_HSIEH_SRC libhashkit_libhashkit_la_SOURCES+= libhashkit/hsieh.cc else libhashkit_libhashkit_la_SOURCES+= libhashkit/nohsieh.cc endif # library used for testing noinst_LTLIBRARIES+= libhashkit/libhashkitinc.la libhashkit_libhashkitinc_la_SOURCES= ${libhashkit_libhashkit_la_SOURCES} libhashkit_libhashkitinc_la_CFLAGS= ${libhashkit_libhashkit_la_CFLAGS} libhashkit_libhashkitinc_la_CXXFLAGS= ${libhashkit_libhashkit_la_CXXFLAGS} gearmand-1.0.6/libhashkit/encrypt.cc0000664000076400007640000000442412107145705017701 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libhashkit library * * Copyright (C) 2012 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 hashkit_string_st *hashkit_encrypt(hashkit_st *kit, const char* source, size_t source_length) { return aes_encrypt(static_cast(kit->_key), source, source_length); } hashkit_string_st *hashkit_decrypt(hashkit_st *kit, const char* source, size_t source_length) { return aes_decrypt(static_cast(kit->_key), source, source_length); } bool hashkit_key(hashkit_st *kit, const char *key, const size_t key_length) { if (kit->_key) { free(kit->_key); } kit->_key= aes_create_key(key, key_length); return bool(kit->_key); } gearmand-1.0.6/libhashkit/algorithm.h0000664000076400007640000000510512107145705020042 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 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. * */ /** * @file * @brief HashKit Header */ #pragma once uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context); uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context); uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context); uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context); uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context); uint32_t hashkit_crc32(const char *key, size_t key_length, void *context); uint32_t hashkit_hsieh(const char *key, size_t key_length, void *context); uint32_t hashkit_murmur(const char *key, size_t key_length, void *context); uint32_t hashkit_murmur3(const char *key, size_t key_length, void *context); uint32_t hashkit_jenkins(const char *key, size_t key_length, void *context); uint32_t hashkit_md5(const char *key, size_t key_length, void *context); gearmand-1.0.6/libhashkit/hashkit.h0000664000076400007640000000325212107145705017510 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit 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 #include gearmand-1.0.6/libhashkit/rijndael.hpp0000664000076400007640000000364512107145705020213 0ustar00brianbrian00000000000000/** * rijndael-alg-fst.h * * @version 3.0 (December 2000) * * Optimised ANSI C code for the Rijndael cipher (now AES) * * @author Vincent Rijmen * @author Antoon Bosselaers * @author Paulo Barreto * * This code is hereby placed in the public domain. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''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 AUTHORS 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 MAXKC (256/32) #define MAXKB (256/8) #define MAXNR 14 #define AES_MAXKC MAXKC #define AES_MAXKB MAXKB #define AES_MAXNR MAXNR typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]); void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]); #ifdef INTERMEDIATE_VALUE_KAT void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds); void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds); #endif /* INTERMEDIATE_VALUE_KAT */ gearmand-1.0.6/libhashkit/rijndael.cc0000664000076400007640000017746612107145705020026 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ /** * rijndael-alg-fst.c * * @version 3.0 (December 2000) * * Optimised ANSI C code for the Rijndael cipher (now AES) * * @author Vincent Rijmen * @author Antoon Bosselaers * @author Paulo Barreto * * This code is hereby placed in the public domain. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''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 AUTHORS 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 "libhashkit/rijndael.hpp" /* Te0[x] = S [x].[02, 01, 01, 03]; Te1[x] = S [x].[03, 02, 01, 01]; Te2[x] = S [x].[01, 03, 02, 01]; Te3[x] = S [x].[01, 01, 03, 02]; Te4[x] = S [x].[01, 01, 01, 01]; Td0[x] = Si[x].[0e, 09, 0d, 0b]; Td1[x] = Si[x].[0b, 0e, 09, 0d]; Td2[x] = Si[x].[0d, 0b, 0e, 09]; Td3[x] = Si[x].[09, 0d, 0b, 0e]; Td4[x] = Si[x].[01, 01, 01, 01]; */ static const u32 Te0[256] = { 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, }; static const u32 Te1[256] = { 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, }; static const u32 Te2[256] = { 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, }; static const u32 Te3[256] = { 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, }; static const u32 Te4[256] = { 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, }; static const u32 Td0[256] = { 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, }; static const u32 Td1[256] = { 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, }; static const u32 Td2[256] = { 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, }; static const u32 Td3[256] = { 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, }; static const u32 Td4[256] = { 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, }; static const u32 rcon[] = { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ }; #define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) #ifdef _MSC_VER #define GETU32(p) SWAP(*((u32 *)(p))) #define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } #else #define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) #define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } #endif /** * Expand the cipher key into the encryption key schedule. * * @return the number of rounds for the given cipher key size. */ int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) { int i = 0; u32 temp; rk[0] = GETU32(cipherKey ); rk[1] = GETU32(cipherKey + 4); rk[2] = GETU32(cipherKey + 8); rk[3] = GETU32(cipherKey + 12); if (keyBits == 128) { for (;;) { temp = rk[3]; rk[4] = rk[0] ^ (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (Te4[(temp ) & 0xff] & 0x0000ff00) ^ (Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[5] = rk[1] ^ rk[4]; rk[6] = rk[2] ^ rk[5]; rk[7] = rk[3] ^ rk[6]; if (++i == 10) { return 10; } rk += 4; } } rk[4] = GETU32(cipherKey + 16); rk[5] = GETU32(cipherKey + 20); if (keyBits == 192) { for (;;) { temp = rk[ 5]; rk[ 6] = rk[ 0] ^ (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (Te4[(temp ) & 0xff] & 0x0000ff00) ^ (Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 7] = rk[ 1] ^ rk[ 6]; rk[ 8] = rk[ 2] ^ rk[ 7]; rk[ 9] = rk[ 3] ^ rk[ 8]; if (++i == 8) { return 12; } rk[10] = rk[ 4] ^ rk[ 9]; rk[11] = rk[ 5] ^ rk[10]; rk += 6; } } rk[6] = GETU32(cipherKey + 24); rk[7] = GETU32(cipherKey + 28); if (keyBits == 256) { for (;;) { temp = rk[ 7]; rk[ 8] = rk[ 0] ^ (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (Te4[(temp ) & 0xff] & 0x0000ff00) ^ (Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 9] = rk[ 1] ^ rk[ 8]; rk[10] = rk[ 2] ^ rk[ 9]; rk[11] = rk[ 3] ^ rk[10]; if (++i == 7) { return 14; } temp = rk[11]; rk[12] = rk[ 4] ^ (Te4[(temp >> 24) ] & 0xff000000) ^ (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(temp ) & 0xff] & 0x000000ff); rk[13] = rk[ 5] ^ rk[12]; rk[14] = rk[ 6] ^ rk[13]; rk[15] = rk[ 7] ^ rk[14]; rk += 8; } } return 0; } /** * Expand the cipher key into the decryption key schedule. * * @return the number of rounds for the given cipher key size. */ int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) { int Nr, i, j; u32 temp; /* expand the cipher key: */ Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits); /* invert the order of the round keys: */ for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; } /* apply the inverse MixColumn transform to all round keys but the first and the last: */ for (i = 1; i < Nr; i++) { rk += 4; rk[0] = Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[0] ) & 0xff] & 0xff]; rk[1] = Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[1] ) & 0xff] & 0xff]; rk[2] = Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[2] ) & 0xff] & 0xff]; rk[3] = Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[3] ) & 0xff] & 0xff]; } return Nr; } void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]) { u32 s0, s1, s2, s3, t0, t1, t2, t3; #ifndef FULL_UNROLL int r; #endif /* ?FULL_UNROLL */ /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(pt ) ^ rk[0]; s1 = GETU32(pt + 4) ^ rk[1]; s2 = GETU32(pt + 8) ^ rk[2]; s3 = GETU32(pt + 12) ^ rk[3]; #ifdef FULL_UNROLL /* round 1: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7]; /* round 2: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11]; /* round 3: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15]; /* round 4: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19]; /* round 5: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23]; /* round 6: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27]; /* round 7: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31]; /* round 8: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35]; /* round 9: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39]; if (Nr > 10) { /* round 10: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43]; /* round 11: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47]; if (Nr > 12) { /* round 12: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51]; /* round 13: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55]; } } rk += Nr << 2; #else /* !FULL_UNROLL */ /* * Nr - 1 full rounds: */ r = Nr >> 1; for (;;) { t0 = Te0[(s0 >> 24) ] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[(s3 ) & 0xff] ^ rk[4]; t1 = Te0[(s1 >> 24) ] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[(s0 ) & 0xff] ^ rk[5]; t2 = Te0[(s2 >> 24) ] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[(s1 ) & 0xff] ^ rk[6]; t3 = Te0[(s3 >> 24) ] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[(s2 ) & 0xff] ^ rk[7]; rk += 8; if (--r == 0) { break; } s0 = Te0[(t0 >> 24) ] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[(t3 ) & 0xff] ^ rk[0]; s1 = Te0[(t1 >> 24) ] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[(t0 ) & 0xff] ^ rk[1]; s2 = Te0[(t2 >> 24) ] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[(t1 ) & 0xff] ^ rk[2]; s3 = Te0[(t3 >> 24) ] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[(t2 ) & 0xff] ^ rk[3]; } #endif /* ?FULL_UNROLL */ /* * apply last round and * map cipher state to byte array block: */ s0 = (Te4[(t0 >> 24) ] & 0xff000000) ^ (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t3 ) & 0xff] & 0x000000ff) ^ rk[0]; PUTU32(ct , s0); s1 = (Te4[(t1 >> 24) ] & 0xff000000) ^ (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t0 ) & 0xff] & 0x000000ff) ^ rk[1]; PUTU32(ct + 4, s1); s2 = (Te4[(t2 >> 24) ] & 0xff000000) ^ (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t1 ) & 0xff] & 0x000000ff) ^ rk[2]; PUTU32(ct + 8, s2); s3 = (Te4[(t3 >> 24) ] & 0xff000000) ^ (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t2 ) & 0xff] & 0x000000ff) ^ rk[3]; PUTU32(ct + 12, s3); } void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]) { u32 s0, s1, s2, s3, t0, t1, t2, t3; #ifndef FULL_UNROLL int r; #endif /* ?FULL_UNROLL */ /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(ct ) ^ rk[0]; s1 = GETU32(ct + 4) ^ rk[1]; s2 = GETU32(ct + 8) ^ rk[2]; s3 = GETU32(ct + 12) ^ rk[3]; #ifdef FULL_UNROLL /* round 1: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7]; /* round 2: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11]; /* round 3: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15]; /* round 4: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19]; /* round 5: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23]; /* round 6: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27]; /* round 7: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31]; /* round 8: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35]; /* round 9: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39]; if (Nr > 10) { /* round 10: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43]; /* round 11: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47]; if (Nr > 12) { /* round 12: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51]; /* round 13: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55]; } } rk += Nr << 2; #else /* !FULL_UNROLL */ /* * Nr - 1 full rounds: */ r = Nr >> 1; for (;;) { t0 = Td0[(s0 >> 24) ] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[(s1 ) & 0xff] ^ rk[4]; t1 = Td0[(s1 >> 24) ] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[(s2 ) & 0xff] ^ rk[5]; t2 = Td0[(s2 >> 24) ] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[(s3 ) & 0xff] ^ rk[6]; t3 = Td0[(s3 >> 24) ] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[(s0 ) & 0xff] ^ rk[7]; rk += 8; if (--r == 0) { break; } s0 = Td0[(t0 >> 24) ] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[(t1 ) & 0xff] ^ rk[0]; s1 = Td0[(t1 >> 24) ] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[(t2 ) & 0xff] ^ rk[1]; s2 = Td0[(t2 >> 24) ] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[(t3 ) & 0xff] ^ rk[2]; s3 = Td0[(t3 >> 24) ] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[(t0 ) & 0xff] ^ rk[3]; } #endif /* ?FULL_UNROLL */ /* * apply last round and * map cipher state to byte array block: */ s0 = (Td4[(t0 >> 24) ] & 0xff000000) ^ (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t1 ) & 0xff] & 0x000000ff) ^ rk[0]; PUTU32(pt , s0); s1 = (Td4[(t1 >> 24) ] & 0xff000000) ^ (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t2 ) & 0xff] & 0x000000ff) ^ rk[1]; PUTU32(pt + 4, s1); s2 = (Td4[(t2 >> 24) ] & 0xff000000) ^ (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t3 ) & 0xff] & 0x000000ff) ^ rk[2]; PUTU32(pt + 8, s2); s3 = (Td4[(t3 >> 24) ] & 0xff000000) ^ (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t0 ) & 0xff] & 0x000000ff) ^ rk[3]; PUTU32(pt + 12, s3); } #ifdef INTERMEDIATE_VALUE_KAT void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) { int r; u32 s0, s1, s2, s3, t0, t1, t2, t3; /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(block ) ^ rk[0]; s1 = GETU32(block + 4) ^ rk[1]; s2 = GETU32(block + 8) ^ rk[2]; s3 = GETU32(block + 12) ^ rk[3]; rk += 4; /* * Nr - 1 full rounds: */ for (r = (rounds < Nr ? rounds : Nr - 1); r > 0; r--) { t0 = Te0[(s0 >> 24) ] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[(s3 ) & 0xff] ^ rk[0]; t1 = Te0[(s1 >> 24) ] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[(s0 ) & 0xff] ^ rk[1]; t2 = Te0[(s2 >> 24) ] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[(s1 ) & 0xff] ^ rk[2]; t3 = Te0[(s3 >> 24) ] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[(s2 ) & 0xff] ^ rk[3]; s0 = t0; s1 = t1; s2 = t2; s3 = t3; rk += 4; } /* * apply last round and * map cipher state to byte array block: */ if (rounds == Nr) { t0 = (Te4[(s0 >> 24) ] & 0xff000000) ^ (Te4[(s1 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(s2 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(s3 ) & 0xff] & 0x000000ff) ^ rk[0]; t1 = (Te4[(s1 >> 24) ] & 0xff000000) ^ (Te4[(s2 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(s3 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(s0 ) & 0xff] & 0x000000ff) ^ rk[1]; t2 = (Te4[(s2 >> 24) ] & 0xff000000) ^ (Te4[(s3 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(s0 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(s1 ) & 0xff] & 0x000000ff) ^ rk[2]; t3 = (Te4[(s3 >> 24) ] & 0xff000000) ^ (Te4[(s0 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(s1 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(s2 ) & 0xff] & 0x000000ff) ^ rk[3]; s0 = t0; s1 = t1; s2 = t2; s3 = t3; } PUTU32(block , s0); PUTU32(block + 4, s1); PUTU32(block + 8, s2); PUTU32(block + 12, s3); } void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) { int r; u32 s0, s1, s2, s3, t0, t1, t2, t3; /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(block ) ^ rk[0]; s1 = GETU32(block + 4) ^ rk[1]; s2 = GETU32(block + 8) ^ rk[2]; s3 = GETU32(block + 12) ^ rk[3]; rk += 4; /* * Nr - 1 full rounds: */ for (r = (rounds < Nr ? rounds : Nr) - 1; r > 0; r--) { t0 = Td0[(s0 >> 24) ] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[(s1 ) & 0xff] ^ rk[0]; t1 = Td0[(s1 >> 24) ] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[(s2 ) & 0xff] ^ rk[1]; t2 = Td0[(s2 >> 24) ] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[(s3 ) & 0xff] ^ rk[2]; t3 = Td0[(s3 >> 24) ] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[(s0 ) & 0xff] ^ rk[3]; s0 = t0; s1 = t1; s2 = t2; s3 = t3; rk += 4; } /* * complete the last round and * map cipher state to byte array block: */ t0 = (Td4[(s0 >> 24) ] & 0xff000000) ^ (Td4[(s3 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(s2 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(s1 ) & 0xff] & 0x000000ff); t1 = (Td4[(s1 >> 24) ] & 0xff000000) ^ (Td4[(s0 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(s3 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(s2 ) & 0xff] & 0x000000ff); t2 = (Td4[(s2 >> 24) ] & 0xff000000) ^ (Td4[(s1 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(s0 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(s3 ) & 0xff] & 0x000000ff); t3 = (Td4[(s3 >> 24) ] & 0xff000000) ^ (Td4[(s2 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(s1 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(s0 ) & 0xff] & 0x000000ff); if (rounds == Nr) { t0 ^= rk[0]; t1 ^= rk[1]; t2 ^= rk[2]; t3 ^= rk[3]; } PUTU32(block , t0); PUTU32(block + 4, t1); PUTU32(block + 8, t2); PUTU32(block + 12, t3); } #endif /* INTERMEDIATE_VALUE_KAT */ gearmand-1.0.6/libhashkit/digest.cc0000664000076400007640000000617312107145705017477 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2010-2012 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 uint32_t hashkit_digest(const hashkit_st *self, const char *key, size_t key_length) { return self->base_hash.function(key, key_length, self->base_hash.context); } uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algorithm_t hash_algorithm) { switch (hash_algorithm) { case HASHKIT_HASH_DEFAULT: return libhashkit_one_at_a_time(key, key_length); case HASHKIT_HASH_MD5: return libhashkit_md5(key, key_length); case HASHKIT_HASH_CRC: return libhashkit_crc32(key, key_length); case HASHKIT_HASH_FNV1_64: return libhashkit_fnv1_64(key, key_length); case HASHKIT_HASH_FNV1A_64: return libhashkit_fnv1a_64(key, key_length); case HASHKIT_HASH_FNV1_32: return libhashkit_fnv1_32(key, key_length); case HASHKIT_HASH_FNV1A_32: return libhashkit_fnv1a_32(key, key_length); case HASHKIT_HASH_HSIEH: #ifdef HAVE_HSIEH_HASH return libhashkit_hsieh(key, key_length); #else return 1; #endif case HASHKIT_HASH_MURMUR3: return libhashkit_murmur3(key, key_length); case HASHKIT_HASH_MURMUR: #ifdef HAVE_MURMUR_HASH return libhashkit_murmur(key, key_length); #else return 1; #endif case HASHKIT_HASH_JENKINS: return libhashkit_jenkins(key, key_length); case HASHKIT_HASH_CUSTOM: case HASHKIT_HASH_MAX: default: if (DEBUG) { fprintf(stderr, "hashkit_hash_t was extended but libhashkit_generate_value was not updated\n"); fflush(stderr); assert(0); } break; } return 1; } gearmand-1.0.6/libhashkit/algorithm.cc0000664000076400007640000000607612107145705020210 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2006-2012 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 "libhashkit/common.h" uint32_t libhashkit_one_at_a_time(const char *key, size_t key_length) { return hashkit_one_at_a_time(key, key_length, NULL); } uint32_t libhashkit_fnv1_64(const char *key, size_t key_length) { return hashkit_fnv1_64(key, key_length, NULL); } uint32_t libhashkit_fnv1a_64(const char *key, size_t key_length) { return hashkit_fnv1a_64(key, key_length, NULL); } uint32_t libhashkit_fnv1_32(const char *key, size_t key_length) { return hashkit_fnv1_32(key, key_length, NULL); } uint32_t libhashkit_fnv1a_32(const char *key, size_t key_length) { return hashkit_fnv1a_32(key, key_length, NULL); } uint32_t libhashkit_crc32(const char *key, size_t key_length) { return hashkit_crc32(key, key_length, NULL); } uint32_t libhashkit_hsieh(const char *key, size_t key_length) { return hashkit_hsieh(key, key_length, NULL); } uint32_t libhashkit_murmur3(const char *key, size_t key_length) { return hashkit_murmur3(key, key_length, NULL); } uint32_t libhashkit_murmur(const char *key, size_t key_length) { return hashkit_murmur(key, key_length, NULL); } uint32_t libhashkit_jenkins(const char *key, size_t key_length) { return hashkit_jenkins(key, key_length, NULL); } uint32_t libhashkit_md5(const char *key, size_t key_length) { return hashkit_md5(key, key_length, NULL); } void libhashkit_md5_signature(const unsigned char *key, size_t length, unsigned char *result) { md5_signature(key, (uint32_t)length, result); } gearmand-1.0.6/libhashkit/md5.cc0000664000076400007640000003273212113572044016702 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ /* This Library has been modified from its original form by Brian Aker (brian@tangent.org) See below for original Copyright. */ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include #include #include #define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) #if GCC_VERSION > 40600 # pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" #endif /* POINTER defines a generic pointer type */ typedef unsigned char *POINTER; typedef const unsigned char *CONST_POINTER; /* UINT4 defines a four byte word */ typedef unsigned int UINT4; /* MD5 context. */ typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; static void MD5Init (MD5_CTX *context); /* context */ static void MD5Update ( MD5_CTX *context, /* context */ const unsigned char *input, /* input block */ unsigned int inputLen); /* length of input block */ static void MD5Final ( unsigned char digest[16], /* message digest */ MD5_CTX *context); /* context */ /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform (UINT4 state[4], const unsigned char block[64]); static void Encode (unsigned char *output, UINT4 *input, unsigned int len); static void Decode(UINT4 *output, const unsigned char *input, unsigned int len); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* Just a simple method for getting the signature result must be == 16 */ void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result) { MD5_CTX my_md5; MD5Init(&my_md5); (void)MD5Update(&my_md5, key, length); MD5Final(result, &my_md5); } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ static void MD5Init (MD5_CTX *context) /* context */ { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ static void MD5Update ( MD5_CTX *context, /* context */ const unsigned char *input, /* input block */ unsigned int inputLen) /* length of input block */ { unsigned int i, idx, partLen; /* Compute number of bytes mod 64 */ idx = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) context->count[1]++; context->count[1] += ((UINT4)inputLen >> 29); partLen = 64 - idx; /* Transform as many times as possible. */ if (inputLen >= partLen) { memcpy((POINTER)&context->buffer[idx], (CONST_POINTER)input, partLen); MD5Transform(context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, (CONST_POINTER)&input[i]); idx = 0; } else i = 0; /* Buffer remaining input */ memcpy((POINTER)&context->buffer[idx], (CONST_POINTER)&input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ static void MD5Final ( unsigned char digest[16], /* message digest */ MD5_CTX *context) /* context */ { unsigned char bits[8]; unsigned int idx, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ idx = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (idx < 56) ? (56 - idx) : (120 - idx); MD5Update (context, PADDING, padLen); /* Append length (before padding) */ MD5Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ memset((POINTER)context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform ( UINT4 state[4], const unsigned char block[64]) { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ memset((POINTER)x, 0, sizeof (x)); } /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode ( unsigned char *output, UINT4 *input, unsigned int len) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ static void Decode ( UINT4 *output, const unsigned char *input, unsigned int len) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } uint32_t hashkit_md5(const char *key, size_t key_length, void *context) { unsigned char results[16]; (void)context; md5_signature((unsigned char*)key, (unsigned int)key_length, results); return ((uint32_t) (results[3] & 0xFF) << 24) | ((uint32_t) (results[2] & 0xFF) << 16) | ((uint32_t) (results[1] & 0xFF) << 8) | (results[0] & 0xFF); } gearmand-1.0.6/libhashkit/is.h0000664000076400007640000000344012107145705016467 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit 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 #define hashkit_is_allocated(__object) ((__object)->options.is_allocated) #define hashkit_is_initialized(__object) ((__object)->options.is_initialized) gearmand-1.0.6/libhashkit/aes.cc0000664000076400007640000001262512107145705016767 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libhashkit library * * Copyright (C) 2012 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 "libhashkit/common.h" #include "libhashkit/rijndael.hpp" #include #define AES_KEY_LENGTH 256 /* 128, 192, 256 */ #define AES_BLOCK_SIZE 16 enum encrypt_t { AES_ENCRYPT, AES_DECRYPT }; struct _key_t { int nr; uint32_t rk[4*(AES_MAXNR +1)]; }; struct aes_key_t { _key_t encode_key; _key_t decode_key; }; aes_key_t* aes_create_key(const char *key, const size_t key_length) { aes_key_t* _aes_key= (aes_key_t*)calloc(1, sizeof(aes_key_t)); if (_aes_key) { uint8_t rkey[AES_KEY_LENGTH/8]; uint8_t *rkey_end= rkey +AES_KEY_LENGTH/8; const char *key_end= key +key_length; memset(rkey, 0, sizeof(rkey)); /* Set initial key */ uint8_t *ptr= rkey; const char* sptr= key; for (; sptr < key_end; ptr++,sptr++) { if (ptr == rkey_end) { ptr= rkey; /* Just loop over tmp_key until we used all key */ } *ptr^= (uint8_t) *sptr; } _aes_key->decode_key.nr= rijndaelKeySetupDec(_aes_key->decode_key.rk, rkey, AES_KEY_LENGTH); _aes_key->encode_key.nr= rijndaelKeySetupEnc(_aes_key->encode_key.rk, rkey, AES_KEY_LENGTH); } return _aes_key; } aes_key_t* aes_clone_key(aes_key_t *_aes_key) { if (_aes_key == NULL) { return NULL; } aes_key_t* _aes_clone_key= (aes_key_t*)calloc(1, sizeof(aes_key_t)); if (_aes_clone_key) { memcpy(_aes_clone_key, _aes_key, sizeof(aes_key_t)); } return _aes_clone_key; } hashkit_string_st* aes_encrypt(aes_key_t *_aes_key, const char* source, size_t source_length) { if (_aes_key == NULL) { return NULL; } size_t num_blocks= source_length/AES_BLOCK_SIZE; hashkit_string_st* destination= hashkit_string_create(source_length); if (destination) { char *dest= hashkit_string_c_str_mutable(destination); for (size_t x= num_blocks; x > 0; x--) /* Encode complete blocks */ { rijndaelEncrypt(_aes_key->encode_key.rk, _aes_key->encode_key.nr, (const uint8_t*) source, (uint8_t*) dest); source+= AES_BLOCK_SIZE; dest+= AES_BLOCK_SIZE; } uint8_t block[AES_BLOCK_SIZE]; char pad_len= AES_BLOCK_SIZE - (source_length - AES_BLOCK_SIZE*num_blocks); memcpy(block, source, 16 -pad_len); memset(block + AES_BLOCK_SIZE -pad_len, pad_len, pad_len); rijndaelEncrypt(_aes_key->encode_key.rk, _aes_key->encode_key.nr, block, (uint8_t*) dest); hashkit_string_set_length(destination, AES_BLOCK_SIZE*(num_blocks + 1)); } return destination; } hashkit_string_st* aes_decrypt(aes_key_t *_aes_key, const char* source, size_t source_length) { if (_aes_key == NULL) { return NULL; } size_t num_blocks= source_length/AES_BLOCK_SIZE; if ((source_length != num_blocks*AES_BLOCK_SIZE) or num_blocks ==0 ) { return NULL; } hashkit_string_st* destination= hashkit_string_create(source_length); if (destination) { char *dest= hashkit_string_c_str_mutable(destination); for (size_t x = num_blocks-1; x > 0; x--) { rijndaelDecrypt(_aes_key->decode_key.rk, _aes_key->decode_key.nr, (const uint8_t*) source, (uint8_t*) dest); source+= AES_BLOCK_SIZE; dest+= AES_BLOCK_SIZE; } uint8_t block[AES_BLOCK_SIZE]; rijndaelDecrypt(_aes_key->decode_key.rk, _aes_key->decode_key.nr, (const uint8_t*) source, block); /* Use last char in the block as size */ unsigned int pad_len= (unsigned int) (unsigned char) block[AES_BLOCK_SIZE-1]; if (pad_len > AES_BLOCK_SIZE) { hashkit_string_free(destination); return NULL; } /* We could also check whole padding but we do not really need this */ memcpy(dest, block, AES_BLOCK_SIZE - pad_len); hashkit_string_set_length(destination, AES_BLOCK_SIZE*num_blocks - pad_len); } return destination; } gearmand-1.0.6/libhashkit/fnv_64.cc0000664000076400007640000000515112107145705017315 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 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. * */ #include #if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH) /* FNV hash'es lifted from Dustin Sallings work */ static uint64_t FNV_64_INIT= 0xcbf29ce484222325; static uint64_t FNV_64_PRIME= 0x100000001b3; uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *) { /* Thanks to pierre@demartines.com for the pointer */ uint64_t hash= FNV_64_INIT; for (size_t x= 0; x < key_length; x++) { hash *= FNV_64_PRIME; hash ^= (uint64_t)key[x]; } return (uint32_t)hash; } uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *) { uint32_t hash= (uint32_t) FNV_64_INIT; for (size_t x= 0; x < key_length; x++) { uint32_t val= (uint32_t)key[x]; hash ^= val; hash *= (uint32_t) FNV_64_PRIME; } return hash; } #else uint32_t hashkit_fnv1_64(const char *, size_t, void *) { return 0; } uint32_t hashkit_fnv1a_64(const char *, size_t, void *) { return 0; } #endif gearmand-1.0.6/libhashkit/ketama.cc0000664000076400007640000001402212107145705017452 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ #include #include #if 0 static uint32_t ketama_server_hash(const char *key, unsigned int key_length, int alignment) { unsigned char results[16]; md5_signature((unsigned char*)key, key_length, results); return ((uint32_t) (results[3 + alignment * 4] & 0xFF) << 24) | ((uint32_t) (results[2 + alignment * 4] & 0xFF) << 16) | ((uint32_t) (results[1 + alignment * 4] & 0xFF) << 8) | (results[0 + alignment * 4] & 0xFF); } static int continuum_points_cmp(const void *t1, const void *t2) { hashkit_continuum_point_st *ct1= (hashkit_continuum_point_st *)t1; hashkit_continuum_point_st *ct2= (hashkit_continuum_point_st *)t2; if (ct1->value == ct2->value) return 0; else if (ct1->value > ct2->value) return 1; else return -1; } int update_continuum(hashkit_st *hashkit) { uint32_t count; uint32_t continuum_index= 0; uint32_t value; uint32_t points_index; uint32_t points_count= 0; uint32_t points_per_server; uint32_t points_per_hash; uint64_t total_weight= 0; uint32_t live_servers; uint8_t *context; if (hashkit->active_fn != NULL || hashkit->weight_fn != NULL) { live_servers= 0; for (count= 0, context= hashkit->list; count < hashkit->list_size; count++, context+= hashkit->context_size) { if (hashkit->active_fn != NULL) { if (hashkit->active_fn(context)) live_servers++; else continue; } if (hashkit->weight_fn != NULL) total_weight+= hashkit->weight_fn(context); } } if (hashkit->active_fn == NULL) live_servers= (uint32_t)hashkit->list_size; if (live_servers == 0) return 0; if (hashkit->weight_fn == NULL) { points_per_server= HASHKIT_POINTS_PER_NODE; points_per_hash= 1; } else { points_per_server= HASHKIT_POINTS_PER_NODE_WEIGHTED; points_per_hash= 4; } if (live_servers > hashkit->continuum_count) { hashkit_continuum_point_st *new_continuum; new_continuum= realloc(hashkit->continuum, sizeof(hashkit_continuum_point_st) * (live_servers + HASHKIT_CONTINUUM_ADDITION) * points_per_server); if (new_continuum == NULL) return ENOMEM; hashkit->continuum= new_continuum; hashkit->continuum_count= live_servers + HASHKIT_CONTINUUM_ADDITION; } for (count= 0, context= hashkit->list; count < hashkit->list_size; count++, context+= hashkit->context_size) { if (hashkit->active_fn != NULL && hashkit->active_fn(context) == false) continue; if (hashkit->weight_fn != NULL) { float pct = (float)hashkit->weight_fn(context) / (float)total_weight; points_per_server= (uint32_t) ((floorf((float) (pct * HASHKIT_POINTS_PER_NODE_WEIGHTED / 4 * (float)live_servers + 0.0000000001))) * 4); } for (points_index= 0; points_index < points_per_server / points_per_hash; points_index++) { char sort_host[HASHKIT_CONTINUUM_KEY_SIZE]= ""; size_t sort_host_length; if (hashkit->continuum_key_fn == NULL) { sort_host_length= (size_t) snprintf(sort_host, HASHKIT_CONTINUUM_KEY_SIZE, "%u", points_index); } else { sort_host_length= hashkit->continuum_key_fn(sort_host, HASHKIT_CONTINUUM_KEY_SIZE, points_index, context); } if (hashkit->weight_fn == NULL) { if (hashkit->continuum_hash_fn == NULL) value= hashkit_default(sort_host, sort_host_length); else value= hashkit->continuum_hash_fn(sort_host, sort_host_length); hashkit->continuum[continuum_index].index= count; hashkit->continuum[continuum_index++].value= value; } else { unsigned int i; for (i = 0; i < points_per_hash; i++) { value= ketama_server_hash(sort_host, (uint32_t) sort_host_length, (int) i); hashkit->continuum[continuum_index].index= count; hashkit->continuum[continuum_index++].value= value; } } } points_count+= points_per_server; } hashkit->continuum_points_count= points_count; qsort(hashkit->continuum, hashkit->continuum_points_count, sizeof(hashkit_continuum_point_st), continuum_points_cmp); return 0; } #endif gearmand-1.0.6/libhashkit/nohsieh.cc0000664000076400007640000000342712107145705017654 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit 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 #ifdef HAVE_HSIEH_HASH #error "not supported" #else uint32_t hashkit_hsieh(const char *, size_t , void *) { return 0; } #endif gearmand-1.0.6/libhashkit/murmur3_api.cc0000664000076400007640000000364112107145705020460 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2012 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 "libhashkit/common.h" #include "libhashkit/murmur3.h" uint32_t hashkit_murmur3(const char *key, size_t length, void *) { const uint32_t seed= (0xdeadbeef * (uint32_t)length); uint32_t ret; MurmurHash3_x86_32(key, int(length), seed, &ret); return ret; } gearmand-1.0.6/libhashkit/murmur3.cc0000664000076400007640000001663112107145705017632 0ustar00brianbrian00000000000000//----------------------------------------------------------------------------- //MurmurHash3 was written by Austin Appleby, and is placed in the public //domain. The author hereby disclaims copyright to this source code. // Note - The x86 and x64 versions do _not_ produce the same results, as the // algorithms are optimized for their respective platforms. You can still // compile and run any of them on any platform, but your performance with the // non-native version will be less than optimal. #include "libhashkit/hashkitcon.h" #include "libhashkit/murmur3.h" //----------------------------------------------------------------------------- // Platform-specific functions and macros #ifdef __GNUC__ #define FORCE_INLINE __attribute__((always_inline)) inline #else #define FORCE_INLINE inline #endif static FORCE_INLINE uint32_t rotl32 ( uint32_t x, int8_t r ) { return (x << r) | (x >> (32 - r)); } static FORCE_INLINE uint64_t rotl64 ( uint64_t x, int8_t r ) { return (x << r) | (x >> (64 - r)); } #define ROTL32(x,y) rotl32(x,y) #define ROTL64(x,y) rotl64(x,y) #define BIG_CONSTANT(x) (x##LLU) //----------------------------------------------------------------------------- // Block read - if your platform needs to do endian-swapping or can only // handle aligned reads, do the conversion here #define getblock(p, i) (p[i]) //----------------------------------------------------------------------------- // Finalization mix - force all bits of a hash block to avalanche static FORCE_INLINE uint32_t fmix32 ( uint32_t h ) { h ^= h >> 16; h *= 0x85ebca6b; h ^= h >> 13; h *= 0xc2b2ae35; h ^= h >> 16; return h; } //---------- static FORCE_INLINE uint64_t fmix64 ( uint64_t k ) { k ^= k >> 33; k *= BIG_CONSTANT(0xff51afd7ed558ccd); k ^= k >> 33; k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53); k ^= k >> 33; return k; } //----------------------------------------------------------------------------- void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ) { const uint8_t * data = (const uint8_t*)key; const int nblocks = len / 4; int i; uint32_t h1 = seed; uint32_t c1 = 0xcc9e2d51; uint32_t c2 = 0x1b873593; //---------- // body const uint32_t * blocks = (const uint32_t *)(data + nblocks*4); for(i = -nblocks; i; i++) { uint32_t k1 = getblock(blocks,i); k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; h1 = ROTL32(h1,13); h1 = h1*5+0xe6546b64; } //---------- // tail const uint8_t * tail = (const uint8_t*)(data + nblocks*4); uint32_t k1 = 0; switch(len & 3) { case 3: k1 ^= tail[2] << 16; case 2: k1 ^= tail[1] << 8; case 1: k1 ^= tail[0]; k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; }; //---------- // finalization h1 ^= len; h1 = fmix32(h1); *(uint32_t*)out = h1; } //----------------------------------------------------------------------------- void MurmurHash3_x86_128 ( const void * key, const int len, uint32_t seed, void * out ) { const uint8_t * data = (const uint8_t*)key; const int nblocks = len / 16; int i; uint32_t h1 = seed; uint32_t h2 = seed; uint32_t h3 = seed; uint32_t h4 = seed; uint32_t c1 = 0x239b961b; uint32_t c2 = 0xab0e9789; uint32_t c3 = 0x38b34ae5; uint32_t c4 = 0xa1e38b93; //---------- // body const uint32_t * blocks = (const uint32_t *)(data + nblocks*16); for(i = -nblocks; i; i++) { uint32_t k1 = getblock(blocks,i*4+0); uint32_t k2 = getblock(blocks,i*4+1); uint32_t k3 = getblock(blocks,i*4+2); uint32_t k4 = getblock(blocks,i*4+3); k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b; k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2; h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747; k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3; h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35; k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4; h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17; } //---------- // tail const uint8_t * tail = (const uint8_t*)(data + nblocks*16); uint32_t k1 = 0; uint32_t k2 = 0; uint32_t k3 = 0; uint32_t k4 = 0; switch(len & 15) { case 15: k4 ^= tail[14] << 16; case 14: k4 ^= tail[13] << 8; case 13: k4 ^= tail[12] << 0; k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4; case 12: k3 ^= tail[11] << 24; case 11: k3 ^= tail[10] << 16; case 10: k3 ^= tail[ 9] << 8; case 9: k3 ^= tail[ 8] << 0; k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3; case 8: k2 ^= tail[ 7] << 24; case 7: k2 ^= tail[ 6] << 16; case 6: k2 ^= tail[ 5] << 8; case 5: k2 ^= tail[ 4] << 0; k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2; case 4: k1 ^= tail[ 3] << 24; case 3: k1 ^= tail[ 2] << 16; case 2: k1 ^= tail[ 1] << 8; case 1: k1 ^= tail[ 0] << 0; k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; }; //---------- // finalization h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len; h1 += h2; h1 += h3; h1 += h4; h2 += h1; h3 += h1; h4 += h1; h1 = fmix32(h1); h2 = fmix32(h2); h3 = fmix32(h3); h4 = fmix32(h4); h1 += h2; h1 += h3; h1 += h4; h2 += h1; h3 += h1; h4 += h1; ((uint32_t*)out)[0] = h1; ((uint32_t*)out)[1] = h2; ((uint32_t*)out)[2] = h3; ((uint32_t*)out)[3] = h4; } //----------------------------------------------------------------------------- void MurmurHash3_x64_128 ( const void * key, const int len, const uint32_t seed, void * out ) { const uint8_t * data = (const uint8_t*)key; const int nblocks = len / 16; int i; uint64_t h1 = seed; uint64_t h2 = seed; uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5); uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f); //---------- // body const uint64_t * blocks = (const uint64_t *)(data); for(i = 0; i < nblocks; i++) { uint64_t k1 = getblock(blocks,i*2+0); uint64_t k2 = getblock(blocks,i*2+1); k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1; h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729; k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2; h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5; } //---------- // tail const uint8_t * tail = (const uint8_t*)(data + nblocks*16); uint64_t k1 = 0; uint64_t k2 = 0; switch(len & 15) { case 15: k2 ^= (uint64_t)(tail[14]) << 48; case 14: k2 ^= (uint64_t)(tail[13]) << 40; case 13: k2 ^= (uint64_t)(tail[12]) << 32; case 12: k2 ^= (uint64_t)(tail[11]) << 24; case 11: k2 ^= (uint64_t)(tail[10]) << 16; case 10: k2 ^= (uint64_t)(tail[ 9]) << 8; case 9: k2 ^= (uint64_t)(tail[ 8]) << 0; k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2; case 8: k1 ^= (uint64_t)(tail[ 7]) << 56; case 7: k1 ^= (uint64_t)(tail[ 6]) << 48; case 6: k1 ^= (uint64_t)(tail[ 5]) << 40; case 5: k1 ^= (uint64_t)(tail[ 4]) << 32; case 4: k1 ^= (uint64_t)(tail[ 3]) << 24; case 3: k1 ^= (uint64_t)(tail[ 2]) << 16; case 2: k1 ^= (uint64_t)(tail[ 1]) << 8; case 1: k1 ^= (uint64_t)(tail[ 0]) << 0; k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1; }; //---------- // finalization h1 ^= len; h2 ^= len; h1 += h2; h2 += h1; h1 = fmix64(h1); h2 = fmix64(h2); h1 += h2; h2 += h1; ((uint64_t*)out)[0] = h1; ((uint64_t*)out)[1] = h2; } //----------------------------------------------------------------------------- gearmand-1.0.6/libhashkit/murmur3.h0000664000076400007640000000120012107145705017456 0ustar00brianbrian00000000000000//----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the // public domain. The author hereby disclaims copyright to this source // code. #pragma once //----------------------------------------------------------------------------- void MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, void *out); void MurmurHash3_x86_128(const void *key, int len, uint32_t seed, void *out); void MurmurHash3_x64_128(const void *key, int len, uint32_t seed, void *out); //----------------------------------------------------------------------------- gearmand-1.0.6/libhashkit/crc32.cc0000664000076400007640000001250612107145705017131 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2009-2012 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. * */ /* The crc32 functions and data was originally written by Spencer * Garrett and was gleaned from the PostgreSQL source * tree via the files contrib/ltree/crc32.[ch] and from FreeBSD at * src/usr.bin/cksum/crc32.c. */ #include static const uint32_t crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; uint32_t hashkit_crc32(const char *key, size_t key_length, void *context) { uint64_t x; uint32_t crc= UINT32_MAX; (void)context; for (x= 0; x < key_length; x++) crc= (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff]; return ((~crc) >> 16) & 0x7fff; } gearmand-1.0.6/libhashkit/hashkit.cc0000664000076400007640000000740712107145705017654 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ #include static inline void _hashkit_init(hashkit_st *self) { self->base_hash.function= hashkit_one_at_a_time; self->base_hash.context= NULL; self->distribution_hash.function= hashkit_one_at_a_time; self->distribution_hash.context= NULL; self->flags.is_base_same_distributed= true; self->_key= NULL; } static inline hashkit_st *_hashkit_create(hashkit_st *self) { if (self) { self->options.is_allocated= false; } else { self= (hashkit_st*)calloc(1, sizeof(hashkit_st)); if (self == NULL) { return NULL; } self->options.is_allocated= true; } return self; } hashkit_st *hashkit_create(hashkit_st *self) { self= _hashkit_create(self); if (self == NULL) { return NULL; } _hashkit_init(self); return self; } void hashkit_free(hashkit_st *self) { if (self and self->_key) { free(self->_key); self->_key= NULL; } if (hashkit_is_allocated(self)) { free(self); } } hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *source) { if (source == NULL) { return hashkit_create(destination); } /* new_clone will be a pointer to destination */ destination= _hashkit_create(destination); // Should only happen on allocation failure. if (destination == NULL) { return NULL; } destination->base_hash= source->base_hash; destination->distribution_hash= source->distribution_hash; destination->flags= source->flags; destination->_key= aes_clone_key(static_cast(source->_key)); return destination; } bool hashkit_compare(const hashkit_st *first, const hashkit_st *second) { if (not first or not second) return false; if (first->base_hash.function == second->base_hash.function and first->base_hash.context == second->base_hash.context and first->distribution_hash.function == second->distribution_hash.function and first->distribution_hash.context == second->distribution_hash.context and first->flags.is_base_same_distributed == second->flags.is_base_same_distributed) { return true; } return false; } gearmand-1.0.6/libhashkit/murmur.cc0000664000076400007640000000650012107145705017541 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ /* "Murmur" hash provided by Austin, tanjent@gmail.com http://murmurhash.googlepages.com/ Note - This code makes a few assumptions about how your machine behaves - 1. We can read a 4-byte value from any address without crashing 2. sizeof(int) == 4 And it has a few limitations - 1. It will not work incrementally. 2. It will not produce the same results on little-endian and big-endian machines. Updated to murmur2 hash - BP */ #include #ifdef HAVE_MURMUR_HASH uint32_t hashkit_murmur(const char *key, size_t length, void *context) { /* 'm' and 'r' are mixing constants generated offline. They're not really 'magic', they just happen to work well. */ const unsigned int m= 0x5bd1e995; const uint32_t seed= (0xdeadbeef * (uint32_t)length); const int r= 24; // Initialize the hash to a 'random' value uint32_t h= seed ^ (uint32_t)length; // Mix 4 bytes at a time into the hash const unsigned char * data= (const unsigned char *)key; (void)context; while(length >= 4) { unsigned int k = *(unsigned int *)data; k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; data += 4; length -= 4; } // Handle the last few bytes of the input array switch(length) { case 3: h ^= ((uint32_t)data[2]) << 16; case 2: h ^= ((uint32_t)data[1]) << 8; case 1: h ^= data[0]; h *= m; default: break; }; /* Do a few final mixes of the hash to ensure the last few bytes are well-incorporated. */ h ^= h >> 13; h *= m; h ^= h >> 15; return h; } #else uint32_t hashkit_murmur(const char *, size_t , void *) { return 0; } #endif gearmand-1.0.6/libhashkit/has.cc0000664000076400007640000000467712107145705017002 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 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. * */ #include bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t algo) { switch (algo) { case HASHKIT_HASH_FNV1_64: case HASHKIT_HASH_FNV1A_64: #if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH) return true; #else return false; #endif case HASHKIT_HASH_HSIEH: #ifdef HAVE_HSIEH_HASH return true; #else return false; #endif case HASHKIT_HASH_MURMUR3: case HASHKIT_HASH_MURMUR: #ifdef HAVE_MURMUR_HASH return true; #else return false; #endif case HASHKIT_HASH_FNV1_32: case HASHKIT_HASH_FNV1A_32: case HASHKIT_HASH_DEFAULT: case HASHKIT_HASH_MD5: case HASHKIT_HASH_CRC: case HASHKIT_HASH_JENKINS: case HASHKIT_HASH_CUSTOM: return true; case HASHKIT_HASH_MAX: break; } return false; } gearmand-1.0.6/libhashkit/str_algorithm.cc0000664000076400007640000000450312107145705021071 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit * * 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 const char * libhashkit_string_hash(hashkit_hash_algorithm_t type) { switch(type) { case HASHKIT_HASH_DEFAULT: return "DEFAULT"; case HASHKIT_HASH_MD5: return "MD5"; case HASHKIT_HASH_CRC: return "CRC"; case HASHKIT_HASH_FNV1_64: return "FNV1_64"; case HASHKIT_HASH_FNV1A_64: return "FNV1A_64"; case HASHKIT_HASH_FNV1_32: return "FNV1_32"; case HASHKIT_HASH_FNV1A_32: return "FNV1A_32"; case HASHKIT_HASH_HSIEH: return "HSIEH"; case HASHKIT_HASH_MURMUR: return "MURMUR"; case HASHKIT_HASH_MURMUR3: return "MURMUR3"; case HASHKIT_HASH_JENKINS: return "JENKINS"; case HASHKIT_HASH_CUSTOM: return "CUSTOM"; default: case HASHKIT_HASH_MAX: return "INVALID"; } } gearmand-1.0.6/libhashkit/aes.h0000664000076400007640000000402012107145705016617 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libmemcached 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 aes_key_t; hashkit_string_st* aes_encrypt(aes_key_t* _aes_key, const char* source, size_t source_length); hashkit_string_st* aes_decrypt(aes_key_t* _aes_key, const char* source, size_t source_length); aes_key_t* aes_create_key(const char *key, const size_t key_length); aes_key_t* aes_clone_key(aes_key_t* _aes_key); gearmand-1.0.6/libhashkit/fnv_32.cc0000664000076400007640000000457512107145705017321 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 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. * */ #include /* FNV hash'es lifted from Dustin Sallings work */ static uint32_t FNV_32_INIT= 2166136261UL; static uint32_t FNV_32_PRIME= 16777619; uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context) { uint32_t hash= FNV_32_INIT; (void)context; for (size_t x= 0; x < key_length; x++) { uint32_t val= (uint32_t)key[x]; hash *= FNV_32_PRIME; hash ^= val; } return hash; } uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context) { uint32_t hash= FNV_32_INIT; (void)context; for (size_t x= 0; x < key_length; x++) { uint32_t val= (uint32_t)key[x]; hash ^= val; hash *= FNV_32_PRIME; } return hash; } gearmand-1.0.6/libhashkit/string.cc0000664000076400007640000001305712107145705017525 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libhashkit library * * Copyright (C) 2011-2012 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 #define HASHKIT_BLOCK_SIZE 1024 struct hashkit_string_st { char *end; size_t current_size; char *string; }; inline static bool _string_check(hashkit_string_st *string, size_t need) { if (need and need > (size_t)(string->current_size - (size_t)(string->end - string->string))) { size_t current_offset= (size_t) (string->end - string->string); /* This is the block multiplier. To keep it larger and surive division errors we must round it up */ size_t adjust= (need - (size_t)(string->current_size - (size_t)(string->end - string->string))) / HASHKIT_BLOCK_SIZE; adjust++; size_t new_size= sizeof(char) * (size_t)((adjust * HASHKIT_BLOCK_SIZE) + string->current_size); /* Test for overflow */ if (new_size < need) { return false; } char *new_value= (char*)realloc(string->string, new_size); if (new_value == NULL) { return false; } string->string= new_value; string->end= string->string + current_offset; string->current_size+= (HASHKIT_BLOCK_SIZE * adjust); } return true; } static inline void _init_string(hashkit_string_st *self) { self->current_size= 0; self->end= self->string= NULL; } hashkit_string_st *hashkit_string_create(size_t initial_size) { hashkit_string_st* self= (hashkit_string_st*)calloc(1, sizeof(hashkit_string_st)); if (self) { if (_string_check(self, initial_size) == false) { free(self); return NULL; } } return self; } #if 0 static bool hashkit_string_append_null(hashkit_string_st *string) { if (_string_check(string, 1) == false) { return false; } *string->end= 0; return true; } #endif bool hashkit_string_append_character(hashkit_string_st *string, char character) { if (_string_check(string, 1) == false) { return false; } *string->end= character; string->end++; return true; } bool hashkit_string_append(hashkit_string_st *string, const char *value, size_t length) { if (_string_check(string, length) == false) { return false; } assert(length <= string->current_size); assert(string->string); assert(string->end >= string->string); memcpy(string->end, value, length); string->end+= length; return true; } char *hashkit_string_c_copy(hashkit_string_st *string) { if (hashkit_string_length(string) == 0) { return NULL; } char *c_ptr= static_cast(malloc((hashkit_string_length(string)+1) * sizeof(char))); if (c_ptr == NULL) { return NULL; } memcpy(c_ptr, hashkit_string_c_str(string), hashkit_string_length(string)); c_ptr[hashkit_string_length(string)]= 0; return c_ptr; } void hashkit_string_reset(hashkit_string_st *string) { string->end= string->string; } void hashkit_string_free(hashkit_string_st *ptr) { if (ptr == NULL) { return; } if (ptr->string) { free(ptr->string); } free(ptr); } bool hashkit_string_resize(hashkit_string_st& string, const size_t need) { return _string_check(&string, need); } size_t hashkit_string_length(const hashkit_string_st *self) { return size_t(self->end -self->string); } size_t hashkit_string_max_size(const hashkit_string_st *self) { return self->current_size; } char *hashkit_string_take(hashkit_string_st *self) { assert(self); if (self == NULL) { return NULL; } char *value= self->string; _init_string(self); return value; } char *hashkit_string_c_str_mutable(hashkit_string_st *self) { assert(self); if (self == NULL) { return NULL; } return self->string; } const char *hashkit_string_c_str(const hashkit_string_st* self) { assert(self); if (self == NULL) { return NULL; } return self->string; } void hashkit_string_set_length(hashkit_string_st *self, size_t length) { assert(self); if (self and _string_check(self, length)) { self->end= self->string +length; } } gearmand-1.0.6/libhashkit/hashkitcon.h.in0000664000076400007640000000324212107145705020614 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2012 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 #include "@AUTOHEADER_FILE@" gearmand-1.0.6/libhashkit/string.h0000664000076400007640000000445412107145705017370 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Hashkit library * * Copyright (C) 2011-2012 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 hashkit_string_st *hashkit_string_create(size_t initial_size); bool hashkit_string_append_character(hashkit_string_st *string, char character); bool hashkit_string_append(hashkit_string_st *string, const char *value, size_t length); char *hashkit_string_c_copy(hashkit_string_st *string); void hashkit_string_reset(hashkit_string_st *string); bool hashkit_string_resize(hashkit_string_st& string, const size_t need); size_t hashkit_string_max_size(const hashkit_string_st *self); char *hashkit_string_take(hashkit_string_st *self); char *hashkit_string_c_str_mutable(hashkit_string_st *self); void hashkit_string_set_length(hashkit_string_st *self, size_t length); gearmand-1.0.6/libhashkit/hsieh.cc0000664000076400007640000000657512107145705017326 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 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. * */ /* By Paul Hsieh (C) 2004, 2005. Covered under the Paul Hsieh * derivative license. * See: http://www.azillionmonkeys.com/qed/weblicense.html for license * details. * http://www.azillionmonkeys.com/qed/hash.html */ #include #undef get16bits #if (defined(__GNUC__) && defined(__i386__)) #define get16bits(d) (*((const uint16_t *) (d))) #endif #if !defined (get16bits) #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\ +(uint32_t)(((const uint8_t *)(d))[0]) ) #endif #ifdef HAVE_HSIEH_HASH uint32_t hashkit_hsieh(const char *key, size_t key_length, void *) { uint32_t hash = 0, tmp; int rem; if (key_length <= 0 || key == NULL) return 0; rem = key_length & 3; key_length >>= 2; /* Main loop */ for (;key_length > 0; key_length--) { hash += get16bits (key); tmp = (get16bits (key+2) << 11) ^ hash; hash = (hash << 16) ^ tmp; key += 2*sizeof (uint16_t); hash += hash >> 11; } /* Handle end cases */ switch (rem) { case 3: hash += get16bits (key); hash ^= hash << 16; hash ^= (uint32_t)key[sizeof (uint16_t)] << 18; hash += hash >> 11; break; case 2: hash += get16bits (key); hash ^= hash << 11; hash += hash >> 17; break; case 1: hash += (unsigned char)(*key); hash ^= hash << 10; hash += hash >> 1; default: break; } /* Force "avalanching" of final 127 bits */ hash ^= hash << 3; hash += hash >> 5; hash ^= hash << 4; hash += hash >> 17; hash ^= hash << 25; hash += hash >> 6; return hash; } #else uint32_t hashkit_hsieh(const char *, size_t , void *) { return 0; } #endif gearmand-1.0.6/libhashkit/strerror.cc0000664000076400007640000000430612107145705020076 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009 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 const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc) { (void)ptr; switch (rc) { case HASHKIT_SUCCESS: return "SUCCESS"; case HASHKIT_FAILURE: return "FAILURE"; case HASHKIT_MEMORY_ALLOCATION_FAILURE: return "MEMORY ALLOCATION FAILURE"; case HASHKIT_INVALID_ARGUMENT: return "INVALID ARGUMENT"; case HASHKIT_INVALID_HASH: return "INVALID hashkit_hash_algorithm_t"; case HASHKIT_MAXIMUM_RETURN: default: return "INVALID hashkit_return_t"; } } gearmand-1.0.6/libhashkit/function.cc0000664000076400007640000001051112107145705020034 0ustar00brianbrian00000000000000/* HashKit * 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. */ #include static hashkit_return_t _set_function(struct hashkit_st::hashkit_function_st *self, hashkit_hash_algorithm_t hash_algorithm) { if (self == NULL) { return HASHKIT_INVALID_ARGUMENT; } switch (hash_algorithm) { case HASHKIT_HASH_MD5: self->function= hashkit_md5; break; case HASHKIT_HASH_CRC: self->function= hashkit_crc32; break; case HASHKIT_HASH_FNV1_64: if (libhashkit_has_algorithm(HASHKIT_HASH_FNV1_64)) { self->function= hashkit_fnv1_64; break; } return HASHKIT_INVALID_ARGUMENT; case HASHKIT_HASH_FNV1A_64: if (libhashkit_has_algorithm(HASHKIT_HASH_FNV1_64)) { self->function= hashkit_fnv1a_64; break; } return HASHKIT_INVALID_ARGUMENT; case HASHKIT_HASH_FNV1_32: self->function= hashkit_fnv1_32; break; case HASHKIT_HASH_FNV1A_32: self->function= hashkit_fnv1a_32; break; case HASHKIT_HASH_HSIEH: if (libhashkit_has_algorithm(HASHKIT_HASH_HSIEH)) { self->function= hashkit_hsieh; break; } return HASHKIT_INVALID_ARGUMENT; case HASHKIT_HASH_MURMUR3: case HASHKIT_HASH_MURMUR: if (libhashkit_has_algorithm(HASHKIT_HASH_MURMUR)) { self->function= hashkit_murmur; break; } return HASHKIT_INVALID_ARGUMENT; case HASHKIT_HASH_JENKINS: self->function= hashkit_jenkins; break; case HASHKIT_HASH_CUSTOM: return HASHKIT_INVALID_ARGUMENT; case HASHKIT_HASH_DEFAULT: self->function= hashkit_one_at_a_time; break; case HASHKIT_HASH_MAX: self->function= hashkit_one_at_a_time; return HASHKIT_INVALID_HASH; } self->context= NULL; return HASHKIT_SUCCESS; } hashkit_return_t hashkit_set_function(hashkit_st *self, hashkit_hash_algorithm_t hash_algorithm) { return _set_function(&self->base_hash, hash_algorithm); } hashkit_return_t hashkit_set_distribution_function(hashkit_st *self, hashkit_hash_algorithm_t hash_algorithm) { return _set_function(&self->distribution_hash, hash_algorithm); } static hashkit_return_t _set_custom_function(struct hashkit_st::hashkit_function_st *self, hashkit_hash_fn function, void *context) { if (self == NULL) { return HASHKIT_INVALID_ARGUMENT; } if (function) { self->function= function; self->context= context; return HASHKIT_SUCCESS; } return HASHKIT_FAILURE; } hashkit_return_t hashkit_set_custom_function(hashkit_st *self, hashkit_hash_fn function, void *context) { if (self == NULL) { return HASHKIT_INVALID_ARGUMENT; } return _set_custom_function(&self->base_hash, function, context); } hashkit_return_t hashkit_set_custom_distribution_function(hashkit_st *self, hashkit_hash_fn function, void *context) { if (self == NULL) { return HASHKIT_INVALID_ARGUMENT; } return _set_custom_function(&self->distribution_hash, function, context); } static hashkit_hash_algorithm_t get_function_type(const hashkit_hash_fn function) { if (function == hashkit_one_at_a_time) { return HASHKIT_HASH_DEFAULT; } else if (function == hashkit_md5) { return HASHKIT_HASH_MD5; } else if (function == hashkit_crc32) { return HASHKIT_HASH_CRC; } else if (function == hashkit_fnv1_64) { return HASHKIT_HASH_FNV1_64; } else if (function == hashkit_fnv1a_64) { return HASHKIT_HASH_FNV1A_64; } else if (function == hashkit_fnv1_32) { return HASHKIT_HASH_FNV1_32; } else if (function == hashkit_fnv1a_32) { return HASHKIT_HASH_FNV1A_32; } else if (function == hashkit_hsieh) { return HASHKIT_HASH_HSIEH; } else if (function == hashkit_murmur) { return HASHKIT_HASH_MURMUR; } else if (function == hashkit_jenkins) { return HASHKIT_HASH_JENKINS; } return HASHKIT_HASH_CUSTOM; } hashkit_hash_algorithm_t hashkit_get_function(const hashkit_st *self) { if (self == NULL) { return HASHKIT_HASH_DEFAULT; } return get_function_type(self->base_hash.function); } hashkit_hash_algorithm_t hashkit_get_distribution_function(const hashkit_st *self) { if (self == NULL) { return HASHKIT_HASH_DEFAULT; } return get_function_type(self->distribution_hash.function); } gearmand-1.0.6/libhashkit/behavior.cc0000664000076400007640000000323312107145705020011 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * HashKit library * * Copyright (C) 2009-2012 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 gearmand-1.0.6/libhashkit/include.m40000664000076400007640000000066312107145705017574 0ustar00brianbrian00000000000000dnl Copyright (C) 2012 Data Differential, LLC. dnl This file is free software; Data Differential, LLC. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. HASHKIT_LIBRARY_VERSION=2:0:0 AC_SUBST(HASHKIT_LIBRARY_VERSION) AC_CONFIG_FILES([libhashkit/hashkitcon.h]) AC_CONFIG_FILES([libhashkit-1.0/configure.h]) AM_CONDITIONAL([INCLUDE_HSIEH_SRC],[false]) gearmand-1.0.6/util/0000775000076400007640000000000012142673675014550 5ustar00brianbrian00000000000000gearmand-1.0.6/util/log.hpp0000664000076400007640000001240312107145705016027 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential Utility library * * Copyright (C) 2012 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 #include #include #include #include #include #include #include #define UTIL_MAX_ERROR_SIZE 2048 namespace datadifferential { namespace util { /** Verbosity levels. */ enum verbose_t { // Logging this will cause shutdown VERBOSE_FATAL= LOG_EMERG, // syslog:LOG_EMERG VERBOSE_ALERT= LOG_ALERT, // syslog:LOG_ALERT VERBOSE_CRITICAL= LOG_CRIT, // syslog:LOG_CRIT VERBOSE_ERROR= LOG_ERR, // syslog:LOG_ERR VERBOSE_WARN= LOG_WARNING, // syslog:LOG_WARNING VERBOSE_NOTICE= LOG_NOTICE, // syslog:LOG_NOTICE VERBOSE_INFO= LOG_INFO, // syslog:LOG_INFO VERBOSE_DEBUG= LOG_DEBUG // syslog:LOG_DEBUG }; struct log_info_st { std::string name; std::string filename; int fd; bool opt_syslog; bool opt_file; bool init_success; log_info_st(const std::string& name_arg, const std::string &filename_arg, bool syslog_arg) : name(name_arg), filename(filename_arg), fd(-1), opt_syslog(syslog_arg), opt_file(false), init_success(false) { if (opt_syslog) { openlog(name.c_str(), LOG_PID | LOG_NDELAY, LOG_USER); } init(); } void init() { if (filename.size()) { if (filename.compare("stderr") == 0) { fd= STDERR_FILENO; } else { fd= open(filename.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644); if (fd == -1) { if (opt_syslog) { char buffer[1024]; char *getcwd_ret= getcwd(buffer, sizeof(buffer)); syslog(LOG_ERR, "Could not open log file \"%.*s\", from \"%s\", open failed with (%s)", int(filename.size()), filename.c_str(), getcwd_ret, strerror(errno)); } std::cerr << "Could not open log file for writing, switching to stderr." << std::endl; fd= STDERR_FILENO; } } opt_file= true; } init_success= true; } bool initialized() const { return init_success; } int file() const { return fd; } void write(verbose_t verbose, const char *format, ...) { if (opt_file or opt_syslog) { va_list args; va_start(args, format); char mesg[BUFSIZ]; int mesg_length= vsnprintf(mesg, sizeof(mesg), format, args); va_end(args); if (opt_file) { char buffer[UTIL_MAX_ERROR_SIZE]; int buffer_length= snprintf(buffer, sizeof(buffer), "%7s %.*s\n", verbose_name(verbose), mesg_length, mesg); if (::write(file(), buffer, buffer_length) == -1) { std::cerr << "Could not write to log file." << std::endl; syslog(LOG_EMERG, "gearmand could not open log file %s, got error %s", filename.c_str(), strerror(errno)); } } if (opt_syslog) { syslog(int(verbose), "%7s %.*s", verbose_name(verbose), mesg_length, mesg); } } } ~log_info_st() { if (fd != -1 and fd != STDERR_FILENO) { close(fd); } if (opt_syslog) { closelog(); } } private: const char *verbose_name(verbose_t verbose) { switch (verbose) { case VERBOSE_FATAL: return "FATAL"; case VERBOSE_ALERT: return "ALERT"; case VERBOSE_CRITICAL: return "CRITICAL"; case VERBOSE_ERROR: return "ERROR"; case VERBOSE_WARN: return "WARNING"; case VERBOSE_NOTICE: return "NOTICE"; case VERBOSE_INFO: return "INFO"; case VERBOSE_DEBUG: return "DEBUG"; default: break; } return "UNKNOWN"; } }; } // namespace util } // namespace datadifferential gearmand-1.0.6/util/include.am0000664000076400007640000000111412107145705016474 0ustar00brianbrian00000000000000# vim:ft=automake # DataDifferential Utility Library # Copyright (C) 2011-2013 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/memory.h noinst_HEADERS+= util/noncopyable.hpp noinst_HEADERS+= \ util/daemon.hpp \ util/instance.hpp \ util/logfile.hpp \ util/log.hpp \ util/operation.hpp \ util/signal.hpp \ util/string.hpp \ util/pidfile.hpp gearmand-1.0.6/util/memory.h0000664000076400007640000000410012120504417016203 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility Library * * Copyright (C) 2013 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 org { namespace tangent { namespace util { static inline void free__(void *& ptr) { if (ptr) { std::free(ptr); ptr= NULL; } } static inline int close__(int & fd) { if (fd == -1) { return 0; } int ret= close(fd); fd= -1; return ret; } } // namespace util } // namespace tangent } // namespace org gearmand-1.0.6/util/operation.hpp0000664000076400007640000000542612107145705017255 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 datadifferential { namespace 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); } // Return false on error bool response(std::string &); bool reconnect() const { return false; } private: bool _expect_response; Packet packet; Packet _response; }; } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/instance.hpp0000664000076400007640000000565412107145705017064 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 #include #include #include #include #include "util/operation.hpp" struct addrinfo; namespace datadifferential { namespace util { class Instance { private: enum connection_state_t { NOT_WRITING, NEXT_CONNECT_ADDRINFO, CONNECT, CONNECTING, CONNECTED, WRITING, READING, FINISHED }; std::string _last_error; public: // Callbacks class Finish { public: virtual ~Finish() { } virtual bool call(const bool, const std::string &)= 0; }; public: Instance(const std::string& hostname_arg, const std::string& service_arg); Instance(const std::string& hostname_arg, const in_port_t port_arg); ~Instance(); bool run(); void set_finish(Finish *arg) { _finish_fn= arg; } void push(util::Operation *next) { _operations.push_back(next); } private: void close_socket(); void free_addrinfo(); bool more_to_read() const; std::string _host; std::string _service; int _sockfd; connection_state_t state; struct addrinfo *_addrinfo; struct addrinfo *_addrinfo_next; Finish *_finish_fn; Operation::vector _operations; }; } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/string.hpp0000664000076400007640000000421412107145705016555 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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. * */ /* Simple defines */ #include #include #pragma once #define util_literal_param(X) (X), (static_cast((sizeof(X) - 1))) #define util_literal_param_size(X) static_cast(sizeof(X) - 1) #define util_literal_compare_param(X) (static_cast((sizeof(X) - 1))), (X) #define util_string_make_from_cstr(X) (X), ((X) ? strlen(X) : 0) #define util_string_make_from_array(__array) (__array), (strlen(__array)) #define util_array_length(__array) sizeof(__array)/sizeof(&__array) gearmand-1.0.6/util/instance.cc0000664000076400007640000001702012107145705016650 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 "gear_config.h" #include "util/instance.hpp" #include #include #include #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif namespace datadifferential { namespace util { Instance::Instance(const std::string& hostname_arg, const std::string& service_arg) : _host(hostname_arg), _service(service_arg), _sockfd(INVALID_SOCKET), state(NOT_WRITING), _addrinfo(0), _addrinfo_next(0), _finish_fn(NULL), _operations() { } Instance::Instance(const std::string& hostname_arg, const in_port_t port_arg) : _host(hostname_arg), _sockfd(INVALID_SOCKET), state(NOT_WRITING), _addrinfo(0), _addrinfo_next(0), _finish_fn(NULL), _operations() { char tmp[BUFSIZ]; snprintf(tmp, sizeof(tmp), "%u", static_cast(port_arg)); _service= tmp; } Instance::~Instance() { close_socket(); free_addrinfo(); for (Operation::vector::iterator iter= _operations.begin(); iter != _operations.end(); ++iter) { delete *iter; } _operations.clear(); delete _finish_fn; } 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(), _service.c_str(), &ai, &_addrinfo); if (ret) { std::stringstream message; message << "Failed to connect on " << _host.c_str() << ":" << _service.c_str() << " with " << gai_strerror(ret); _last_error= message.str(); return false; } } _addrinfo_next= _addrinfo; state= CONNECT; break; case NEXT_CONNECT_ADDRINFO: if (_addrinfo_next->ai_next == NULL) { std::stringstream message; message << "Error connecting to " << _host.c_str() << "." << std::endl; _last_error= message.str(); 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 dureng 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()) { ssize_t read_length; do { char buffer[BUFSIZ]; read_length= ::recv(_sockfd, buffer, sizeof(buffer), 0); if (read_length < 0) { switch(errno) { default: _last_error.clear(); _last_error+= "Error occured while reading data from "; _last_error+= _host; return false; } } else if (read_length == 0) { _last_error.clear(); _last_error+= "Socket was shutdown while reading from "; _last_error+= _host; return false; } operation->push(buffer, static_cast(read_length)); } while (more_to_read()); } // end has_response state= FINISHED; break; case FINISHED: std::string response; bool success= operation->response(response); if (_finish_fn) { if (not _finish_fn->call(success, response)) { // Error was sent from _finish_fn return false; } } 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 (_addrinfo == NULL) { return; } freeaddrinfo(_addrinfo); _addrinfo= NULL; _addrinfo_next= NULL; } } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/noncopyable.hpp0000664000076400007640000000405712107145705017565 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility Library * * Copyright (C) 2013 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 org { namespace tangent { namespace util { namespace noncopyable_ { class noncopyable { protected: noncopyable() {} ~noncopyable() {} private: noncopyable( const noncopyable& ); const noncopyable& operator=( const noncopyable& ); }; } typedef noncopyable_::noncopyable noncopyable; } // namespace util } // namespace tangent } // namespace org gearmand-1.0.6/util/logfile.hpp0000664000076400007640000000402612107145705016671 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 datadifferential { namespace util { class Logfile { public: Logfile(const std::string &arg); ~Logfile(); std::ofstream &log() { return _log_file; } bool open(); private: const std::string _filename; std::ofstream _log_file; }; } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/daemon.cc0000664000076400007640000001041212107145705016305 0ustar00brianbrian00000000000000/* $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 "gear_config.h" #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 #include namespace datadifferential { namespace util { 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) { if (kill(parent_pid, SIGUSR1) == -1) { perror("kill"); return false; } if (close_io == false) { 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) { struct sigaction new_action; new_action.sa_handler= sigusr1_handler; sigemptyset(&new_action.sa_mask); new_action.sa_flags= 0; sigaction(SIGUSR1, &new_action, NULL); parent_pid= getpid(); pid_t 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 util */ } /* namespace datadifferential */ gearmand-1.0.6/util/pidfile.hpp0000664000076400007640000000405612107145705016667 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 datadifferential { namespace util { class Pidfile { public: Pidfile(const std::string &arg); ~Pidfile(); const std::string &error_message() { return _error_message; } bool create(); private: int _last_errno; const std::string _filename; std::string _error_message; }; } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/operation.cc0000664000076400007640000000445212107145705017051 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 "gear_config.h" #include "util/operation.hpp" #include namespace datadifferential { namespace util { bool Operation::response(std::string &arg) { if (_response.empty()) { return false; } if (not memcmp("OK\r\n", &_response[0], 3)) { } else if (not memcmp("OK ", &_response[0], 3)) { arg.append(&_response[3], _response.size() -3); } else if (not memcmp("ERR ", &_response[0], 4)) { arg.append(&_response[4], _response.size() -4); return false; } else { arg.append(&_response[0], _response.size()); } return true; } } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/signal.hpp0000664000076400007640000000521612107145705016527 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential Utility library * * Copyright (C) 2012 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 #include #include #ifdef HAVE_SIGNAL_H #include #endif #ifdef __cplusplus extern "C" { #endif typedef void (signal_callback_fn)(); #ifdef __cplusplus } #endif namespace datadifferential { namespace util { enum shutdown_t { SHUTDOWN_RUNNING, SHUTDOWN_GRACEFUL, SHUTDOWN_FORCED }; class SignalThread { bool _exit_on_signal; sigset_t set; sem_t lock; uint64_t magic_memory; volatile shutdown_t __shutdown; pthread_mutex_t shutdown_mutex; public: SignalThread(bool exit_on_signal_arg= false); void test(); void post(); bool setup(); bool exit_on_signal() { return _exit_on_signal; } int wait(int& sig) { return sigwait(&set, &sig); } ~SignalThread(); void set_shutdown(shutdown_t arg); bool is_shutdown(); shutdown_t get_shutdown(); void sighup(); void sighup(signal_callback_fn* arg); private: pthread_t thread; signal_callback_fn* _sighup; }; } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/logfile.cc0000664000076400007640000000523612107145705016473 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 "gear_config.h" #include "util/logfile.hpp" #include #include #include #include #include #include #include #include #include #include #include namespace datadifferential { namespace util { Logfile::Logfile(const std::string &arg) : _filename(arg) { time_t tmp= time(NULL); _log_file << "shutdown: " << ctime(&tmp) << std::endl; } Logfile::~Logfile() { if (not _filename.empty()) { _log_file.close(); if (access(_filename.c_str(), F_OK) == -1) { } else if (unlink(_filename.c_str()) == -1) { } } } bool Logfile::open() { if (_filename.empty()) { _log_file.open("/dev/stderr"); return true; } _log_file.open(_filename.c_str()); if (not _log_file.good()) { return false; } time_t tmp= time(NULL); _log_file << "startup: " << ctime(&tmp) << std::endl; return true; } } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/daemon.hpp0000664000076400007640000000377012107145705016520 0ustar00brianbrian00000000000000/* $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 datadifferential { namespace util { bool daemon_is_ready(bool close_io); bool daemonize(bool is_chdir= true, bool wait_sigusr1= true); } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/signal.cc0000664000076400007640000001220012107145705016314 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential Utility library * * Copyright (C) 2012 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 "gear_config.h" #include #include #include #include #include #include #include namespace datadifferential { namespace util { #define MAGIC_MEMORY 123569 bool SignalThread::is_shutdown() { bool ret; pthread_mutex_lock(&shutdown_mutex); ret= bool(__shutdown != SHUTDOWN_RUNNING); pthread_mutex_unlock(&shutdown_mutex); return ret; } void SignalThread::set_shutdown(shutdown_t arg) { pthread_mutex_lock(&shutdown_mutex); __shutdown= arg; pthread_mutex_unlock(&shutdown_mutex); if (arg == SHUTDOWN_GRACEFUL) { if (pthread_kill(thread, SIGUSR2) == 0) { void *retval; pthread_join(thread, &retval); } } } shutdown_t SignalThread::get_shutdown() { shutdown_t local; pthread_mutex_lock(&shutdown_mutex); local= __shutdown; pthread_mutex_unlock(&shutdown_mutex); return local; } void SignalThread::post() { sem_post(&lock); } void SignalThread::test() { assert(magic_memory == MAGIC_MEMORY); assert(sigismember(&set, SIGABRT)); assert(sigismember(&set, SIGINT)); assert(sigismember(&set, SIGQUIT)); assert(sigismember(&set, SIGTERM)); assert(sigismember(&set, SIGUSR2)); } void SignalThread::sighup(signal_callback_fn* arg) { _sighup= arg; } void SignalThread::sighup() { if (_sighup) { _sighup(); } } SignalThread::~SignalThread() { if (not is_shutdown()) { set_shutdown(SHUTDOWN_GRACEFUL); } #if 0 if (pthread_equal(thread, pthread_self()) != 0 and (pthread_kill(thread, 0) == ESRCH) == true) { void *retval; pthread_join(thread, &retval); } #endif sem_destroy(&lock); } extern "C" { static void *sig_thread(void *arg) { SignalThread *context= (SignalThread*)arg; context->test(); context->post(); while (context->get_shutdown() == SHUTDOWN_RUNNING) { int sig; if (context->wait(sig) == -1) { std::cerr << "sigwait() returned errno:" << strerror(errno) << std::endl; continue; } switch (sig) { case SIGUSR2: break; case SIGHUP: context->sighup(); break; case SIGABRT: case SIGINT: case SIGQUIT: case SIGTERM: if (context->is_shutdown() == false) { context->set_shutdown(SHUTDOWN_FORCED); } if (context->exit_on_signal()) { exit(EXIT_SUCCESS); } break; default: std::cerr << "Signal handling thread got unexpected signal " << strsignal(sig) << std::endl; break; } } return NULL; } } SignalThread::SignalThread(bool exit_on_signal_arg) : _exit_on_signal(exit_on_signal_arg), magic_memory(MAGIC_MEMORY), __shutdown(SHUTDOWN_RUNNING), thread(pthread_self()), _sighup(NULL) { pthread_mutex_init(&shutdown_mutex, NULL); sigemptyset(&set); sigaddset(&set, SIGABRT); sigaddset(&set, SIGINT); sigaddset(&set, SIGQUIT); sigaddset(&set, SIGTERM); sigaddset(&set, SIGUSR2); sem_init(&lock, 0, 0); } bool SignalThread::setup() { set_shutdown(SHUTDOWN_RUNNING); int error; if ((error= pthread_sigmask(SIG_BLOCK, &set, NULL)) != 0) { std::cerr << "pthread_sigmask() died during pthread_sigmask(" << strerror(error) << ")" << std::endl; return false; } if ((error= pthread_create(&thread, NULL, &sig_thread, this)) != 0) { std::cerr << "pthread_create() died during pthread_create(" << strerror(error) << ")" << std::endl; return false; } sem_wait(&lock); return true; } } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/util/pidfile.cc0000664000076400007640000001074312111251073016454 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 "gear_config.h" #include "util/pidfile.hpp" #include #include #include #include #include #include #include #include #include #include extern "C" { char pid_file[1024 * 4]= { 0 }; static void remove_pidfile(void) { if (pid_file[0]) { if (unlink(pid_file) == -1) { std::cerr << "Could not remove pidfile: " << pid_file << "(" << strerror(errno) << ")" << std::endl; } pid_file[0]= 0; } } } namespace datadifferential { namespace util { Pidfile::Pidfile(const std::string &arg) : _last_errno(0), _filename(arg) { } Pidfile::~Pidfile() { if (not _filename.empty()) { if (access(_filename.c_str(), F_OK) == -1) { std::stringstream error_stream; error_stream << "Could not access the pid file: " << _filename << "(" << strerror(errno) << ")"; _error_message= error_stream.str(); } else if (unlink(_filename.c_str()) == -1) { std::stringstream error_stream; error_stream << "Could not remove the pid file: " << _filename << "(" << strerror(errno) << ")"; _error_message= error_stream.str(); } } pid_file[0]= 0; } bool Pidfile::create() { if (_filename.empty()) { return true; } if (access(_filename.c_str(), F_OK) == 0) { if (unlink(_filename.c_str()) == -1) { _last_errno= errno; std::stringstream error_stream; error_stream << "Unable to remove exisiting file:" << _filename << "(" << strerror(errno) << ")"; _error_message= error_stream.str(); return false; } } int oflags= O_CREAT|O_WRONLY|O_TRUNC; #ifdef HAVE_O_CLOEXEC oflags= oflags | O_CLOEXEC; #endif int file; if ((file = open(_filename.c_str(), oflags, S_IRWXU|S_IRGRP|S_IROTH)) < 0) { _last_errno= errno; std::stringstream error_stream; error_stream << "Could not open pid file for writing: " << _filename << "(" << strerror(errno) << ")"; _error_message= error_stream.str(); 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) { _last_errno= errno; std::stringstream error_stream; error_stream << "Could not write pid to file: " << _filename << "(" << strerror(errno) << ")"; _error_message= error_stream.str(); close(file); return false; } if (close(file) < 0) { _last_errno= errno; _error_message+= "Could not close() file after writing pid to it: "; _error_message+= _filename; return false; } snprintf(pid_file, sizeof(pid_file), "%s", _filename.c_str()); atexit(remove_pidfile); return true; } } /* namespace util */ } /* namespace datadifferential */ gearmand-1.0.6/scripts/0000775000076400007640000000000012142673676015263 5ustar00brianbrian00000000000000gearmand-1.0.6/scripts/gearmand.xml.in0000664000076400007640000000413712107145705020161 0ustar00brianbrian00000000000000 gearmand-1.0.6/scripts/gearmand-init.in0000664000076400007640000000110312107145705020311 0ustar00brianbrian00000000000000#!/bin/sh # 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. prefix=@prefix@ exec_prefix=@exec_prefix@ GEARMAND=@sbindir@/gearmand PIDFILE=@localstatedir@/run/gearmand.pid start() { $GEARMAND -d -P $PIDFILE } stop() { kill `cat $PIDFILE` rm -f $PIDFILE } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" ;; esac gearmand-1.0.6/scripts/README.solaris0000664000076400007640000000052212107145705017601 0ustar00brianbrian00000000000000smf_install.sh is a script that will install gearman as a service monitored by the Solaris SMF. It will define a user and group named gearmand, and create authorization and profile definitions so that you can grant users the rights to start / stop or change the service. You need administrative rights to run the profile shell script. gearmand-1.0.6/scripts/gearmand.in0000664000076400007640000000062312107145705017356 0ustar00brianbrian00000000000000#!/sbin/sh # # Script used to start Gearman from Solaris SMF # . /lib/svc/share/smf_include.sh prefix=@prefix@ exec_prefix=@exec_prefix@ case "$1" in 'start') /bin/coreadm -p "`svcprop -p gearman/corepattern $SMF_FMRI`" $$ @sbindir@/gearmand -d ;; 'stop') smf_kill_contract $2 TERM 1 ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac exit $SMF_EXIT_OK gearmand-1.0.6/scripts/smf_install.sh.in0000775000076400007640000000320412107145705020525 0ustar00brianbrian00000000000000#! /bin/pfsh prefix=@prefix@ exec_prefix=@exec_prefix@ grep solaris.smf.value.gearman /etc/security/auth_attr > /dev/null if [ $? -ne 0 ] then ed /etc/security/auth_attr > /dev/null < /dev/null if [ $? -ne 0 ] then ed /etc/security/prof_attr > /dev/null < /dev/null if [ $? -ne 0 ] then groupadd gearmand if [ $? -ne 0 ] then echo "Failed to create group gearmand" exit 1 fi fi getent passwd gearmand > /dev/null if [ $? -ne 0 ] then roleadd -c "Gearman daemon" -d @localstatedir@ -g gearmand \ -A solaris.smf.value.gearman,solaris.smf.manage.gearman gearmand if [ $? -ne 0 ] then echo "Failed to create role gearmand" exit 1 fi mkdir -p @localstatedir@ chown gearmand:gearmand @localstatedir@ fi /usr/sbin/install -f /lib/svc/method gearmand if [ $? -ne 0 ] then echo "Failed to install smf startup script" exit 1 fi /usr/sbin/install -f /var/svc/manifest/application -m 0444 gearmand.xml if [ $? -ne 0 ] then echo "Failed to install smf definition" exit 1 fi svccfg import /var/svc/manifest/application/gearmand.xml if [ $? -ne 0 ] then echo "Failed to import smf definition" exit 1 fi gearmand-1.0.6/THANKS0000664000076400007640000000006012107145705014467 0ustar00brianbrian00000000000000John Ewart, john@johnewart.net -- Epoch support gearmand-1.0.6/gearmand/0000775000076400007640000000000012142673676015352 5ustar00brianbrian00000000000000gearmand-1.0.6/gearmand/log.hpp0000664000076400007640000001073112107145705016632 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 { struct gearmand_log_info_st { std::string filename; int fd; bool opt_syslog; bool opt_file; bool init_success; gearmand_log_info_st(const std::string &filename_arg, const bool syslog_arg) : filename(filename_arg), fd(-1), opt_syslog(syslog_arg), opt_file(false), init_success(false) { if (opt_syslog) { openlog("gearmand", LOG_PID | LOG_NDELAY, LOG_USER); } init(); } void init() { if (filename.size()) { if (filename.compare("stderr") == 0) { fd= STDERR_FILENO; opt_file= true; } else if (filename.compare("none") == 0) { } else { fd= open(filename.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644); if (fd == -1) { char cwd_buffer[1024]; char *cwd= getcwd(cwd_buffer, sizeof(cwd_buffer)); char error_mesg[1024]; int error_mesg_length= snprintf(error_mesg, sizeof(error_mesg), "Could not open log file \"%.*s\", from \"%s\", switching to stderr.", int(filename.size()), filename.c_str(), cwd); if (opt_syslog) { syslog(LOG_ERR, "%.*s", error_mesg_length, error_mesg); } error::perror(error_mesg); fd= STDERR_FILENO; } opt_file= true; } } init_success= true; } bool initialized() const { return init_success; } void reset() { int new_fd= open(filename.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644); if (new_fd != -1) { int old_fd= fd; fd= new_fd; close(old_fd); } } int file() const { return fd; } void write(gearmand_verbose_t verbose, const char *mesg) { if (opt_file) { char buffer[GEARMAN_MAX_ERROR_SIZE]; int buffer_length= snprintf(buffer, GEARMAN_MAX_ERROR_SIZE, "%7s %s\n", gearmand_verbose_name(verbose), mesg); if (::write(file(), buffer, buffer_length) == -1) { error::perror("Could not write to log file."); if (opt_syslog) { char getcwd_buffer[1024]; char *ptr_buffer= getcwd(getcwd_buffer, sizeof(getcwd_buffer)); syslog(LOG_ERR, "Could not open log file \"%.*s\", from \"%s\", open failed with (%s)", int(filename.size()), filename.c_str(), ptr_buffer, strerror(errno)); } } } if (opt_syslog) { syslog(int(verbose), "%7s %s", gearmand_verbose_name(verbose), mesg); } } ~gearmand_log_info_st() { if (fd != -1 and fd != STDERR_FILENO) { close(fd); } if (opt_syslog) { closelog(); } } }; } // namespace gearmand gearmand-1.0.6/gearmand/include.am0000664000076400007640000000374012107145705017304 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2010-2012 DataDifferential LLC # 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 noinst_HEADERS+= gearmand/error.hpp noinst_HEADERS+= gearmand/log.hpp sbin_PROGRAMS+= gearmand/gearmand BUILT_SOURCES+= configmake.h gearmand_gearmand_LDADD= gearmand_gearmand_CXXFLAGS= EXTRA_gearmand_gearmand_DEPENDENCIES= gearmand_gearmand_LDFLAGS= gearmand_gearmand_SOURCES= gearmand_gearmand_CXXFLAGS+= $(BOOST_CPPFLAGS) EXTRA_gearmand_gearmand_DEPENDENCIES+= configmake.h gearmand_gearmand_LDADD+= libgearman-server/libgearman-server.la gearmand_gearmand_LDFLAGS+= $(BOOST_PROGRAM_OPTIONS_LDFLAGS) gearmand_gearmand_SOURCES+= configmake.h gearmand_gearmand_SOURCES+= gearmand/gearmand.cc gearmand_gearmand_SOURCES+= util/daemon.cc gearmand_gearmand_SOURCES+= util/pidfile.cc gearmand_hostile_gearmand_CXXFLAGS= EXTRA_gearmand_hostile_gearmand_DEPENDENCIES= gearmand_hostile_gearmand_LDADD= gearmand_hostile_gearmand_LDFLAGS= gearmand_hostile_gearmand_SOURCES= gearmand_hostile_gearmand_CXXFLAGS+= $(gearmand_gearmand_CXXFLAGS) EXTRA_gearmand_hostile_gearmand_DEPENDENCIES+= $(EXTRA_gearmand_gearmand_DEPENDENCIES) gearmand_hostile_gearmand_LDADD+= @DL_LIB@ gearmand_hostile_gearmand_LDADD+= libgearman-server/libgearman-server.la if TARGET_HOSTILE gearmand_hostile_gearmand_LDADD+= libhostile/libhostile.la endif gearmand_hostile_gearmand_LDFLAGS+= $(gearmand_gearmand_LDFLAGS) gearmand_hostile_gearmand_SOURCES+= $(gearmand_gearmand_SOURCES) noinst_PROGRAMS+=gearmand/hostile_gearmand gearmand-valgrind: gearmand/gearmand $(LIBTOOL) --mode=execute valgrind --leak-check=yes gearmand/gearmand gearmand-debug: gearmand/gearmand $(LIBTOOL) --mode=execute gdb gearmand/gearmand gearmand-1.0.6/gearmand/gearmand.cc0000664000076400007640000004151712111602475017430 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include "configmake.h" #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 "libgearman-server/gearmand.h" #include "libgearman-server/plugins.h" #include "libgearman-server/queue.hpp" #define GEARMAND_LOG_REOPEN_TIME 60 #include "util/daemon.hpp" #include "util/pidfile.hpp" #include #include #include #include #include #include #include #include "gearmand/error.hpp" #include "gearmand/log.hpp" #include "libgearman/backtrace.hpp" using namespace datadifferential; using namespace gearmand; static bool _set_fdlimit(rlim_t fds); static bool _switch_user(const char *user); extern "C" { static bool _set_signals(bool core_dump= false); } static void _log(const char *line, gearmand_verbose_t verbose, void *context); int main(int argc, char *argv[]) { gearmand::error::init(argv[0]); 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 protocol; std::string queue_type; std::string job_handle_prefix; std::string verbose_string= "ERROR"; std::string config_file; uint32_t threads; bool opt_exceptions; bool opt_round_robin; bool opt_daemon; bool opt_check_args; bool opt_syslog; bool opt_coredump; uint32_t hashtable_buckets; 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.") ("daemon,d", boost::program_options::bool_switch(&opt_daemon)->default_value(false), "Daemon, detach and run in the background.") ("exceptions", boost::program_options::bool_switch(&opt_exceptions)->default_value(false), "Enable protocol exceptions by default.") ("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.") ("job-handle-prefix", boost::program_options::value(&job_handle_prefix), "Prefix used to generate a job handle string. If not provided, the default \"H:\" is used.") ("hashtable-buckets", boost::program_options::value(&hashtable_buckets)->default_value(GEARMAND_DEFAULT_HASH_SIZE), "Number of buckets in the internal job hash tables. The default of 991 works well for about three million jobs in queue. If the number of jobs in the queue at any time will exceed three million, use proportionally larger values (991 * # of jobs / 3M). For example, to accomodate 2^32 jobs, use 1733003. This will consume ~26MB of extra memory. Gearmand cannot support more than 2^32 jobs in queue at this time.") ("log-file,l", boost::program_options::value(&log_file)->default_value(LOCALSTATEDIR"/log/gearmand.log"), "Log file to write errors and information to. If the log-file parameter is specified as 'stderr', then output will go to stderr. If 'none', then no logfile will be generated.") ("listen,L", boost::program_options::value(&host), "Address the server should listen on. Default is INADDR_ANY.") ("pid-file,P", boost::program_options::value(&pid_file)->default_value(GEARMAND_PID), "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)->default_value("builtin"), "Persistent queue type to use.") ("config-file", boost::program_options::value(&config_file)->default_value(GEARMAND_CONFIG), "Can be specified with '@name', too") ("syslog", boost::program_options::bool_switch(&opt_syslog)->default_value(false), "Use syslog.") ("coredump", boost::program_options::bool_switch(&opt_coredump)->default_value(false), "Whether to create a core dump for uncaught signals.") ("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", boost::program_options::value(&verbose_string)->default_value(verbose_string), "Set verbose level (FATAL, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG).") ("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::protocol::Gear gear; all.add(gear.command_line_options()); gearmand::plugins::initialize(all); boost::program_options::positional_options_description positional; positional.add("provided", -1); // Now insert all options that we want to make visible to the user boost::program_options::options_description visible("Allowed options"); visible.add(all); boost::program_options::options_description hidden("Hidden options"); hidden.add_options() ("check-args", boost::program_options::bool_switch(&opt_check_args)->default_value(false), "Check command line and configuration file argments and then exit."); all.add(hidden); boost::program_options::variables_map vm; try { // Disable allow_guessing int style= boost::program_options::command_line_style::default_style ^ boost::program_options::command_line_style::allow_guessing; boost::program_options::parsed_options parsed= boost::program_options::command_line_parser(argc, argv) .options(all) .positional(positional) .style(style) .run(); store(parsed, vm); notify(vm); if (config_file.empty() == false) { // Load the file and tokenize it std::ifstream ifs(config_file.c_str()); if (ifs) { // Read the whole file into a string std::stringstream ss; ss << ifs.rdbuf(); // Split the file content boost::char_separator sep(" \n\r"); std::string sstr= ss.str(); boost::tokenizer > tok(sstr, sep); std::vector args; std::copy(tok.begin(), tok.end(), back_inserter(args)); for (std::vector::iterator iter= args.begin(); iter != args.end(); ++iter) { std::cerr << *iter << std::endl; } // Parse the file and store the options store(boost::program_options::command_line_parser(args).options(visible).run(), vm); } else if (config_file.compare(GEARMAND_CONFIG)) { error::message("Could not open configuration file."); return EXIT_FAILURE; } } notify(vm); } catch(boost::program_options::validation_error &e) { error::message(e.what()); return EXIT_FAILURE; } catch(std::exception &e) { if (e.what() and strncmp("-v", e.what(), 2) == 0) { error::message("Option -v has been deprecated, please use --verbose"); } else { error::message(e.what()); } return EXIT_FAILURE; } gearmand_verbose_t verbose= GEARMAND_VERBOSE_ERROR; if (gearmand_verbose_check(verbose_string.c_str(), verbose) == false) { error::message("Invalid value for --verbose supplied"); return EXIT_FAILURE; } if (hashtable_buckets <= 0) { error::message("hashtable-buckets has to be greater than 0"); return EXIT_FAILURE; } if (opt_check_args) { return EXIT_SUCCESS; } if (vm.count("help")) { std::cout << visible << std::endl; return EXIT_SUCCESS; } if (vm.count("version")) { std::cout << std::endl << "gearmand " << gearmand_version() << " - " << gearmand_bugreport() << std::endl; return EXIT_SUCCESS; } if (fds > 0 and _set_fdlimit(fds)) { return EXIT_FAILURE; } if (not user.empty() and _switch_user(user.c_str())) { return EXIT_FAILURE; } if (opt_daemon) { util::daemonize(false, true); } if (_set_signals(opt_coredump)) { return EXIT_FAILURE; } util::Pidfile _pid_file(pid_file); if (_pid_file.create() == false and pid_file.compare(GEARMAND_PID)) { error::perror(_pid_file.error_message().c_str()); return EXIT_FAILURE; } gearmand::gearmand_log_info_st log_info(log_file, opt_syslog); if (log_info.initialized() == false) { return EXIT_FAILURE; } gearmand_st *_gearmand= gearmand_create(host.empty() ? NULL : host.c_str(), threads, backlog, static_cast(job_retries), job_handle_prefix.empty() ? NULL : job_handle_prefix.c_str(), static_cast(worker_wakeup), _log, &log_info, verbose, opt_round_robin, opt_exceptions, hashtable_buckets); if (_gearmand == NULL) { error::message("Could not create gearmand library instance."); return EXIT_FAILURE; } assert(queue_type.size()); if (queue_type.empty() == false) { gearmand_error_t rc; if ((rc= gearmand::queue::initialize(_gearmand, queue_type.c_str())) != GEARMAN_SUCCESS) { error::message("Error while initializing the queue", queue_type.c_str()); gearmand_free(_gearmand); return EXIT_FAILURE; } } if (gear.start(_gearmand) != GEARMAN_SUCCESS) { error::message("Error while enabling Gear protocol module"); gearmand_free(_gearmand); return EXIT_FAILURE; } if (protocol.compare("http") == 0) { if (http.start(_gearmand) != GEARMAN_SUCCESS) { error::message("Error while enabling protocol module", protocol.c_str()); gearmand_free(_gearmand); return EXIT_FAILURE; } } else if (protocol.empty() == false) { error::message("Unknown protocol module", protocol.c_str()); gearmand_free(_gearmand); return EXIT_FAILURE; } if (opt_daemon) { if (util::daemon_is_ready(true) == false) { return EXIT_FAILURE; } } gearmand_error_t ret= gearmand_run(_gearmand); gearmand_free(_gearmand); _gearmand= NULL; 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 or 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" void _shutdown_handler(int signal_, siginfo_t*, void*) { if (signal_== SIGUSR1) { gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL); } else { gearmand_wakeup(Gearmand(), GEARMAND_WAKEUP_SHUTDOWN); } } extern "C" void _reset_log_handler(int, siginfo_t*, void*) // signal_arg { gearmand_log_info_st *log_info= static_cast(Gearmand()->log_context); log_info->write(GEARMAND_VERBOSE_NOTICE, "SIGHUP, reopening log file"); log_info->reset(); } static bool segfaulted= false; extern "C" void _crash_handler(int signal_, siginfo_t*, void*) { if (segfaulted) { error::message("\nFatal crash while backtrace from signal:", strsignal(signal_)); _exit(EXIT_FAILURE); /* Quit without running destructors */ } segfaulted= true; custom_backtrace(); _exit(EXIT_FAILURE); /* Quit without running destructors */ } extern "C" { static bool _set_signals(bool core_dump) { struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sa.sa_handler= SIG_IGN; if (sigemptyset(&sa.sa_mask) == -1 or sigaction(SIGPIPE, &sa, 0) == -1) { error::perror("Could not set SIGPIPE handler."); return true; } sa.sa_sigaction= _shutdown_handler; sa.sa_flags= SA_SIGINFO; 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; } sa.sa_sigaction= _reset_log_handler; if (sigaction(SIGHUP, &sa, 0) == -1) { error::perror("Could not set SIGHUP handler."); return true; } bool in_gdb_libtest= bool(getenv("LIBTEST_IN_GDB")); if ((in_gdb_libtest == false) and (core_dump == false)) { sa.sa_sigaction= _crash_handler; if (sigaction(SIGSEGV, &sa, NULL) == -1) { error::perror("Could not set SIGSEGV handler."); return true; } if (sigaction(SIGABRT, &sa, NULL) == -1) { error::perror("Could not set SIGABRT handler."); return true; } #ifdef SIGBUS if (sigaction(SIGBUS, &sa, NULL) == -1) { error::perror("Could not set SIGBUS handler."); return true; } #endif if (sigaction(SIGILL, &sa, NULL) == -1) { error::perror("Could not set SIGILL handler."); return true; } if (sigaction(SIGFPE, &sa, NULL) == -1) { error::perror("Could not set SIGFPE handler."); return true; } } return false; } } static void _log(const char *mesg, gearmand_verbose_t verbose, void *context) { gearmand_log_info_st *log_info= static_cast(context); log_info->write(verbose, mesg); } gearmand-1.0.6/gearmand/error.hpp0000664000076400007640000000522712107145705017206 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 static const char* _progname= NULL; namespace gearmand { namespace error { void init(const char* progname_) { _progname= progname_; } 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 << _progname << ": " << message << " (" << errmsg_ptr << ")" << std::endl; } inline void message(const char *arg) { std::cerr << _progname << ": " << arg << std::endl; } inline void message(const char *arg, const char *arg2) { std::cerr << _progname << ": " << arg << " : " << arg2 << std::endl; } #ifdef DBUILDING_LIBGEARMAN inline void message(const std::string &arg, gearmand_error_t rc) { std::cerr << _progname << ": " << arg << " : " << gearmand_strerror(rc) << std::endl; } #endif } // namespace error } // namespace gearmand gearmand-1.0.6/support/0000775000076400007640000000000012142673676015310 5ustar00brianbrian00000000000000gearmand-1.0.6/support/gearmand.pc0000664000076400007640000000033412142673655017407 0ustar00brianbrian00000000000000prefix=/usr/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: gearmand Description: Gearman Server and C Library Version: 1.0.6 Libs: -L${libdir} -lgearman Cflags: -I${includedir} gearmand-1.0.6/support/include.am0000664000076400007640000000043412107145705017237 0ustar00brianbrian00000000000000# vim:ft=automake # included from Top Level Makefile.am # All paths should be given relative to the root EXTRA_DIST += \ support/gearmand.init \ support/gearmand.pc \ support/gearmand.spec pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = support/gearmand.pc gearmand-1.0.6/support/gearmand.pc.in0000664000076400007640000000032312107145705020001 0ustar00brianbrian00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: gearmand Description: Gearman Server and C Library Version: @VERSION@ Libs: -L${libdir} -lgearman Cflags: -I${includedir} gearmand-1.0.6/support/gearmand.init0000664000076400007640000000310412107145705017735 0ustar00brianbrian00000000000000#!/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 gearmand-1.0.6/support/gearmand.spec0000664000076400007640000002717212142673655017750 0ustar00brianbrian00000000000000Summary: Gearman Server and C Library Name: gearmand Version: 1.0.6 Release: 1 License: BSD Group: System Environment/Libraries BuildRequires: bison 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: support/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 --disable-libpq --disable-libtokyocabinet --disable-libdrizzle --disable-libmemcached --enable-jobserver=no %build %{__make} %{?_smp_mflags} %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 %check %clean %{__rm} -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %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.7 %{_libdir}/libgearman.so.7.0.1 %{_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 /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/gearman.h %{_includedir}/libgearman-1.0/actions.h %{_includedir}/libgearman-1.0/aggregator.h %{_includedir}/libgearman-1.0/allocator.h %{_includedir}/libgearman-1.0/argument.h %{_includedir}/libgearman-1.0/client.h %{_includedir}/libgearman-1.0/client_callbacks.h %{_includedir}/libgearman-1.0/configure.h %{_includedir}/libgearman-1.0/connection.h %{_includedir}/libgearman-1.0/constants.h %{_includedir}/libgearman-1.0/core.h %{_includedir}/libgearman-1.0/execute.h %{_includedir}/libgearman-1.0/function.h %{_includedir}/libgearman-1.0/gearman.h %{_includedir}/libgearman-1.0/interface/status.h %{_includedir}/libgearman-1.0/interface/task.h %{_includedir}/libgearman-1.0/job.h %{_includedir}/libgearman-1.0/job_handle.h %{_includedir}/libgearman-1.0/kill.h %{_includedir}/libgearman-1.0/limits.h %{_includedir}/libgearman-1.0/ostream.hpp %{_includedir}/libgearman-1.0/packet.h %{_includedir}/libgearman-1.0/parse.h %{_includedir}/libgearman-1.0/priority.h %{_includedir}/libgearman-1.0/protocol.h %{_includedir}/libgearman-1.0/result.h %{_includedir}/libgearman-1.0/return.h %{_includedir}/libgearman-1.0/signal.h %{_includedir}/libgearman-1.0/status.h %{_includedir}/libgearman-1.0/strerror.h %{_includedir}/libgearman-1.0/string.h %{_includedir}/libgearman-1.0/task.h %{_includedir}/libgearman-1.0/task_attr.h %{_includedir}/libgearman-1.0/universal.h %{_includedir}/libgearman-1.0/util.h %{_includedir}/libgearman-1.0/version.h %{_includedir}/libgearman-1.0/visibility.h %{_includedir}/libgearman-1.0/worker.h %{_libdir}/pkgconfig/gearmand.pc %{_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 %{_mandir}/man3/gearman_client_add_servers.3.gz %{_mandir}/man3/gearman_client_add_task.3.gz %{_mandir}/man3/gearman_client_add_task_background.3.gz %{_mandir}/man3/gearman_client_add_task_high.3.gz %{_mandir}/man3/gearman_client_add_task_high_background.3.gz %{_mandir}/man3/gearman_client_add_task_low.3.gz %{_mandir}/man3/gearman_client_add_task_low_background.3.gz %{_mandir}/man3/gearman_client_add_task_status.3.gz %{_mandir}/man3/gearman_client_clear_fn.3.gz %{_mandir}/man3/gearman_client_clone.3.gz %{_mandir}/man3/gearman_client_context.3.gz %{_mandir}/man3/gearman_client_create.3.gz %{_mandir}/man3/gearman_client_do.3.gz %{_mandir}/man3/gearman_client_do_background.3.gz %{_mandir}/man3/gearman_client_do_high.3.gz %{_mandir}/man3/gearman_client_do_high_background.3.gz %{_mandir}/man3/gearman_client_do_job_handle.3.gz %{_mandir}/man3/gearman_client_do_low.3.gz %{_mandir}/man3/gearman_client_do_low_background.3.gz %{_mandir}/man3/gearman_client_do_status.3.gz %{_mandir}/man3/gearman_client_echo.3.gz %{_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 %{_mandir}/man3/gearman_client_set_complete_fn.3.gz %{_mandir}/man3/gearman_client_set_context.3.gz %{_mandir}/man3/gearman_client_set_created_fn.3.gz %{_mandir}/man3/gearman_client_set_data_fn.3.gz %{_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 %{_mandir}/man3/gearman_client_set_timeout.3.gz %{_mandir}/man3/gearman_client_set_warning_fn.3.gz %{_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 %{_mandir}/man3/gearman_task_is_known.3.gz %{_mandir}/man3/gearman_task_is_running.3.gz %{_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 %{_mandir}/man3/gearman_worker_add_server.3.gz %{_mandir}/man3/gearman_worker_add_servers.3.gz %{_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 %{_mandir}/man3/gearman_worker_free.3.gz %{_mandir}/man3/gearman_worker_function_exist.3.gz %{_mandir}/man3/gearman_worker_grab_job.3.gz %{_mandir}/man3/gearman_worker_options.3.gz %{_mandir}/man3/gearman_worker_register.3.gz %{_mandir}/man3/gearman_worker_remove_options.3.gz %{_mandir}/man3/gearman_worker_remove_servers.3.gz %{_mandir}/man3/gearman_worker_set_context.3.gz %{_mandir}/man3/gearman_worker_set_identifier.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}/man3/libgearman.3.gz %changelog * Wed Jan 7 2009 Brian Aker - 0.1-1 - Initial package gearmand-1.0.6/support/gearmand.spec.in0000664000076400007640000002717712107145705020351 0ustar00brianbrian00000000000000Summary: Gearman Server and C Library Name: @PACKAGE@ Version: @VERSION@ Release: 1 License: BSD Group: System Environment/Libraries BuildRequires: bison 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: support/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 --disable-libpq --disable-libtokyocabinet --disable-libdrizzle --disable-libmemcached --enable-jobserver=no %build %{__make} %{?_smp_mflags} %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 %check %clean %{__rm} -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %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.7 %{_libdir}/libgearman.so.7.0.1 %{_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 /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/gearman.h %{_includedir}/libgearman-1.0/actions.h %{_includedir}/libgearman-1.0/aggregator.h %{_includedir}/libgearman-1.0/allocator.h %{_includedir}/libgearman-1.0/argument.h %{_includedir}/libgearman-1.0/client.h %{_includedir}/libgearman-1.0/client_callbacks.h %{_includedir}/libgearman-1.0/configure.h %{_includedir}/libgearman-1.0/connection.h %{_includedir}/libgearman-1.0/constants.h %{_includedir}/libgearman-1.0/core.h %{_includedir}/libgearman-1.0/execute.h %{_includedir}/libgearman-1.0/function.h %{_includedir}/libgearman-1.0/gearman.h %{_includedir}/libgearman-1.0/interface/status.h %{_includedir}/libgearman-1.0/interface/task.h %{_includedir}/libgearman-1.0/job.h %{_includedir}/libgearman-1.0/job_handle.h %{_includedir}/libgearman-1.0/kill.h %{_includedir}/libgearman-1.0/limits.h %{_includedir}/libgearman-1.0/ostream.hpp %{_includedir}/libgearman-1.0/packet.h %{_includedir}/libgearman-1.0/parse.h %{_includedir}/libgearman-1.0/priority.h %{_includedir}/libgearman-1.0/protocol.h %{_includedir}/libgearman-1.0/result.h %{_includedir}/libgearman-1.0/return.h %{_includedir}/libgearman-1.0/signal.h %{_includedir}/libgearman-1.0/status.h %{_includedir}/libgearman-1.0/strerror.h %{_includedir}/libgearman-1.0/string.h %{_includedir}/libgearman-1.0/task.h %{_includedir}/libgearman-1.0/task_attr.h %{_includedir}/libgearman-1.0/universal.h %{_includedir}/libgearman-1.0/util.h %{_includedir}/libgearman-1.0/version.h %{_includedir}/libgearman-1.0/visibility.h %{_includedir}/libgearman-1.0/worker.h %{_libdir}/pkgconfig/gearmand.pc %{_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 %{_mandir}/man3/gearman_client_add_servers.3.gz %{_mandir}/man3/gearman_client_add_task.3.gz %{_mandir}/man3/gearman_client_add_task_background.3.gz %{_mandir}/man3/gearman_client_add_task_high.3.gz %{_mandir}/man3/gearman_client_add_task_high_background.3.gz %{_mandir}/man3/gearman_client_add_task_low.3.gz %{_mandir}/man3/gearman_client_add_task_low_background.3.gz %{_mandir}/man3/gearman_client_add_task_status.3.gz %{_mandir}/man3/gearman_client_clear_fn.3.gz %{_mandir}/man3/gearman_client_clone.3.gz %{_mandir}/man3/gearman_client_context.3.gz %{_mandir}/man3/gearman_client_create.3.gz %{_mandir}/man3/gearman_client_do.3.gz %{_mandir}/man3/gearman_client_do_background.3.gz %{_mandir}/man3/gearman_client_do_high.3.gz %{_mandir}/man3/gearman_client_do_high_background.3.gz %{_mandir}/man3/gearman_client_do_job_handle.3.gz %{_mandir}/man3/gearman_client_do_low.3.gz %{_mandir}/man3/gearman_client_do_low_background.3.gz %{_mandir}/man3/gearman_client_do_status.3.gz %{_mandir}/man3/gearman_client_echo.3.gz %{_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 %{_mandir}/man3/gearman_client_set_complete_fn.3.gz %{_mandir}/man3/gearman_client_set_context.3.gz %{_mandir}/man3/gearman_client_set_created_fn.3.gz %{_mandir}/man3/gearman_client_set_data_fn.3.gz %{_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 %{_mandir}/man3/gearman_client_set_timeout.3.gz %{_mandir}/man3/gearman_client_set_warning_fn.3.gz %{_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 %{_mandir}/man3/gearman_task_is_known.3.gz %{_mandir}/man3/gearman_task_is_running.3.gz %{_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 %{_mandir}/man3/gearman_worker_add_server.3.gz %{_mandir}/man3/gearman_worker_add_servers.3.gz %{_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 %{_mandir}/man3/gearman_worker_free.3.gz %{_mandir}/man3/gearman_worker_function_exist.3.gz %{_mandir}/man3/gearman_worker_grab_job.3.gz %{_mandir}/man3/gearman_worker_options.3.gz %{_mandir}/man3/gearman_worker_register.3.gz %{_mandir}/man3/gearman_worker_remove_options.3.gz %{_mandir}/man3/gearman_worker_remove_servers.3.gz %{_mandir}/man3/gearman_worker_set_context.3.gz %{_mandir}/man3/gearman_worker_set_identifier.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}/man3/libgearman.3.gz %changelog * Wed Jan 7 2009 Brian Aker - 0.1-1 - Initial package gearmand-1.0.6/libgearman/0000775000076400007640000000000012142673674015673 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman/server_options.cc0000664000076400007640000000657312137720504021263 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2013 Data Differential, http://datadifferential.com/ * Copyright (C) 2013 Keyur Govande * 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 Server options */ #include "gear_config.h" #include "libgearman/common.h" #include bool gearman_request_option(gearman_universal_st &universal, gearman_string_t &option) { gearman_server_options_st *server_options = new (std::nothrow) gearman_server_options_st(universal, gearman_c_str(option), gearman_size(option)); if (server_options == NULL) { gearman_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "new gearman_server_options_st()"); return false; } return true; } gearman_server_options_st::gearman_server_options_st(gearman_universal_st &universal_arg, const char* option_arg, const size_t option_arg_size) : _option(option_arg_size), next(NULL), prev(NULL), universal(universal_arg) { _option.append(option_arg, option_arg_size); if (universal.server_options_list) { universal.server_options_list->prev= this; } next= universal.server_options_list; universal.server_options_list= this; } gearman_server_options_st::gearman_server_options_st(const gearman_server_options_st& copy) : _option(copy.option()), next(NULL), prev(NULL), universal(copy.universal) { if (universal.server_options_list) { universal.server_options_list->prev= this; } next= universal.server_options_list; universal.server_options_list= this; } gearman_server_options_st::~gearman_server_options_st() { { // Remove from universal list if (universal.server_options_list == this) { universal.server_options_list= next; } if (prev) { prev->next= next; } if (next) { next->prev= prev; } } } gearmand-1.0.6/libgearman/aggregator.hpp0000664000076400007640000000346212107145705020521 0ustar00brianbrian00000000000000/* 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) { } }; gearmand-1.0.6/libgearman/result.cc0000664000076400007640000001507412141162033017504 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include "libgearman/result.hpp" #include "libgearman/assert.hpp" #include "libgearman-1.0/visibility.h" #include "libgearman-1.0/result.h" #include "libgearman/vector.h" #include #include #include #include gearman_result_st::gearman_result_st() : _type(GEARMAN_RESULT_NULL) { value._boolean= false; } gearman_result_st::gearman_result_st(size_t reserve_size_) : _type(GEARMAN_RESULT_NULL), value(reserve_size_) { } bool gearman_result_is_null(const gearman_result_st *self) { if (self) { return self->is_null(); } return true; } size_t gearman_result_st::size() const { switch (_type) { case GEARMAN_RESULT_BINARY: return value.string.size(); case GEARMAN_RESULT_BOOLEAN: return 1; case GEARMAN_RESULT_INTEGER: return sizeof(int64_t); case GEARMAN_RESULT_NULL: return 0; } return 0; } int64_t gearman_result_st::integer() const { switch (_type) { case GEARMAN_RESULT_BINARY: return atoll(value.string.value()); case GEARMAN_RESULT_BOOLEAN: return value._boolean; case GEARMAN_RESULT_INTEGER: return value._integer; case GEARMAN_RESULT_NULL: return 0; } return 0; } int64_t gearman_result_integer(const gearman_result_st *self) { if (self) { return self->integer(); } return 0; } bool gearman_result_st::boolean() const { switch (_type) { case GEARMAN_RESULT_BINARY: return value.string.size(); case GEARMAN_RESULT_BOOLEAN: return value._boolean; case GEARMAN_RESULT_INTEGER: return value._integer ? true : false; case GEARMAN_RESULT_NULL: return false; } return false; } bool gearman_result_boolean(const gearman_result_st *self) { if (self) { return self->boolean(); } return false; } size_t gearman_result_size(const gearman_result_st *self) { if (self and self->_type == GEARMAN_RESULT_BINARY) { return gearman_string_length(&self->value.string); } return 0; } const char *gearman_result_value(const gearman_result_st *self) { if (self and self->_type == GEARMAN_RESULT_BINARY) { gearman_string_t ret= gearman_string(&self->value.string); return gearman_c_str(ret); } return NULL; } 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_st::take() { if (_type == GEARMAN_RESULT_BINARY and size()) { gearman_string_t ret_string= value.string.take(); clear(); return ret_string; } static gearman_string_t ret= {0, 0}; return ret; } gearman_string_t gearman_result_take_string(gearman_result_st *self) { if (self) { return self->take(); } static gearman_string_t ret= {0, 0}; return ret; } gearman_return_t gearman_result_store_string(gearman_result_st *self, gearman_string_t arg) { if (self) { if (self->store(gearman_string_param(arg)) == false) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } return GEARMAN_SUCCESS; } return GEARMAN_INVALID_ARGUMENT; } bool gearman_result_st::append(const char* arg, const size_t arg_length) { if (_type != GEARMAN_RESULT_BINARY) { clear(); _type= GEARMAN_RESULT_BINARY; } if (value.string.append(arg, arg_length) == false) { _type= GEARMAN_RESULT_NULL; return false; } return true; } #if 0 bool gearman_result_st::store(bool arg) { if (_type != GEARMAN_RESULT_BOOLEAN) { value.string.clear(); } value._boolean= arg; _type= GEARMAN_RESULT_BOOLEAN; return true; } #endif bool gearman_result_st::store(int64_t arg) { if (_type != GEARMAN_RESULT_INTEGER) { value.string.clear(); } value._integer= arg; _type= GEARMAN_RESULT_INTEGER; return true; } bool gearman_result_st::store(const gearman_string_t& arg) { return store(gearman_c_str(arg), gearman_size(arg)); } bool gearman_result_st::store(const char* arg, const size_t arg_length) { value.string.clear(); if (value.string.store(arg, arg_length) == false) { _type= GEARMAN_RESULT_NULL; return false; } _type= GEARMAN_RESULT_BINARY; return true; } gearman_return_t gearman_result_store_value(gearman_result_st *self, const void *value, size_t size) { if (self) { return self->store((const char*)value, size) == true ? GEARMAN_SUCCESS : GEARMAN_MEMORY_ALLOCATION_FAILURE; } return GEARMAN_INVALID_ARGUMENT; } bool gearman_result_st::integer(int64_t arg_) { if (_type != GEARMAN_RESULT_INTEGER) { clear(); _type= GEARMAN_RESULT_INTEGER; } value._integer= arg_; return true; } void gearman_result_store_integer(gearman_result_st *self, int64_t arg_) { if (self) { self->integer(arg_); } } void gearman_result_store_boolean(gearman_result_st *self, const bool arg_) { if (self) { self->boolean(arg_); } } gearmand-1.0.6/libgearman/is.hpp0000664000076400007640000000454712107145705017017 0ustar00brianbrian00000000000000/* 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)) gearmand-1.0.6/libgearman/add.cc0000664000076400007640000003642012141161607016722 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include "libgearman/assert.hpp" #include "libgearman/vector.h" #include "libgearman/uuid.hpp" #include "libhashkit-1.0/hashkit.h" #include #include #include #include #include namespace { bool is_background(gearman_command_t command) { switch (command) { case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: case GEARMAN_COMMAND_SUBMIT_JOB_BG: case GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG: case GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG: case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: return true; case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: case GEARMAN_COMMAND_SUBMIT_JOB: case GEARMAN_COMMAND_SUBMIT_JOB_LOW: case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: return true; case GEARMAN_COMMAND_ALL_YOURS: case GEARMAN_COMMAND_CANT_DO: case GEARMAN_COMMAND_CAN_DO: case GEARMAN_COMMAND_CAN_DO_TIMEOUT: case GEARMAN_COMMAND_ECHO_REQ: case GEARMAN_COMMAND_ECHO_RES: case GEARMAN_COMMAND_ERROR: case GEARMAN_COMMAND_GET_STATUS: case GEARMAN_COMMAND_GRAB_JOB: case GEARMAN_COMMAND_GRAB_JOB_ALL: case GEARMAN_COMMAND_GRAB_JOB_UNIQ: case GEARMAN_COMMAND_JOB_ASSIGN: case GEARMAN_COMMAND_JOB_ASSIGN_ALL: case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: case GEARMAN_COMMAND_JOB_CREATED: case GEARMAN_COMMAND_MAX: case GEARMAN_COMMAND_NOOP: case GEARMAN_COMMAND_NO_JOB: case GEARMAN_COMMAND_OPTION_REQ: case GEARMAN_COMMAND_OPTION_RES: case GEARMAN_COMMAND_PRE_SLEEP: case GEARMAN_COMMAND_RESET_ABILITIES: case GEARMAN_COMMAND_SET_CLIENT_ID: case GEARMAN_COMMAND_STATUS_RES: case GEARMAN_COMMAND_TEXT: case GEARMAN_COMMAND_UNUSED: case GEARMAN_COMMAND_WORK_COMPLETE: case GEARMAN_COMMAND_WORK_DATA: case GEARMAN_COMMAND_WORK_EXCEPTION: case GEARMAN_COMMAND_WORK_FAIL: case GEARMAN_COMMAND_WORK_STATUS: case GEARMAN_COMMAND_WORK_WARNING: case GEARMAN_COMMAND_GET_STATUS_UNIQUE: case GEARMAN_COMMAND_STATUS_RES_UNIQUE: assert(0); break; } return false; } } // namespace gearman_task_st *add_task(gearman_client_st& client, void *context, gearman_command_t command, const gearman_string_t &function, gearman_unique_t &unique, const gearman_string_t &workload, time_t when, const gearman_actions_t &actions) { return add_task(client, NULL, context, command, function, unique, workload, when, actions); } gearman_task_st *add_task_ptr(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, const gearman_actions_t &actions) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } 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 (task == NULL) { *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, gearman_unique_t &unique, const gearman_string_t &workload, time_t when, const gearman_actions_t &actions) { if (gearman_size(function) == 0 or gearman_c_str(function) == NULL or gearman_size(function) > GEARMAN_FUNCTION_MAX_SIZE) { if (gearman_size(function) > GEARMAN_FUNCTION_MAX_SIZE) { gearman_error(client.universal, GEARMAN_INVALID_ARGUMENT, "function name longer then GEARMAN_MAX_FUNCTION_SIZE"); } else { gearman_error(client.universal, GEARMAN_INVALID_ARGUMENT, "invalid function"); } return NULL; } if (gearman_size(unique) > GEARMAN_MAX_UNIQUE_SIZE) { gearman_error(client.universal, GEARMAN_INVALID_ARGUMENT, "unique name longer then GEARMAN_MAX_UNIQUE_SIZE"); return NULL; } 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 (task == NULL) { gearman_error(client.universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, ""); return NULL; } task->context= context; task->func= actions; if (gearman_unique_is_hash(unique)) { task->unique_length= snprintf(task->unique, GEARMAN_MAX_UNIQUE_SIZE, "%u", libhashkit_murmur3(gearman_string_param(workload))); } else if ((task->unique_length= gearman_size(unique))) { if (task->unique_length >= GEARMAN_MAX_UNIQUE_SIZE) { task->unique_length= GEARMAN_MAX_UNIQUE_SIZE -1; // Leave space for NULL byte } strncpy(task->unique, gearman_c_str(unique), GEARMAN_MAX_UNIQUE_SIZE); task->unique[task->unique_length]= 0; } else { if (client.options.generate_unique or is_background(command)) { safe_uuid_generate(task->unique, task->unique_length); } else { task->unique_length= 0; task->unique[0]= 0; } } assert(task->client); assert(task->client == &client); gearman_return_t rc= GEARMAN_INVALID_ARGUMENT; switch (command) { case GEARMAN_COMMAND_SUBMIT_JOB: case GEARMAN_COMMAND_SUBMIT_JOB_LOW: case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: rc= libgearman::protocol::submit(*task, command, function, workload); break; case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: rc= libgearman::protocol::submit_epoch(*task, function, workload, when); break; case GEARMAN_COMMAND_SUBMIT_JOB_BG: case GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG: case GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG: rc= libgearman::protocol::submit_background(*task, command, function, workload); break; case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: assert(0); rc= GEARMAN_INVALID_ARGUMENT; break; case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: case GEARMAN_COMMAND_ALL_YOURS: case GEARMAN_COMMAND_CANT_DO: case GEARMAN_COMMAND_CAN_DO: case GEARMAN_COMMAND_CAN_DO_TIMEOUT: case GEARMAN_COMMAND_ECHO_REQ: case GEARMAN_COMMAND_ECHO_RES: case GEARMAN_COMMAND_ERROR: case GEARMAN_COMMAND_GET_STATUS: case GEARMAN_COMMAND_GRAB_JOB: case GEARMAN_COMMAND_GRAB_JOB_ALL: case GEARMAN_COMMAND_GRAB_JOB_UNIQ: case GEARMAN_COMMAND_JOB_ASSIGN: case GEARMAN_COMMAND_JOB_ASSIGN_ALL: case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: case GEARMAN_COMMAND_JOB_CREATED: case GEARMAN_COMMAND_MAX: case GEARMAN_COMMAND_NOOP: case GEARMAN_COMMAND_NO_JOB: case GEARMAN_COMMAND_OPTION_REQ: case GEARMAN_COMMAND_OPTION_RES: case GEARMAN_COMMAND_PRE_SLEEP: case GEARMAN_COMMAND_RESET_ABILITIES: case GEARMAN_COMMAND_SET_CLIENT_ID: case GEARMAN_COMMAND_STATUS_RES: case GEARMAN_COMMAND_TEXT: case GEARMAN_COMMAND_UNUSED: case GEARMAN_COMMAND_WORK_COMPLETE: case GEARMAN_COMMAND_WORK_DATA: case GEARMAN_COMMAND_WORK_EXCEPTION: case GEARMAN_COMMAND_WORK_FAIL: case GEARMAN_COMMAND_WORK_STATUS: case GEARMAN_COMMAND_WORK_WARNING: case GEARMAN_COMMAND_GET_STATUS_UNIQUE: case GEARMAN_COMMAND_STATUS_RES_UNIQUE: assert(0); rc= GEARMAN_INVALID_ARGUMENT; break; } if (gearman_success(rc)) { client.new_tasks++; client.running_tasks++; task->options.send_in_use= true; return task; } gearman_task_free(task); 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, const gearman_actions_t &actions, const time_t, void *context) { const void *args[5]; size_t args_size[5]; if (gearman_size(function) == 0 or gearman_c_str(function) == NULL or gearman_size(function) > GEARMAN_FUNCTION_MAX_SIZE) { if (gearman_size(function) > GEARMAN_FUNCTION_MAX_SIZE) { gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function name longer then GEARMAN_MAX_FUNCTION_SIZE"); } else { gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "invalid function"); } return NULL; } if (gearman_size(unique) > GEARMAN_MAX_UNIQUE_SIZE) { gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "unique name longer then GEARMAN_MAX_UNIQUE_SIZE"); return NULL; } 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 (task == NULL) { 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_unique_is_hash(unique)) { task->unique_length= snprintf(task->unique, GEARMAN_MAX_UNIQUE_SIZE, "%u", libhashkit_murmur3(gearman_string_param(workload))); } else if ((task->unique_length= gearman_size(unique))) { if (task->unique_length >= GEARMAN_MAX_UNIQUE_SIZE) { task->unique_length= GEARMAN_MAX_UNIQUE_SIZE -1; // Leave space for NULL byte } strncpy(task->unique, gearman_c_str(unique), GEARMAN_MAX_UNIQUE_SIZE); task->unique[task->unique_length]= 0; } else { if (client->options.generate_unique or is_background(command)) { safe_uuid_generate(task->unique, task->unique_length); } else { task->unique_length= 0; task->unique[0]= 0; } } args[1]= task->unique; args_size[1]= task->unique_length +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; } gearmand-1.0.6/libgearman/common.h0000664000076400007640000000527412111006637017325 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 struct gearman_result_st; #include #include "libgearman/connection.hpp" #include "libgearman/universal.hpp" #include "libgearman/allocator.hpp" #include "libgearman/packet.hpp" #include "libgearman/run.hpp" #include "libgearman/aggregator.hpp" #include "libgearman/error.hpp" /* These are private not to be installed headers */ #include "libgearman/byteorder.h" #include "libgearman/strcommand.h" #include "libgearman/vector.hpp" #include "libgearman/unique.hpp" #include "libgearman/add.hpp" #include "libgearman/is.hpp" #include "libgearman/result.hpp" #include "libgearman/actions.hpp" #include "libgearman/string.hpp" #include "libgearman/command.h" #include "libgearman/task_attr.h" #include "libgearman/task.hpp" #include "libgearman/job.h" #include "libgearman/client.h" #include "libgearman/server_options.hpp" #include "libgearman/status.hpp" #include "libgearman/protocol/submit.h" gearman_function_t gearman_function_create_null(void); gearmand-1.0.6/libgearman/execute.cc0000664000076400007640000002145012125243252017630 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include "libgearman/assert.hpp" #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 *task_attr, gearman_argument_t *arguments, void *context) { if (client == NULL) { return NULL; } gearman_argument_t null_arg= gearman_argument_make(0, 0, 0, 0); if (arguments == NULL) { arguments= &null_arg; } if (function_name == NULL or function_length == 0) { 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 (task_attr) { switch (task_attr->kind) { case GEARMAN_TASK_ATTR_BACKGROUND: task= add_task(*client, context, pick_command_by_priority_background(task_attr->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(task_attr), gearman_actions_execute_defaults()); break; case GEARMAN_TASK_ATTR_FOREGROUND: task= add_task(*client, context, pick_command_by_priority(task_attr->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 (task == NULL) { 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 *task_attr, gearman_argument_t *arguments, void *context) { if (client == NULL) { errno= EINVAL; return NULL; } if ((partition_function == NULL) or (partition_function_length == 0)) { gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "partition_function was NULL"); return NULL; } if ((function_name == NULL) or (function_name_length == 0)) { gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function_name was NULL"); return NULL; } universal_reset_error(client->universal); 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 (task_attr) { switch (task_attr->kind) { case GEARMAN_TASK_ATTR_BACKGROUND: task= add_reducer_task(client, GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND, task_attr->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, task_attr->priority, partition, function, unique, arguments->value, gearman_actions_execute_defaults(), gearman_work_epoch(task_attr), context); #endif break; case GEARMAN_TASK_ATTR_FOREGROUND: task= add_reducer_task(client, GEARMAN_COMMAND_SUBMIT_REDUCE_JOB, task_attr->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 (task == NULL) { 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; } gearmand-1.0.6/libgearman/task.hpp0000664000076400007640000000457612107145705017350 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 /** * Initialize a task structure. * * @param[in] client Structure previously initialized with * gearman_client_create() or gearman_client_clone(). * @param[in] task 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_task_st *gearman_task_internal_create(gearman_client_st *client, gearman_task_st *task); void gearman_task_clear_fn(gearman_task_st *task); bool gearman_task_is_active(const gearman_task_st *self); gearman_result_st *gearman_task_mutable_result(gearman_task_st *task); void gearman_task_free_result(gearman_task_st *task); gearmand-1.0.6/libgearman/run.cc0000664000076400007640000002656212107145705017007 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include #include #include gearman_return_t _client_run_task(gearman_task_st *task) { // This should not be possible assert_msg(task->client, "Programmer error, somehow an invalid task was specified"); if (task->client == NULL) { return gearman_universal_set_error(task->client->universal, GEARMAN_INVALID_ARGUMENT, GEARMAN_AT, "Programmer error, somehow an invalid task was specified"); } switch(task->state) { case GEARMAN_TASK_STATE_NEW: if (task->client->universal.con_list == NULL) { task->client->new_tasks--; task->client->running_tasks--; return gearman_universal_set_error(task->client->universal, GEARMAN_NO_SERVERS, GEARMAN_AT, "no servers added"); } 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 (task->con == NULL) { task->client->options.no_new= true; return gearman_gerror(task->client->universal, GEARMAN_IO_WAIT); } task->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_packet(task->send, task->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; task->client->new_tasks++; } else { task->state= GEARMAN_TASK_STATE_FAIL; task->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(task->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; } } task->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 or task->recv->command == GEARMAN_COMMAND_STATUS_RES_UNIQUE or task->recv->command == GEARMAN_COMMAND_STATUS_RES) { uint8_t x; if (task->recv->command == GEARMAN_COMMAND_STATUS_RES) { task->result_rc= GEARMAN_SUCCESS; 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 if (task->recv->command == GEARMAN_COMMAND_STATUS_RES_UNIQUE) { task->result_rc= GEARMAN_SUCCESS; strncpy(task->unique, task->recv->arg[0], GEARMAN_MAX_UNIQUE_SIZE); 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]))); // denomitor { 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)); } // client_count if (task->recv->command == GEARMAN_COMMAND_STATUS_RES_UNIQUE) { char status_buffer[11]; /* Max string size to hold a uint32_t. */ snprintf(status_buffer, 11, "%.*s", int(task->recv->arg_size[x +2]), static_cast(task->recv->arg[x +2])); task->client_count= 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; } if (task->send.command == GEARMAN_COMMAND_GET_STATUS_UNIQUE) { 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; } task->client->running_tasks--; task->state= GEARMAN_TASK_STATE_FINISHED; if (task->client->options.free_tasks and task->type == GEARMAN_TASK_KIND_ADD_TASK) { gearman_task_free(task); } return GEARMAN_SUCCESS; } gearmand-1.0.6/libgearman/byteorder.cc0000664000076400007640000000453212107145705020173 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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); } gearmand-1.0.6/libgearman/actions.cc0000664000076400007640000001426712141161434017635 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include "libgearman/assert.hpp" #include "libgearman/vector.h" #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 (gearman_task_result(task)) { gearman_task_result(task)->clear(); } else { task->result_ptr= new (std::nothrow) gearman_result_st(gearman_task_data_size(task)); if (task->result_ptr == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } } assert_msg(task->result_ptr, "programmer error, result_ptr has not been allocated for task"); gearman_string_append(gearman_task_mutable_result(task)->mutable_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_UNIQUE 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 (gearman_task_result(task) == NULL) { task->result_ptr= new (std::nothrow) gearman_result_st(gearman_task_data_size(task)); if (task->result_ptr == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } } assert(gearman_task_mutable_result(task)); gearman_task_mutable_result(task)->mutable_string()->append(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 (gearman_task_result(task) == NULL) { task->result_ptr= new (std::nothrow) gearman_result_st(gearman_task_data_size(task)); if (task->result_ptr == NULL) { return GEARMAN_MEMORY_ALLOCATION_FAILURE; } } gearman_string_append(gearman_task_mutable_result(task)->mutable_string(), static_cast(gearman_task_data(task)), gearman_task_data_size(task)); } task->result_rc= GEARMAN_SUCCESS; return GEARMAN_SUCCESS; } const gearman_actions_t &gearman_actions_default(void) { static gearman_actions_t default_actions= { 0, 0, 0, 0, 0, 0, 0, 0 }; return default_actions; } const 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; } const 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; } const 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; } gearmand-1.0.6/libgearman/worker.hpp0000664000076400007640000000510612120660672017705 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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. * */ /* @note This header is internal, and should not be used by external programs. */ #pragma once #include namespace org { namespace gearmand { namespace libgearman { class Worker { public: Worker() { _worker= gearman_worker_create(NULL); if (_worker == NULL) { throw std::runtime_error("gearman_worker_create() failed"); } } Worker(in_port_t arg) { _worker= gearman_worker_create(NULL); if (_worker == NULL) { throw std::runtime_error("gearman_worker_create() failed"); } gearman_worker_add_server(_worker, "localhost", arg); } gearman_worker_st* operator&() const { return _worker; } gearman_worker_st* operator->() const { return _worker; } ~Worker() { gearman_worker_free(_worker); } private: gearman_worker_st *_worker; }; } /* namespace libgearman */ } /* namespace gearmand */ } /* namespace org */ gearmand-1.0.6/libgearman/log.hpp0000664000076400007640000000521012127430346017151 0ustar00brianbrian00000000000000/* 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 Local Gearman Declarations */ #pragma once #include #include /** @addtogroup gearman_local Local Gearman Declarations @ingroup * gearman_universal @{ */ /** * 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. */ void gearman_log(gearman_universal_st& gearman, gearman_verbose_t verbose, const char *format, va_list args); /** * Log an info message, see gearman_log() for argument details. */ void gearman_log_info(gearman_universal_st& gearman, const char *format, ...); /** * Log a debug message, see gearman_log() for argument details. */ void gearman_log_debug(gearman_universal_st& gearman, const char *format, ...); gearmand-1.0.6/libgearman/include.am0000664000076400007640000001222012141160354017613 0ustar00brianbrian00000000000000# vim:ft=automake # Gearman server and library # Copyright (C) 2011 - 2013 Data Differential, http://datadifferential.com/ # Copyright (C) 2009-2010 Brian Aker, Eric Day, Monty Taylor All rights # 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. # # Included from Top Level Makefile.am # All paths should be given relative to the root nobase_include_HEADERS+= libgearman/gearman.h noinst_HEADERS+= libgearman/client.hpp noinst_HEADERS+= libgearman/worker.hpp noinst_HEADERS+= libgearman/client.h noinst_HEADERS+= libgearman/job.h noinst_HEADERS+= libgearman/pipe.h noinst_HEADERS+= libgearman/uuid.hpp noinst_HEADERS+= libgearman/vector.h noinst_HEADERS+= \ libgearman/actions.hpp \ libgearman/add.hpp \ libgearman/aggregator.hpp \ libgearman/allocator.hpp \ libgearman/assert.hpp \ libgearman/backtrace.hpp \ libgearman/byteorder.h \ libgearman/command.h \ 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.hpp \ libgearman/packet.hpp \ libgearman/protocol/submit.h \ libgearman/result.hpp \ libgearman/run.hpp \ libgearman/status.hpp \ libgearman/strcommand.h \ libgearman/string.hpp \ libgearman/task.hpp \ libgearman/task_attr.h \ libgearman/unique.hpp \ libgearman/server_options.hpp \ libgearman/universal.hpp \ libgearman/vector.hpp noinst_LTLIBRARIES+= libgearman/libgearmancore.la libgearman_libgearmancore_la_SOURCES= \ libgearman/allocator.cc \ libgearman/backtrace.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/server_options.cc \ libgearman/universal.cc \ libgearman/vector.cc libgearman_libgearmancore_la_CXXFLAGS= -DBUILDING_LIBGEARMAN libgearman_libgearmancore_la_LIBADD= @DL_LIB@ libgearman_libgearmancore_la_LIBADD+= libhashkit/libhashkit.la noinst_LTLIBRARIES+= libgearman/libgearman-vector.la libgearman_libgearman_vector_la_CXXFLAGS= -DBUILDING_LIBGEARMAN libgearman_libgearman_vector_la_LIBADD= @DL_LIB@ libgearman_libgearman_vector_la_SOURCES= libgearman/vector.cc libgearman_libgearman_vector_la_SOURCES+= libgearman/backtrace.cc noinst_LTLIBRARIES+= libgearman/libgearman-result.la libgearman_libgearman_result_la_CXXFLAGS= -DBUILDING_LIBGEARMAN libgearman_libgearman_result_la_LIBADD= @DL_LIB@ libgearman_libgearman_result_la_SOURCES= libgearman/vector.cc libgearman_libgearman_result_la_SOURCES+= libgearman/result.cc libgearman_libgearman_result_la_SOURCES+= libgearman/backtrace.cc libgearman_libgearman_la_LIBADD= libgearman_libgearman_la_SOURCES= libgearman_libgearman_la_CXXFLAGS= libgearman_libgearman_la_LDFLAGS= lib_LTLIBRARIES+= libgearman/libgearman.la libgearman_libgearman_la_SOURCES+= \ libgearman/actions.cc \ libgearman/aggregator.cc \ libgearman/allocator.cc \ libgearman/argument.cc \ libgearman/add.cc \ libgearman/backtrace.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/kill.cc \ libgearman/log.cc \ libgearman/packet.cc \ libgearman/parse.cc \ libgearman/protocol/submit.cc \ libgearman/result.cc \ libgearman/run.cc \ libgearman/status.cc \ libgearman/strcommand.cc \ libgearman/strerror.cc \ libgearman/string.cc \ libgearman/task.cc \ libgearman/task_attr.cc \ libgearman/unique.cc \ libgearman/server_options.cc \ libgearman/universal.cc \ libgearman/vector.cc \ libgearman/worker.cc libgearman_libgearman_la_SOURCES+= libgearman/pipe.cc libgearman_libgearman_la_SOURCES+= libgearman/uuid.cc libgearman_libgearman_la_CXXFLAGS+= -DBUILDING_LIBGEARMAN libgearman_libgearman_la_LDFLAGS+= -version-info $(GEARMAN_LIBRARY_VERSION) libgearman_libgearman_la_LIBADD+= @LIBUUID_LIB@ libgearman_libgearman_la_LIBADD+= @DL_LIB@ libgearman_libgearman_la_LIBADD+= libhashkit/libhashkit.la if TARGET_LINUX libgearman_libgearman_la_LIBADD+= @LIBM@ endif DISTCLEANFILES+= config/top.h # Hostile version noinst_LTLIBRARIES+= libgearman/libgearman-hostile.la libgearman_libgearman_hostile_la_LIBADD= $(libgearman_libgearman_la_LIBADD) libgearman_libgearman_hostile_la_SOURCES= $(libgearman_libgearman_la_SOURCES) libgearman_libgearman_hostile_la_CXXFLAGS= $(libgearman_libgearman_la_CXXFLAGS) gearmand-1.0.6/libgearman/command.h0000664000076400007640000000410112136050451017437 0ustar00brianbrian00000000000000/* 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_command_info_st { const char *name; const gearman_command_t code; const uint8_t argc; // Number of arguments to commands. const bool data; }; #ifdef __cplusplus extern "C" { #endif struct gearman_command_info_st *gearman_command_info(gearman_command_t command); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman/client.cc0000664000076400007640000014151312134636337017461 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include #include #include "libgearman/assert.hpp" #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) { if (client) { client->options.allocated= false; } else { client= new (std::nothrow) gearman_client_st; if (client == NULL) { 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->options.generate_unique= true; 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 (is_clone == false) { gearman_universal_initialize(client->universal); } return client; } /** * Callback function used when parsing server lists. */ 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); } /** * 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_str, size_t workload_size, size_t *result_size, gearman_return_t *ret_ptr) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } universal_reset_error(client->universal); size_t unused_size; if (result_size == NULL) { result_size= &unused_size; } *result_size= 0; 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_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 (do_task_ptr == NULL) { *ret_ptr= gearman_universal_error_code(client->universal); return NULL; } do_task_ptr->type= GEARMAN_TASK_KIND_DO; gearman_return_t ret= gearman_client_run_block_tasks(client, do_task_ptr); // 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 (gearman_task_result(do_task_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 (returnable == NULL) { 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; } /* 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) { if (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } universal_reset_error(client->universal); if (gearman_size(function) == 0) { return gearman_error(client->universal, GEARMAN_INVALID_ARGUMENT, "function argument 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= gearman_client_run_block_tasks(client, do_task_ptr); 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; } /* * 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 (from == NULL) { 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.unbuffered_result= from->options.unbuffered_result; client->options.no_new= from->options.no_new; client->options.free_tasks= from->options.free_tasks; client->options.generate_unique= from->options.generate_unique; 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 (client) { 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 (client) { return gearman_universal_error(client->universal); } return NULL; } gearman_return_t gearman_client_error_code(const gearman_client_st *client) { if (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } return gearman_universal_error_code(client->universal); } int gearman_client_errno(const gearman_client_st *client) { if (client == NULL) { return EINVAL; } return gearman_universal_errno(client->universal); } gearman_client_options_t gearman_client_options(const gearman_client_st *client) { if (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); if (client->options.generate_unique) options|= int(GEARMAN_CLIENT_GENERATE_UNIQUE); return gearman_client_options_t(options); } return gearman_client_options_t(GEARMAN_WORKER_MAX); } bool gearman_client_has_option(gearman_client_st *client, gearman_client_options_t option) { if (client) { 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; case GEARMAN_CLIENT_GENERATE_UNIQUE: return client->options.generate_unique; default: case GEARMAN_CLIENT_TASK_IN_USE: case GEARMAN_CLIENT_MAX: break; // Let these fall through to false } } return false; } void gearman_client_set_options(gearman_client_st *client, gearman_client_options_t options) { if (client) { gearman_client_options_t usable_options[]= { GEARMAN_CLIENT_NON_BLOCKING, GEARMAN_CLIENT_UNBUFFERED_RESULT, GEARMAN_CLIENT_FREE_TASKS, GEARMAN_CLIENT_GENERATE_UNIQUE, GEARMAN_CLIENT_MAX }; for (gearman_client_options_t* 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 (client) { 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; } if (options & GEARMAN_CLIENT_GENERATE_UNIQUE) { client->options.generate_unique= true; } } } void gearman_client_remove_options(gearman_client_st *client, gearman_client_options_t options) { if (client) { 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; } if (options & GEARMAN_CLIENT_GENERATE_UNIQUE) { client->options.generate_unique= false; } } } int gearman_client_timeout(gearman_client_st *client) { if (client) { return gearman_universal_timeout(client->universal); } return -1; } void gearman_client_set_timeout(gearman_client_st *client, int timeout) { if (client) { gearman_universal_set_timeout(client->universal, timeout); } } void *gearman_client_context(const gearman_client_st *client) { if (client) { return const_cast(client->context); } return NULL; } void gearman_client_set_context(gearman_client_st *client, void *context) { if (client) { client->context= context; } } void gearman_client_set_log_fn(gearman_client_st *client, gearman_log_fn *function, void *context, gearman_verbose_t verbose) { if (client) { 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 (client) { 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 (client) { 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 (client) { if (gearman_connection_create_args(client->universal, host, port) == false) { assert(client->universal.error.rc != GEARMAN_SUCCESS); return gearman_universal_error_code(client->universal); } return GEARMAN_SUCCESS; } return GEARMAN_INVALID_ARGUMENT; } 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 (client) { gearman_free_all_cons(client->universal); } } gearman_return_t gearman_client_wait(gearman_client_st *client) { if (client) { return gearman_wait(client->universal); } return GEARMAN_INVALID_ARGUMENT; } 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 (client == NULL) { 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 (self) { return self->_do_handle; } errno= EINVAL; return NULL; } 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_status_t gearman_client_unique_status(gearman_client_st *client, const char *unique, size_t unique_length) { (void)unique_length; gearman_status_t status; gearman_init(status); if (client == NULL) { gearman_status_set_return(status, GEARMAN_INVALID_ARGUMENT); return status; } universal_reset_error(client->universal); gearman_return_t ret; gearman_task_st do_task; gearman_task_st *do_task_ptr= gearman_client_add_task_status_by_unique(client, &do_task, unique, &ret); if (gearman_failed(ret)) { gearman_status_set_return(status, ret); return status; } assert(do_task_ptr); do_task_ptr->type= GEARMAN_TASK_KIND_DO; gearman_task_clear_fn(do_task_ptr); ret= gearman_client_run_block_tasks(client, do_task_ptr); // @note we don't know if our task was run or not, we just know something // happened. if (gearman_success(ret)) { gearman_status_set(status, do_task.options.is_known, do_task.options.is_running, do_task.numerator, do_task.denominator, do_task.client_count); if (gearman_status_is_known(status) == false and gearman_status_is_running(status) == false) { if (do_task.options.is_running) { ret= GEARMAN_IN_PROGRESS; } else if (do_task.options.is_known) { ret= GEARMAN_JOB_EXISTS; } } } gearman_task_free(do_task_ptr); gearman_status_set_return(status, ret); return status; } 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 (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } universal_reset_error(client->universal); 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); ret= gearman_client_run_block_tasks(client, do_task_ptr); // @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 (is_known == false and is_running == false) { 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 (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } return gearman_echo(client->universal, workload, workload_size); } void gearman_client_task_free_all(gearman_client_st *client) { if (client and client->task_list) { 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 (client) { 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 (client == NULL) { 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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } return add_task_ptr(*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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } return add_task_ptr(*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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } return add_task_ptr(*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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } return add_task_ptr(*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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } return add_task_ptr(*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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } return add_task_ptr(*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 (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } if ((task= gearman_task_internal_create(client, 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); 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; } gearman_task_st *gearman_client_add_task_status_by_unique(gearman_client_st *client, gearman_task_st *task_ptr, const char *unique_handle, gearman_return_t *ret_ptr) { const void *args[1]; size_t args_size[1]; gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } if (unique_handle == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } size_t unique_length= strlen(unique_handle); if (unique_length > GEARMAN_MAX_UNIQUE_SIZE) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return NULL; } gearman_task_st *task; if ((task= gearman_task_internal_create(client, task_ptr)) == NULL) { *ret_ptr= GEARMAN_MEMORY_ALLOCATION_FAILURE; return NULL; } task->unique_length= unique_length; memcpy(task->unique, unique_handle, unique_length); task->unique[task->unique_length]= 0; args[0]= task->unique; args_size[0]= task->unique_length; gearman_return_t rc= gearman_packet_create_args(client->universal, task->send, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_GET_STATUS_UNIQUE, 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 (client) { client->actions.workload_fn= function; } } void gearman_client_set_created_fn(gearman_client_st *client, gearman_created_fn *function) { if (client) { client->actions.created_fn= function; } } void gearman_client_set_data_fn(gearman_client_st *client, gearman_data_fn *function) { if (client) { client->actions.data_fn= function; } } void gearman_client_set_warning_fn(gearman_client_st *client, gearman_warning_fn *function) { if (client) { client->actions.warning_fn= function; } } void gearman_client_set_status_fn(gearman_client_st *client, gearman_universal_status_fn *function) { if (client) { client->actions.status_fn= function; } } void gearman_client_set_complete_fn(gearman_client_st *client, gearman_complete_fn *function) { if (client) { client->actions.complete_fn= function; } } void gearman_client_set_exception_fn(gearman_client_st *client, gearman_exception_fn *function) { if (client) { client->actions.exception_fn= function; } } void gearman_client_set_fail_fn(gearman_client_st *client, gearman_fail_fn *function) { if (client) { client->actions.fail_fn= function; } } void gearman_client_clear_fn(gearman_client_st *client) { if (client) { client->actions= gearman_actions_default(); } } static inline gearman_return_t _client_run_tasks(gearman_client_st *client, gearman_task_st* exit_task) { 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: if (client->task == NULL) { client->state= GEARMAN_CLIENT_STATE_IDLE; break; } assert_msg(client == client->task->client, "Programmer error, client and task member client are not the same"); gearman_return_t local_ret= _client_run_task(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_flush_all(client->universal); } } /* 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: if (client->task == NULL) { client->state= GEARMAN_CLIENT_STATE_IDLE; break; } assert_msg(client == client->task->client, "Programmer error, client and task member client are not the same"); gearman_return_t local_ret= _client_run_task(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; } } /* Connection errors are fatal. */ if (client->con->revents & (POLLERR | POLLHUP | POLLNVAL)) { gearman_error(client->universal, GEARMAN_LOST_CONNECTION, "detected lost connection in _client_run_tasks()"); client->con->close_socket(); client->state= GEARMAN_CLIENT_STATE_IDLE; return GEARMAN_LOST_CONNECTION; } } if ((client->con->revents & POLLIN) == 0) { 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, GEARMAN_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; } gearman_log_debug(client->universal, "Got %s", gearman_strcommand(client->con->_packet.command)); 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, GEARMAN_AT, "%s:%.*s", static_cast(client->con->_packet.arg[0]), int(client->con->_packet.arg_size[1]), static_cast(client->con->_packet.arg[1])); /* Packet cleanup copied from "Clean up the packet" below, and must remain in sync with its reference. */ gearman_packet_free(&(client->con->_packet)); client->con->options.packet_in_use= false; /* This step copied from _client_run_tasks() above: */ /* Increment this value because new job created then failed. */ client->con->created_id++; return GEARMAN_SERVER_ERROR; } else if (client->con->_packet.command == GEARMAN_COMMAND_STATUS_RES_UNIQUE and (strncmp(gearman_task_unique(client->task), static_cast(client->con->_packet.arg[0]), client->con->_packet.arg_size[0]) == 0)) { } 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 (client->task == NULL) { /* The client has stopped waiting for the response, ignore it. */ client->con->free_private_packet(); continue; } client->task->recv= &(client->con->_packet); } case GEARMAN_CLIENT_STATE_PACKET: /* Let task process job created or result packet. */ assert_msg(client == client->task->client, "Programmer error, client and task member client are not the same"); gearman_return_t local_ret= _client_run_task(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. */ client->con->free_private_packet(); /* If exit task is set and matched, exit */ if (exit_task) { if (exit_task->result_rc != GEARMAN_UNKNOWN_STATE) { client->state= GEARMAN_CLIENT_STATE_IDLE; return GEARMAN_SUCCESS; } } /* If all tasks are done, return. */ if (client->running_tasks == 0) { client->state= GEARMAN_CLIENT_STATE_IDLE; return GEARMAN_SUCCESS; } } } /* If all tasks are done, return. */ if (client->running_tasks == 0) { break; } if (client->new_tasks > 0 and ! (client->options.no_new)) { continue; } if (client->options.non_blocking) { /* Let the caller wait for activity. */ client->state= GEARMAN_CLIENT_STATE_IDLE; return gearman_gerror(client->universal, 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 (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } if (client->task_list == NULL) // We are immediatly successful if all tasks are completed { return GEARMAN_SUCCESS; } gearman_return_t rc; { PUSH_NON_BLOCKING(client->universal); rc= _client_run_tasks(client, NULL); } if (rc == GEARMAN_COULD_NOT_CONNECT) { gearman_reset(client->universal); } return rc; } gearman_return_t gearman_client_run_block_tasks(gearman_client_st *client, gearman_task_st* exit_task) { if (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } if (client->task_list == NULL) // We are immediatly successful if all tasks are completed { return GEARMAN_SUCCESS; } gearman_return_t rc; { PUSH_BLOCKING(client->universal); rc= _client_run_tasks(client, exit_task); } if (gearman_failed(rc)) { if (rc == GEARMAN_COULD_NOT_CONNECT) { gearman_reset(client->universal); } if (gearman_universal_error_code(client->universal) != rc and rc != GEARMAN_COULD_NOT_CONNECT) { assert(gearman_universal_error_code(client->universal) == rc); } } return rc; } /* * Static Definitions */ bool gearman_client_compare(const gearman_client_st *first, const gearman_client_st *second) { if (first == NULL or second == NULL) { 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 (self) { gearman_string_t option= { option_arg, option_arg_size }; return gearman_request_option(self->universal, option); } return false; } void gearman_client_set_namespace(gearman_client_st *self, const char *namespace_key, size_t namespace_key_size) { if (self) { gearman_universal_set_namespace(self->universal, namespace_key, namespace_key_size); } } gearman_return_t gearman_client_set_identifier(gearman_client_st *client, const char *id, size_t id_size) { if (client) { return gearman_set_identifier(client->universal, id, id_size); } return GEARMAN_INVALID_ARGUMENT; } const char *gearman_client_namespace(gearman_client_st *self) { return gearman_univeral_namespace(self->universal); } gearmand-1.0.6/libgearman/allocator.hpp0000664000076400007640000000652212107145705020357 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearman library * * Copyright (C) 2011-2013 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 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__) 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__) 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__) 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_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_allocator_t gearman_default_allocator(); gearmand-1.0.6/libgearman/result.hpp0000664000076400007640000000751512141156570017720 0ustar00brianbrian00000000000000 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "libgearman/assert.hpp" #include "libgearman/vector.hpp" #include "libgearman-1.0/return.h" #include #include #include enum gearman_result_t { GEARMAN_RESULT_BINARY, GEARMAN_RESULT_BOOLEAN, GEARMAN_RESULT_INTEGER, GEARMAN_RESULT_NULL }; struct gearman_result_st { enum gearman_result_t _type; struct Value { bool _boolean; int64_t _integer; gearman_vector_st string; Value() : _boolean(false), _integer(0), string() { } Value(size_t initial_size) : _boolean(false), _integer(0), string(initial_size) { } } value; gearman_result_st(); explicit gearman_result_st(size_t); bool is_null() const { return _type == GEARMAN_RESULT_NULL; } void clear() { value.string.clear(); value._integer= 0; value._boolean= false; _type= GEARMAN_RESULT_NULL; } bool store(const gearman_string_t&); bool store(const char*, const size_t); bool store(int64_t); bool append(const char*, const size_t); size_t size() const; size_t capacity() const { return value.string.capacity(); } bool resize(size_t arg_) { return value.string.resize(arg_); } bool reserve(size_t arg_) { return value.string.reserve(arg_); } gearman_vector_st *mutable_string() { value._integer= 0; value._boolean= false; _type= GEARMAN_RESULT_BINARY; return &value.string; } const gearman_vector_st *string() const { if (_type == GEARMAN_RESULT_BINARY) { return &value.string; } return NULL; } bool boolean(bool arg_) { if (_type != GEARMAN_RESULT_BOOLEAN) { clear(); _type= GEARMAN_RESULT_BOOLEAN; } value._boolean= arg_; return true; } bool boolean() const; int64_t integer() const; bool integer(int64_t); gearman_string_t take(); bool is_type(gearman_result_t arg) { return _type == arg; } ~gearman_result_st() { } private: gearman_result_st( const gearman_result_st& ); const gearman_result_st& operator=( const gearman_result_st& ); }; gearman_string_t gearman_result_take_string(gearman_result_st *self); gearmand-1.0.6/libgearman/protocol/0000775000076400007640000000000012142673674017534 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman/protocol/submit.cc0000664000076400007640000001261312141162020021322 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include #include "libgearman/vector.h" #include #include namespace libgearman { namespace protocol { static inline gearman_return_t __submit(gearman_task_st& task, const gearman_command_t command, const gearman_string_t &function, const gearman_string_t &workload) { const void *args[3]; size_t args_size[3]; /** @todo fix it so that NULL is done by default by the API not by happenstance. */ char function_buffer[1024]; if (task.client->universal._namespace) { char *ptr= function_buffer; memcpy(ptr, gearman_string_value(task.client->universal._namespace), gearman_string_length(task.client->universal._namespace)); ptr+= gearman_string_length(task.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; } args[1]= task.unique; args_size[1]= task.unique_length +1; args[2]= gearman_c_str(workload); args_size[2]= gearman_size(workload); return gearman_packet_create_args(task.client->universal, task.send, GEARMAN_MAGIC_REQUEST, command, args, args_size, 3); } gearman_return_t submit(gearman_task_st& task, const gearman_command_t command, const gearman_string_t &function, const gearman_string_t &workload) { return __submit(task, command, function, workload); } gearman_return_t submit_background(gearman_task_st& task, const gearman_command_t command, const gearman_string_t &function, const gearman_string_t &workload) { return __submit(task, command, function, workload); } gearman_return_t submit_epoch(gearman_task_st& task, const gearman_string_t &function, const gearman_string_t &workload, time_t when) { const void *args[4]; size_t args_size[4]; /** @todo fix it so that NULL is done by default by the API not by happenstance. */ char function_buffer[1024]; if (task.client->universal._namespace) { char *ptr= function_buffer; memcpy(ptr, gearman_string_value(task.client->universal._namespace), gearman_string_length(task.client->universal._namespace)); ptr+= gearman_string_length(task.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; } args[1]= task.unique; args_size[1]= task.unique_length +1; char time_string[30]; int length= snprintf(time_string, sizeof(time_string), "%" PRIu64, static_cast(when)); args[2]= time_string; args_size[2]= length +1; args[3]= gearman_c_str(workload); args_size[3]= gearman_size(workload); return gearman_packet_create_args(task.client->universal, task.send, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_SUBMIT_JOB_EPOCH, args, args_size, 4); } } // namespace protocol } // namespace libgearman gearmand-1.0.6/libgearman/protocol/submit.h0000664000076400007640000000471512107145705021205 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 libgearman { namespace protocol { gearman_return_t submit(gearman_task_st&, const gearman_command_t command, const gearman_string_t &function, const gearman_string_t &workload); gearman_return_t submit_background(gearman_task_st&, const gearman_command_t command, const gearman_string_t &function, const gearman_string_t &workload); gearman_return_t submit_epoch(gearman_task_st&, const gearman_string_t &function, const gearman_string_t &workload, time_t when); } // namespace protocol } // namespace libgearman gearmand-1.0.6/libgearman/gearman.h0000664000076400007640000000336412107145705017452 0ustar00brianbrian00000000000000/* 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 gearmand-1.0.6/libgearman/uuid.cc0000664000076400007640000000453712107145705017147 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include "libgearman/common.h" #include "libgearman/uuid.hpp" #if defined(HAVE_UUID_UUID_H) && HAVE_UUID_UUID_H # include int safe_uuid_generate(char* buffer, size_t& length) { uuid_t uuid; int ret; #if defined(HAVE_UUID_GENERATE_TIME_SAFE) && HAVE_UUID_GENERATE_TIME_SAFE ret= uuid_generate_time_safe(uuid); #else uuid_generate(uuid); ret= -1; #endif uuid_unparse(uuid, buffer); length= GEARMAN_MAX_UUID_SIZE; buffer[length]= 0; return ret; } #else int safe_uuid_generate(char* buffer, size_t& length) { // Buffer has to be null terminated even if we are not storing anything buffer[0]= 0; length= 0; return -1; } #endif gearmand-1.0.6/libgearman/packet.hpp0000664000076400007640000001007112107145705017640 0ustar00brianbrian00000000000000/* 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_packet_st *gearman_packet_create(gearman_universal_st&, gearman_packet_st *packet); 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_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. */ 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. */ void *gearman_packet_take_data(gearman_packet_st& packet, size_t *data_size); /** * Pack packet into output buffer. */ 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. */ 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_return_t gearman_packet_create_arg(gearman_packet_st& packet, const void *arg, size_t arg_size); /** * Pack header. */ gearman_return_t gearman_packet_pack_header(gearman_packet_st *packet); /** * Unpack header. */ gearman_return_t gearman_packet_unpack_header(gearman_packet_st *packet); gearmand-1.0.6/libgearman/packet.cc0000664000076400007640000003621712107145705017450 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #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, GEARMAN_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 { bool was_args_buffer= false; // If args is args_buffer we don't want to try realloc it if (packet->args == packet->args_buffer) { was_args_buffer= true; packet->args= NULL; } char *new_args= static_cast(realloc(packet->args, packet->args_size + arg_size +1)); if (new_args == NULL) { gearman_perror(*packet->universal, "packet realloc"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } if (was_args_buffer and 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 */ #ifdef GEARMAN_PACKET_TRACE #include pthread_mutex_t mutex= PTHREAD_MUTEX_INITIALIZER; static uint32_t global_packet_id= 0; #endif gearman_packet_st *gearman_packet_create(gearman_universal_st &universal, gearman_packet_st *packet) { if (packet) { packet->options.allocated= false; packet->options.complete= false; packet->options.free_data= false; } else { 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; } 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; #ifdef GEARMAN_PACKET_TRACE pthread_mutex_lock(&mutex); packet->_id= global_packet_id++; pthread_mutex_unlock(&mutex); fprintf(stderr, "%s PACKET %u\n", __func__, packet->_id); custom_backtrace(); #endif // dont_track_packets == false { 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 (gearman_packet_create(universal, &packet) == NULL) { 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"); if (bool(args_count -1 == gearman_command_info(packet.command)->argc) == false) { gearman_packet_free(&packet); return gearman_universal_set_error(universal, GEARMAN_INVALID_ARGUMENT, GEARMAN_AT, "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"); if (bool(args_count == gearman_command_info(packet.command)->argc) == false) { gearman_packet_free(&packet); return gearman_universal_set_error(universal, GEARMAN_INVALID_ARGUMENT, GEARMAN_AT, "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) { #ifdef GEARMAN_PACKET_TRACE fprintf(stderr, "%s PACKET %u\n", __func__, packet->_id); custom_backtrace(); #endif 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 and packet->data) { void* data= (void*)packet->data; gearman_free((*packet->universal), data); packet->data= NULL; packet->options.free_data= false; } // dont_track_packets == false { 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) { ret= GEARMAN_SUCCESS; if (self.args_size == 0) { return 0; } if (self.args_size > data_size) { ret= GEARMAN_FLUSH_DATA; return 0; } memcpy(data, self.args, self.args_size); 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 && ((char *)data)[0] != 0) { /* Try to parse a text-based command. */ char *ptr= (char *)memchr(data, '\n', data_size); if (ptr == NULL) { ret= gearman_gerror(*self.universal, GEARMAN_IO_WAIT); return 0; } self.magic= GEARMAN_MAGIC_TEXT; self.command= GEARMAN_COMMAND_TEXT; used_size= (size_t)(ptr - ((char *)data)) + 1; *ptr= 0; if (used_size > 1 && *(ptr - 1) == '\r') { *(ptr - 1)= 0; } for (arg_size= used_size, ptr= (char *)data; ptr != NULL; data= ptr) { ptr= (char *)memchr(data, ' ', arg_size); if (ptr != NULL) { *ptr= 0; ptr++; while (*ptr == ' ') { ptr++; } arg_size-= (size_t)(ptr - ((char *)data)); } ret= packet_create_arg(&self, data, ptr == NULL ? arg_size : size_t(ptr - ((char *)data))); if (gearman_failed(ret)) { return used_size; } } return used_size; } else if (data_size < GEARMAN_PACKET_HEADER_SIZE) { ret= gearman_gerror(*self.universal, 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) { char *location= (char *)data +used_size; if (self.argc != (gearman_command_info(self.command)->argc - 1) or gearman_command_info(self.command)->data) { void *ptr= memchr(location, 0, data_size - used_size); if (ptr == NULL) { ret= gearman_gerror(*self.universal, GEARMAN_IO_WAIT); return used_size; } arg_size= size_t((char*)ptr -location) +1; ret= packet_create_arg(&self, location, 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) { ret= gearman_gerror(*self.universal, GEARMAN_IO_WAIT); return used_size; } ret= packet_create_arg(&self, location, 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; } gearmand-1.0.6/libgearman/status.cc0000664000076400007640000000634612107145705017524 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include void gearman_init(gearman_status_t& status) { status.version_= GEARMAN_STATUS_V1; status.status_.mesg_.result_rc= GEARMAN_UNKNOWN_STATE; status.status_.mesg_.is_known= false; status.status_.mesg_.is_running= false; status.status_.mesg_.numerator= 0; status.status_.mesg_.denominator= 0; status.status_.mesg_.client_count= 0; } void gearman_status_set_return(gearman_status_t& arg, const gearman_return_t ret) { arg.status_.mesg_.result_rc= ret; } void gearman_status_set(gearman_status_t& arg, const bool is_known, const bool is_running, const uint32_t numerator, const uint32_t denominator, const uint32_t client_count) { arg.status_.mesg_.is_known= is_known; arg.status_.mesg_.is_running= is_running; arg.status_.mesg_.numerator= numerator; arg.status_.mesg_.denominator= denominator; arg.status_.mesg_.client_count= client_count; } gearman_return_t gearman_status_return(const struct gearman_status_t arg) { return arg.status_.mesg_.result_rc; } bool gearman_status_is_known(const struct gearman_status_t arg) { return arg.status_.mesg_.is_known; } bool gearman_status_is_running(const struct gearman_status_t arg) { return arg.status_.mesg_.is_running; } uint32_t gearman_status_numerator(const struct gearman_status_t arg) { return arg.status_.mesg_.numerator; } uint32_t gearman_status_denominator(const struct gearman_status_t arg) { return arg.status_.mesg_.denominator; } gearmand-1.0.6/libgearman/unique.cc0000664000076400007640000000424412107145705017502 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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 *unique_) { if (unique_) { return unique_->size; } return 0; } bool gearman_unique_is_hash(const gearman_unique_t& unique_) { if (gearman_size(unique_) == 1) { if (gearman_c_str(unique_)[0] == '#') { return true; } } return false; } gearmand-1.0.6/libgearman/string.hpp0000664000076400007640000000347612107145705017712 0ustar00brianbrian00000000000000/* 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_c_str_param(X) (X) ? (X) : NULL, (X) ? strlen(X) : 0 #define gearman_array_length(__array) sizeof(__array)/sizeof(&__array) gearmand-1.0.6/libgearman/actions.hpp0000664000076400007640000000371612107145705020041 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 // Local only const gearman_actions_t &gearman_actions_default(); const gearman_actions_t &gearman_actions_do_default(); const gearman_actions_t &gearman_actions_execute_defaults(); GEARMAN_API const gearman_actions_t &gearman_actions_pause(); #endif gearmand-1.0.6/libgearman/parse.cc0000664000076400007640000000543312107145705017307 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include gearman_return_t gearman_parse_servers(const char *servers, gearman_parse_server_fn *function, void *context) { const char *ptr= servers; char host[GEARMAN_NI_MAXHOST]; char port[GEARMAN_NI_MAXSERV]; if (ptr == NULL) { 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; } gearmand-1.0.6/libgearman/universal.cc0000664000076400007640000003762412141162050020202 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include "libgearman/server_options.hpp" #include "libgearman/vector.h" #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.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.server_options_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; self.wakeup_fd[0]= INVALID_SOCKET; self.wakeup_fd[1]= INVALID_SOCKET; } void gearman_nap(int arg) { if (arg < 1) { } else { #ifdef WIN32 sleep(arg/1000000); #else struct timespec global_sleep_value= { 0, static_cast(arg * 1000)}; nanosleep(&global_sleep_value, NULL); #endif } } void gearman_nap(gearman_universal_st &self) { gearman_nap(self.timeout); } void gearman_universal_clone(gearman_universal_st &destination, const gearman_universal_st &source, bool has_wakeup_fd) { int wakeup_fd[2]; if (has_wakeup_fd) { wakeup_fd[0]= destination.wakeup_fd[0]; wakeup_fd[1]= destination.wakeup_fd[1]; } gearman_universal_initialize(destination); if (has_wakeup_fd) { destination.wakeup_fd[0]= wakeup_fd[0]; destination.wakeup_fd[1]= wakeup_fd[1]; } (void)gearman_universal_set_option(destination, GEARMAN_NON_BLOCKING, source.options.non_blocking); destination.timeout= source.timeout; destination._namespace= gearman_string_clone(source._namespace); destination.verbose= source.verbose; destination.log_fn= source.log_fn; destination.log_context= source.log_context; for (gearman_connection_st *con= source.con_list; con; con= con->next) { if (gearman_connection_copy(destination, *con) == NULL) { return; } } assert(destination.con_count == source.con_count); } 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); universal.pfds= NULL; } // clean-up server options while (universal.server_options_list) { delete universal.server_options_list; } } 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: 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_socket(); } } /* * Flush all shouldn't return any error, because there's no way to indicate * which connection experienced an issue. Error detection is better done in gearman_wait() * after flushing all the connections here. */ void gearman_flush_all(gearman_universal_st& universal) { for (gearman_connection_st *con= universal.con_list; con; con= con->next) { if (con->events & POLLOUT) { continue; } con->flush(); } } gearman_return_t gearman_wait(gearman_universal_st& universal) { struct pollfd *pfds; bool have_shutdown_pipe= universal.wakeup_fd[0] == INVALID_SOCKET ? false : true; size_t con_count= universal.con_count +int(have_shutdown_pipe); if (universal.pfds_size < con_count) { pfds= static_cast(realloc(universal.pfds, con_count * sizeof(struct pollfd))); if (pfds == NULL) { gearman_perror(universal, "pollfd realloc"); return GEARMAN_MEMORY_ALLOCATION_FAILURE; } universal.pfds= pfds; universal.pfds_size= int(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"); } // Wakeup handling, we only make use of this if we have active connections size_t pipe_array_iterator= 0; if (have_shutdown_pipe) { pipe_array_iterator= x; pfds[x].fd= universal.wakeup_fd[0]; pfds[x].events= POLLIN; pfds[x].revents= 0; x++; } int ret= 0; while (universal.timeout) { ret= poll(pfds, x, universal.timeout); if (ret == -1) { switch(errno) { case EINTR: continue; case EINVAL: return gearman_perror(universal, "RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid"); default: return gearman_perror(universal, "poll"); } } break; } if (ret == 0) { return gearman_universal_set_error(universal, GEARMAN_TIMEOUT, GEARMAN_AT, "timeout reached, %u servers were poll(), no servers were available, pipe:%s", uint32_t(x), have_shutdown_pipe ? "true" : "false"); } x= 0; for (gearman_connection_st *con= universal.con_list; con; con= con->next) { if (con->events == 0) { continue; } if (pfds[x].revents & (POLLERR | POLLHUP | POLLNVAL)) { int err; socklen_t len= sizeof (err); if (getsockopt(pfds[x].fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0) { con->cached_errno= err; } } con->set_revents(pfds[x].revents); x++; } if (have_shutdown_pipe and pfds[pipe_array_iterator].revents) { char buffer[1]; ssize_t read_length= read(universal.wakeup_fd[0], buffer, sizeof(buffer)); if (read_length > 0) { gearman_return_t local_ret= gearman_kill(gearman_universal_id(universal), GEARMAN_INTERRUPT); if (gearman_failed(local_ret)) { return GEARMAN_SHUTDOWN; } return GEARMAN_SHUTDOWN_GRACEFUL; } if (read_length == 0) { return GEARMAN_SHUTDOWN; } #if 0 perror("shudown read"); #endif // @todo figure out what happens in an error } 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; } gearman_return_t gearman_set_identifier(gearman_universal_st& universal, const char *id, size_t id_size) { if (id == NULL) { return gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "id was NULL"); } if (id_size == 0) { return gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "id_size was 0"); } if (id_size > GEARMAN_MAX_IDENTIFIER) { return gearman_error(universal, GEARMAN_ARGUMENT_TOO_LARGE, "id_size was greater then GEARMAN_MAX_ECHO_SIZE"); } for (size_t x= 0; x < id_size; x++) { if (isgraph(id[x]) == false) { return gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "Invalid character found in identifier"); } } gearman_packet_st packet; gearman_return_t ret= gearman_packet_create_args(universal, packet, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_SET_CLIENT_ID, (const void**)&id, &id_size, 1); if (gearman_success(ret)) { PUSH_BLOCKING(universal); for (gearman_connection_st *con= universal.con_list; con; con= con->next) { gearman_return_t local_ret= con->send_packet(packet, true); if (gearman_failed(local_ret)) { ret= local_ret; } } } gearman_packet_free(&packet); return ret; } EchoCheck::EchoCheck(gearman_universal_st& universal_, const void *workload_, const size_t workload_size_) : _universal(universal_), _workload(workload_), _workload_size(workload_size_) { } gearman_return_t EchoCheck::success(gearman_connection_st* con) { if (con->_packet.command != GEARMAN_COMMAND_ECHO_RES) { return gearman_error(_universal, GEARMAN_INVALID_COMMAND, "Wrong command sent in response to ECHO request"); } if (con->_packet.data_size != _workload_size or memcmp(_workload, con->_packet.data, _workload_size)) { return gearman_error(_universal, GEARMAN_ECHO_DATA_CORRUPTION, "corruption during echo"); } return GEARMAN_SUCCESS; } OptionCheck::OptionCheck(gearman_universal_st& universal_): _universal(universal_) { } gearman_return_t OptionCheck::success(gearman_connection_st* con) { if (con->_packet.command == GEARMAN_COMMAND_ERROR) { return gearman_error(_universal, GEARMAN_INVALID_SERVER_OPTION, "invalid server option"); } return GEARMAN_SUCCESS; } static gearman_return_t connection_loop(gearman_universal_st& universal, const gearman_packet_st& message, Check& check) { gearman_return_t ret= GEARMAN_SUCCESS; for (gearman_connection_st *con= universal.con_list; con; con= con->next) { ret= con->send_packet(message, true); if (gearman_failed(ret)) { #if 0 assert_msg(con->universal.error.rc != GEARMAN_SUCCESS, "Programmer error, error returned but not recorded"); #endif break; } con->options.packet_in_use= true; gearman_packet_st *packet_ptr= con->receiving(con->_packet, ret, true); if (packet_ptr == NULL) { assert(&con->_packet == universal.packet_list); con->options.packet_in_use= false; break; } assert(packet_ptr == &con->_packet); if (gearman_failed(ret)) { #if 0 assert_msg(con->universal.error.rc != GEARMAN_SUCCESS, "Programmer error, error returned but not recorded"); #endif con->free_private_packet(); con->reset_recv_packet(); break; } assert(packet_ptr); if (gearman_failed(ret= check.success(con))) { #if 0 assert_msg(con->universal.error.rc != GEARMAN_SUCCESS, "Programmer error, error returned but not recorded"); #endif con->free_private_packet(); con->reset_recv_packet(); break; } con->reset_recv_packet(); con->free_private_packet(); } return ret; } gearman_return_t gearman_echo(gearman_universal_st& universal, const void *workload, size_t workload_size) { if (workload == NULL) { return gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "workload was NULL"); } if (workload_size == 0) { return gearman_error(universal, GEARMAN_INVALID_ARGUMENT, "workload_size was 0"); } if (workload_size > GEARMAN_MAX_ECHO_SIZE) { return gearman_error(universal, GEARMAN_ARGUMENT_TOO_LARGE, "workload_size was greater then GEARMAN_MAX_ECHO_SIZE"); } gearman_packet_st message; gearman_return_t ret= gearman_packet_create_args(universal, message, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_ECHO_REQ, &workload, &workload_size, 1); if (gearman_success(ret)) { PUSH_BLOCKING(universal); EchoCheck check(universal, workload, workload_size); ret= connection_loop(universal, message, check); } else { gearman_packet_free(&message); gearman_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "gearman_packet_create_args()"); return ret; } gearman_packet_free(&message); return ret; } void gearman_free_all_packets(gearman_universal_st &universal) { while (universal.packet_list) { gearman_packet_free(universal.packet_list); } } gearman_id_t gearman_universal_id(gearman_universal_st &universal) { gearman_id_t handle= { universal.wakeup_fd[0], universal.wakeup_fd[1] }; return handle; } /* * 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); if (namespace_key) { universal._namespace= gearman_string_create(NULL, namespace_key, namespace_key_size); } else { universal._namespace= NULL; } } const char *gearman_univeral_namespace(gearman_universal_st& universal) { return gearman_string_value(universal._namespace); } gearmand-1.0.6/libgearman/do.hpp0000664000076400007640000000420412107145705016774 0ustar00brianbrian00000000000000/* 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); gearmand-1.0.6/libgearman/job.h0000664000076400007640000000553412107145705016613 0ustar00brianbrian00000000000000/* 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 /** Initialize a job 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. * * @param[in] A valid gearman_worker_st. * @param[in] gearman_job_st allocated structure, or NULL to allocate one. * @return On success, a pointer to the (possibly allocated) structure. On * failure this will be NULL. */ gearman_job_st *gearman_job_create(gearman_worker_st *worker, gearman_job_st *job); gearman_return_t gearman_job_send_complete_fin(gearman_job_st *job, const void *result, size_t result_size); gearman_string_t gearman_job_function_name_string(const gearman_job_st *); gearman_string_t gearman_job_reducer_string(const gearman_job_st *job); const char *gearman_job_reducer(const gearman_job_st *job); bool gearman_job_is_map(const gearman_job_st *job); bool gearman_job_build_reducer(gearman_job_st *job, gearman_aggregator_fn *aggregator_fn); gearman_return_t gearman_job_send_fail_fin(gearman_job_st *job); gearmand-1.0.6/libgearman/backtrace.cc0000664000076400007640000000755412107145705020122 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libgearman client library. * * Copyright (C) 2012 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 "gear_config.h" #include "libgearman/backtrace.hpp" #include #include #include #if defined(HAVE_SHARED_ENABLED) && HAVE_SHARED_ENABLED #ifdef HAVE_EXECINFO_H #include #endif #ifdef HAVE_GCC_ABI_DEMANGLE # include # define USE_DEMANGLE 1 #else # define USE_DEMANGLE 0 #endif #ifdef HAVE_DLFCN_H # include #endif const int MAX_DEPTH= 50; void custom_backtrace(void) { #ifdef HAVE_EXECINFO_H void *backtrace_buffer[MAX_DEPTH +1]; int stack_frames= backtrace(backtrace_buffer, MAX_DEPTH); fprintf(stderr, "\nBegin stack trace, frames found: %d\n", stack_frames); if (stack_frames) { char **symbollist= backtrace_symbols(backtrace_buffer, stack_frames); if (symbollist) { for (int x= 0; x < stack_frames; x++) { bool was_demangled= false; if (USE_DEMANGLE) { #ifdef HAVE_DLFCN_H Dl_info dlinfo; if (dladdr(backtrace_buffer[x], &dlinfo)) { char demangled_buffer[1024]; const char *called_in= ""; if (dlinfo.dli_sname) { size_t demangled_size= sizeof(demangled_buffer); int status; char* demangled; if ((demangled= abi::__cxa_demangle(dlinfo.dli_sname, demangled_buffer, &demangled_size, &status))) { called_in= demangled; fprintf(stderr, "---> demangled: %s -> %s\n", demangled_buffer, demangled); } else { called_in= dlinfo.dli_sname; } was_demangled= true; fprintf(stderr, "#%d %p in %s at %s\n", x, backtrace_buffer[x], called_in, dlinfo.dli_fname); } } #endif } if (was_demangled == false) { fprintf(stderr, "?%d %p in %s\n", x, backtrace_buffer[x], symbollist[x]); } } ::free(symbollist); } } #endif // HAVE_EXECINFO_H } #else // HAVE_SHARED_ENABLED void custom_backtrace(void) { fprintf(stderr, "Backtrace null function called\n"); } #endif // AX_ENABLE_BACKTRACE gearmand-1.0.6/libgearman/allocator.cc0000664000076400007640000001171612107145705020156 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include "util/memory.h" using namespace org::tangent; 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 (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 (ptr == NULL) { return; } if (allocator.free) { allocator.free(ptr, allocator.context); } else { util::free__(ptr); } ptr= NULL; } 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; } gearmand-1.0.6/libgearman/strcommand.cc0000664000076400007640000001225312107145705020342 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include "libgearman/assert.hpp" #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"; case GEARMAN_COMMAND_MAX: return "GEARMAN_COMMAND_MAX"; case GEARMAN_COMMAND_GET_STATUS_UNIQUE: return "GEARMAN_COMMAND_GET_STATUS_UNIQUE"; case GEARMAN_COMMAND_STATUS_RES_UNIQUE: return "GEARMAN_COMMAND_STATUS_RES_UNIQUE"; } assert(0); // We should never reach this abort(); } gearmand-1.0.6/libgearman/vector.cc0000664000076400007640000002544112141162110017463 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand String * * Copyright (C) 2011-2013 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 "gear_config.h" #include "libgearman/assert.hpp" #include "libgearman/is.hpp" #include "libgearman/vector.hpp" #include "libgearman/vector.h" #include #include #include #include #include "util/memory.h" using namespace org::tangent; #ifndef __INTEL_COMPILER # pragma GCC diagnostic ignored "-Wformat-nonliteral" # pragma GCC diagnostic ignored "-Wformat-security" #endif inline static bool _string_check(gearman_vector_st *string, const size_t need) { assert_msg(string, "Programmer error, _string_check() was passed a null gearman_vector_st"); if (string) { if (need and need > size_t(string->current_size - size_t(string->end - string->string))) { size_t current_offset= size_t(string->end - string->string); /* This is the block multiplier. To keep it larger and surive division errors we must round it up */ size_t adjust= (need - size_t(string->current_size - size_t(string->end - string->string))) / GEARMAN_VECTOR_BLOCK_SIZE; adjust++; size_t new_size= sizeof(char) * size_t((adjust * GEARMAN_VECTOR_BLOCK_SIZE) + string->current_size); /* Test for overflow */ if (new_size < need) { return false; } char* new_value= static_cast(realloc(string->string, new_size)); if (new_value == NULL) { return false; } string->string= new_value; string->end= string->string + current_offset; string->current_size+= (GEARMAN_VECTOR_BLOCK_SIZE * adjust); } return true; } return false; } void gearman_vector_st::init() { current_size= 0; end= string= NULL; } gearman_vector_st *gearman_string_create(gearman_vector_st *self, const char *str, const size_t str_size) { if (str_size and str == NULL) { assert_msg(str, "Programmer error, gearman_string_clear() was passed a null string, but str_size > 0"); return NULL; } if (str == NULL) { return NULL; } self= gearman_string_create(self, str_size); assert_vmsg(self, "Programmer error, gearman_string_create() returned a null gearman_vector_st() requesting a reserve of %u", uint32_t(str_size)); if (self) { if ((self->store(str, str_size) == false)) { assert_vmsg(self, "Programmer error, gearman_string_append() returned false while trying to append a string of %u length", uint32_t(str_size)); gearman_string_free(self); return NULL; } } return self; } gearman_vector_st::gearman_vector_st(const size_t reserve_) : end(NULL), string(NULL), current_size(0) { if (reserve_) { _string_check(this, reserve_ +1); } } gearman_vector_st *gearman_string_create(gearman_vector_st *self, const size_t reserve_) { /* Saving malloc calls :) */ if (self == NULL) { self= new (std::nothrow) gearman_vector_st(reserve_); assert_vmsg(self, "Programmer error, new gearman_vector_st() failed reserve: %u", uint32_t(reserve_)); if (self == NULL) { return NULL; } gearman_set_allocated(self, true); } else { self->clear(); self->resize(reserve_); } gearman_set_initialized(self, true); assert_vmsg(reserve_ <= self->capacity(), "Programmer error, capacity: %u reserve: %u", uint32_t(self->capacity()), uint32_t(reserve_)); if (reserve_ > self->capacity()) { gearman_string_free(self); return NULL; } return self; } gearman_vector_st *gearman_string_clone(const gearman_vector_st *self) { gearman_vector_st *clone= NULL; if (self) { clone= gearman_string_create(NULL, gearman_string_length(self)); if (clone) { if (self->size()) { if (clone->store(*self) == false) { gearman_string_free(clone); return NULL; } } } } return clone; } bool gearman_vector_st::append_character(const char character) { if (_string_check(this, 1 +1) == false) // Null terminate { return false; } *end= character; end++; *end= 0; return true; } bool gearman_string_append_character(gearman_vector_st *string_, const char character) { assert_msg(string_, "Programmer error, gearman_string_append_character() was passed a null gearman_vector_st"); if (string_) { return string_->append_character(character); } return false; } bool gearman_string_append(gearman_vector_st *string, const char *value, size_t length) { assert_msg(string, "Programmer error, gearman_string_append() was passed a null gearman_vector_st"); if (string) { string->append(value, length); } return false; } char *gearman_string_c_copy(gearman_vector_st *string) { char *c_ptr= NULL; if (gearman_string_length(string) == 0) { c_ptr= static_cast(malloc((gearman_string_length(string) +1) * sizeof(char))); if (c_ptr) { memcpy(c_ptr, gearman_string_value(string), gearman_string_length(string)); c_ptr[gearman_string_length(string)]= 0; } } return c_ptr; } void gearman_string_clear(gearman_vector_st *string) { assert_msg(string, "Programmer error, gearman_string_clear() was passed a null gearman_vector_st"); string->clear(); } bool gearman_vector_st::store(const char* arg_, const size_t arg_length_) { clear(); return append(arg_, arg_length_); } bool gearman_vector_st::store(const gearman_vector_st& vec) { clear(); return append(vec.value(), vec.size()); } bool gearman_vector_st::append(const char* arg_, const size_t arg_length_) { if (_string_check(this, arg_length_ +1) == false) { return false; } memcpy(end, arg_, arg_length_); end+= arg_length_; *end= 0; // Add a NULL return true; } int gearman_vector_st::vec_printf(const char *format__, ...) { clear(); if (format__) { va_list args; va_start(args, format__); int required_size= vec_size_printf(format__, args); va_end(args); va_start(args, format__); int actual_size= vec_ptr_printf(required_size, format__, args); va_end(args); return actual_size; } return -1; } int gearman_vector_st::vec_append_printf(const char *format__, ...) { if (format__) { va_list args; va_start(args, format__); int required_size= vec_size_printf(format__, args); va_end(args); va_start(args, format__); int actual_size= vec_ptr_printf(required_size, format__, args); va_end(args); return actual_size; } return -1; } int gearman_vector_st::vec_size_printf(const char *format__, va_list args__) { int required_size= vsnprintf(NULL, 0, format__, args__); if (required_size) { required_size++; } return required_size; } int gearman_vector_st::vec_ptr_printf(const int required_size, const char *format__, va_list args__) { if (required_size > 0) { int actual_size= 0; if (required_size > 0 and reserve(required_size + size())) { actual_size= vsnprintf(end, capacity() - size(), format__, args__); assert(required_size == actual_size +1); end+= actual_size; } return actual_size; } return -1; } gearman_vector_st::~gearman_vector_st() { if (string) { void* tmp_ptr= string; util::free__(tmp_ptr); } } bool gearman_vector_st::resize(const size_t size_) { if (size_ == 0) { void* tmp_ptr= string; util::free__(tmp_ptr); init(); } else if (size_ > capacity()) { return reserve(size_); } else if (size_ < capacity()) { size_t final_size= (size_ < size()) ? size_ : size(); char* new_value= static_cast(realloc(string, size_ +1)); if (new_value == NULL) { return false; } string= new_value; end= string +final_size; current_size= size_ +1; string[final_size]= 0; } return true; } void gearman_string_free(gearman_vector_st*& string) { if (string) { if (gearman_is_allocated(string)) { delete string; string= NULL; return; } assert(gearman_is_allocated(string) == false); string->resize(0); gearman_set_initialized(string, false); } } bool gearman_string_reserve(gearman_vector_st *string, size_t need_) { if (string) { return string->reserve(need_); } return false; } size_t gearman_vector_st::size() const { assert(end >= string); return size_t(end -string); } gearman_string_t gearman_vector_st::take() { if (size()) { gearman_string_t passable= { string, size() }; init(); return passable; } static gearman_string_t ret= {0, 0}; return ret; } bool gearman_vector_st::reserve(const size_t need_) { if (need_) { return _string_check(this, need_ +1); } // Let _string_check handle the behavior of zero return _string_check(this, need_); } size_t gearman_string_length(const gearman_vector_st *self) { if (self) { return self->size(); } return 0; } const char *gearman_string_value(const gearman_vector_st *self) { if (self) { return self->string; } return NULL; } 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); if (self) { return self->take(); } static gearman_string_t ret= {0, 0}; return ret; } gearmand-1.0.6/libgearman/do.cc0000664000076400007640000001346012107145705016576 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include "libgearman/assert.hpp" #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 }; // Set to zero in case of error size_t unused_result_size; if (result_size == NULL) { result_size= &unused_result_size; } *result_size= 0; gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (client == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; 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 (do_task_ptr == NULL) { *ret_ptr= gearman_universal_error_code(client->universal); return NULL; } gearman_return_t ret= gearman_client_run_block_tasks(client, do_task_ptr); const void *returnable= NULL; // 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 (gearman_task_result(do_task_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) { if (client == NULL) { return GEARMAN_INVALID_ARGUMENT; } 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 (do_task_ptr == NULL) { return gearman_universal_error_code(client->universal); } gearman_task_clear_fn(do_task_ptr); gearman_return_t ret= gearman_client_run_block_tasks(client, do_task_ptr); 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; } gearmand-1.0.6/libgearman/log.cc0000664000076400007640000000534112127430346016754 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include #include #include #include #pragma GCC diagnostic ignored "-Wformat-nonliteral" void gearman_log(gearman_universal_st& state, gearman_verbose_t verbose, const char *format, va_list args) { if (state.log_fn) { char log_buffer[GEARMAN_MAX_ERROR_SIZE]; vsnprintf(log_buffer, GEARMAN_MAX_ERROR_SIZE, format, args); state.log_fn(log_buffer, verbose, state.log_context); } } 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); } } gearmand-1.0.6/libgearman/client.hpp0000664000076400007640000000546012120671131017645 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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. * */ /* @note This header is internal, and should not be used by external programs. */ #pragma once #include #include namespace org { namespace gearmand { namespace libgearman { class Client { public: Client() { _client= gearman_client_create(NULL); if (_client == NULL) { throw std::runtime_error("gearman_client_create() failed"); } } Client(const gearman_client_st* arg) { _client= gearman_client_clone(NULL, arg); if (_client == NULL) { throw std::runtime_error("gearman_client_create() failed"); } } Client(in_port_t arg) { _client= gearman_client_create(NULL); if (_client == NULL) { throw std::runtime_error("gearman_client_create() failed"); } gearman_client_add_server(_client, "localhost", arg); } gearman_client_st* operator&() const { return _client; } gearman_client_st* operator->() const { return _client; } ~Client() { gearman_client_free(_client); } private: gearman_client_st *_client; }; } /* namespace libgearman */ } /* namespace gearmand */ } /* namespace org */ gearmand-1.0.6/libgearman/strcommand.h0000664000076400007640000000335512107145705020207 0ustar00brianbrian00000000000000/* 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 const char *gearman_strcommand(gearman_command_t command); gearmand-1.0.6/libgearman/universal.hpp0000664000076400007640000001450512111007053020373 0ustar00brianbrian00000000000000/* 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_connection_st *gearman_ready(gearman_universal_st&); void gearman_universal_initialize(gearman_universal_st &self, const gearman_universal_options_t *options= NULL); void gearman_universal_clone(gearman_universal_st &destination, const gearman_universal_st &source, bool has_wakeup_fd= false); void gearman_universal_free(gearman_universal_st &gearman); void gearman_free_all_packets(gearman_universal_st &gearman); gearman_return_t gearman_universal_set_option(gearman_universal_st &self, gearman_universal_options_t option, bool value); void gearman_set_log_fn(gearman_universal_st &self, gearman_log_fn *function, void *context, gearman_verbose_t verbose); void gearman_universal_set_timeout(gearman_universal_st &self, int timeout); int gearman_universal_timeout(gearman_universal_st &self); void gearman_universal_set_namespace(gearman_universal_st &self, const char *namespace_key, size_t namespace_key_size); void gearman_reset(gearman_universal_st& universal); // Flush the send buffer for all connections. void 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. */ 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. */ void gearman_set_workload_free_fn(gearman_universal_st&, gearman_free_fn *function, void *context); // Free all connections for a gearman structure. void gearman_free_all_cons(gearman_universal_st&); // Test echo with all connections. gearman_return_t gearman_echo(gearman_universal_st&, const void *workload, size_t workload_size); /** * Wait for I/O on connections. * */ gearman_return_t gearman_wait(gearman_universal_st&); void gearman_nap(gearman_universal_st &self); void gearman_nap(int arg); 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; } gearman_id_t gearman_universal_id(gearman_universal_st &universal); gearman_return_t gearman_set_identifier(gearman_universal_st& universal, const char *id, size_t id_size); const char *gearman_univeral_namespace(gearman_universal_st& universal); #define PUSH(__original, __temp_value) Push _push((__original),(__temp_value)); class Push { public: Push(bool& original_, const bool temp_value) : _saved(original_), _origin(original_) { _origin= temp_value; } ~Push() { _origin= _saved; } private: bool _saved; bool& _origin; }; /** Push the state of IO */ #define PUSH_BLOCKING(__univeral) Push push_blocking_((__univeral).options.non_blocking, false); #define PUSH_NON_BLOCKING(__univeral) Push push_non_blocking_((__univeral).options.non_blocking, true); class Check { public: virtual gearman_return_t success(gearman_connection_st*)= 0; virtual ~Check() {}; }; class EchoCheck : public Check { public: EchoCheck(gearman_universal_st& universal_, const void *workload_, const size_t workload_size_); gearman_return_t success(gearman_connection_st* con); private: gearman_universal_st& _universal; const void *_workload; const size_t _workload_size; }; class OptionCheck : public Check { public: OptionCheck(gearman_universal_st& universal_); gearman_return_t success(gearman_connection_st* con); private: gearman_universal_st& _universal; }; gearmand-1.0.6/libgearman/unique.hpp0000664000076400007640000000365012107145705017704 0ustar00brianbrian00000000000000/* 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; size_t size; }; gearman_unique_t gearman_unique_make(const char *arg, size_t arg_size); size_t gearman_unique_size(gearman_unique_t *self); bool gearman_unique_is_hash(const gearman_unique_t&); gearmand-1.0.6/libgearman/run.hpp0000664000076400007640000000343012107145705017176 0ustar00brianbrian00000000000000/* 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_return_t _client_run_task(gearman_task_st *task); gearmand-1.0.6/libgearman/vector.h0000664000076400007640000000537212141161557017344 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libgearman library * * Copyright (C) 2013 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 #include #include #include #include "libgearman-1.0/string.h" #ifdef __cplusplus extern "C" { #endif struct gearman_vector_st *gearman_string_clone(const struct gearman_vector_st*); bool gearman_string_reserve(struct gearman_vector_st *string, size_t need); char *gearman_string_c_copy(struct gearman_vector_st *string); bool gearman_string_append_character(struct gearman_vector_st *string, const char character); bool gearman_string_append(struct gearman_vector_st *string, const char *value, size_t length); void gearman_string_clear(struct gearman_vector_st *string); void gearman_string_free(struct gearman_vector_st*& string); size_t gearman_string_length(const struct gearman_vector_st *self); const char *gearman_string_value(const struct gearman_vector_st *self); char *gearman_string_value_mutable(const struct gearman_vector_st *self); gearman_string_t gearman_string(const struct gearman_vector_st *self); gearman_string_t gearman_string_take_string(struct gearman_vector_st *self); #ifdef __cplusplus } #endif gearmand-1.0.6/libgearman/server_options.hpp0000664000076400007640000000467212137504240021460 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2013 Data Differential, http://datadifferential.com/ * Copyright (C) 2013 Keyur Govande * 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_universal_st; bool gearman_request_option(gearman_universal_st &universal, gearman_string_t &option); struct gearman_server_options_st { gearman_vector_st _option; gearman_server_options_st *next; gearman_server_options_st *prev; gearman_universal_st &universal; public: gearman_server_options_st(gearman_universal_st &universal_arg, const char* option_arg, const size_t option_arg_size); ~gearman_server_options_st(); gearman_server_options_st(const gearman_server_options_st&); const gearman_vector_st& option() const { return _option; } const char* value() const { return _option.value(); } size_t size() const { return _option.size(); } }; gearmand-1.0.6/libgearman/error.hpp0000664000076400007640000000625712107145705017535 0ustar00brianbrian00000000000000/* 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, __message) gearman_universal_set_perror((__universal), __func__, AT, (__message)) #define gearman_error(__universal, __error_t, __message) gearman_universal_set_error((__universal), (__error_t), __func__, AT, (__message)) #define gearman_gerror(__universal, __gearman_return_t) gearman_universal_set_gerror((__universal), (__gearman_return_t), __func__, AT) gearman_return_t gearman_universal_set_error(gearman_universal_st&, gearman_return_t rc, const char *function, const char *position, const char *format, ...); gearman_return_t gearman_universal_set_perror(gearman_universal_st&, const char *function, const char *position, const char *message); gearman_return_t gearman_universal_set_gerror(gearman_universal_st&, gearman_return_t rc, const char *func, const char *position); void universal_reset_error(gearman_universal_st& universal); void gearman_worker_reset_error(gearman_worker_st *worker); gearmand-1.0.6/libgearman/connection.hpp0000664000076400007640000001257112137501345020536 0ustar00brianbrian00000000000000/* 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 Options { bool server_options_sent; bool ready; bool packet_in_use; Options() : server_options_sent(false), ready(false), packet_in_use(false) { } } 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; private: struct addrinfo *_addrinfo; struct addrinfo *addrinfo_next; public: const char *send_buffer_ptr; char *recv_buffer_ptr; gearman_packet_st _packet; char host[GEARMAN_NI_MAXHOST]; char send_buffer[GEARMAN_SEND_BUFFER_SIZE]; char recv_buffer[GEARMAN_RECV_BUFFER_SIZE]; void free_private_packet(); 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_packet(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_socket(); // 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 receive_data(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(); gearman_return_t lookup(); void free_recv_packet(); gearman_packet_st* recv_packet() { return _recv_packet; } void reset_recv_packet() { _recv_packet= NULL; } gearman_connection_st(const gearman_connection_st&); private: gearman_return_t _send_packet(const gearman_packet_st&, const bool flush_buffer); gearman_return_t set_socket_options(); size_t recv_socket(void *data, size_t data_size, gearman_return_t&); gearman_return_t connect_poll(); gearman_packet_st *_recv_packet; }; /** * Initialize a connection structure. Always check the return value even if * passing in a pre-allocated structure. Some other initialization may have * failed. */ gearman_connection_st *gearman_connection_create(gearman_universal_st &universal, gearman_connection_options_t *options); 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_connection_st *gearman_connection_create_args(gearman_universal_st &universal, const char *host, in_port_t port); gearmand-1.0.6/libgearman/client.h0000664000076400007640000000353112107145705017312 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 gearman_client_run_block_tasks(gearman_client_st *client, gearman_task_st* exit_task); size_t gearman_client_count_tasks(gearman_client_st *client); gearmand-1.0.6/libgearman/pipe.cc0000664000076400007640000001052412107145705017127 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 "gear_config.h" #include "libgearman/pipe.h" #include "libgearman/common.h" #include "libgearman/assert.hpp" #include #include #include #include #include #ifndef FD_CLOEXEC # define FD_CLOEXEC 0 #endif // This is not called if HAVE_PIPE2 is true static inline bool set_cloexec(int pipedes_[2], const size_t x) { if (FD_CLOEXEC) { int flags; do { flags= fcntl(pipedes_[x], F_GETFD, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags != -1) { int retval; do { retval= fcntl (pipedes_[x], F_SETFD, flags | FD_CLOEXEC); } while (retval == -1 && (errno == EINTR or errno == EAGAIN)); if (retval != -1) { return true; } #if 0 perror("fcntl(pipedes_[x], F_GETFD, 0)"); #endif return false; } #if 0 perror("fcntl (pipedes_[x], F_SETFD, FD_CLOEXEC)"); #endif } return false; } // This is not called if HAVE_PIPE2 is true static inline bool set_nonblock(int pipedes_[2], const size_t x) { int flags; do { flags= fcntl(pipedes_[x], F_GETFL, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags != -1) { int retval; do { retval= fcntl(pipedes_[x], F_SETFL, flags | O_NONBLOCK); } while (retval == -1 and (errno == EINTR or errno == EAGAIN)); if (retval != -1) { return true; } #if 0 perror("fcntl(pipedes_[x], F_SETFL, flags | O_NONBLOCK)"); #endif } #if 0 perror("fcntl(pipedes_[x], F_GETFL, 0)"); #endif return false; } bool setup_shutdown_pipe(int pipedes_[2]) { #if defined(HAVE_PIPE2) && HAVE_PIPE2 if (pipe2(pipedes_, O_NONBLOCK|O_CLOEXEC) == -1) { return false; } #else if (pipe(pipedes_) == -1) { return false; } #endif for (size_t x= 0; x < 2; ++x) { bool success= true; #ifdef F_SETNOSIGPIPE if (F_SETNOSIGPIPE) { int fcntl_sig_error; do { fcntl_sig_error= fcntl(pipedes_[x], F_SETNOSIGPIPE, 0); } while (fcntl_sig_error == -1 and (errno == EINTR or errno == EAGAIN)); if (fcntl_sig_error == -1) { #if 0 perror ("fcntl_sig_error= fcntl(pipedes_[x], F_SETNOSIGPIPE, 0)"); #endif success= false; } } #endif // F_SETNOSIGPIPE #if defined(HAVE_PIPE2) if (HAVE_PIPE2) { } else #endif // defined(HAVE_PIPE2) { if ((success= set_cloexec(pipedes_, x))) { success= set_nonblock(pipedes_, x); } } if (success == false) { if (errno != EBADF) { close(pipedes_[0]); close(pipedes_[1]); } return false; } } return true; } gearmand-1.0.6/libgearman/command.cc0000664000076400007640000001150612136050451017604 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include "libgearman/assert.hpp" /** * 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", GEARMAN_COMMAND_TEXT, 5, false }, { "CAN_DO", GEARMAN_COMMAND_CAN_DO, 1, false }, { "CANT_DO", GEARMAN_COMMAND_CANT_DO, 1, false }, { "RESET_ABILITIES", GEARMAN_COMMAND_RESET_ABILITIES, 0, false }, { "PRE_SLEEP", GEARMAN_COMMAND_PRE_SLEEP, 0, false }, { "UNUSED", GEARMAN_COMMAND_UNUSED, 0, false }, { "NOOP", GEARMAN_COMMAND_NOOP, 0, false }, { "SUBMIT_JOB", GEARMAN_COMMAND_SUBMIT_JOB, 2, true }, { "JOB_CREATED", GEARMAN_COMMAND_JOB_CREATED, 1, false }, { "GRAB_JOB", GEARMAN_COMMAND_GRAB_JOB, 0, false }, { "NO_JOB", GEARMAN_COMMAND_NO_JOB, 0, false }, { "JOB_ASSIGN", GEARMAN_COMMAND_JOB_ASSIGN, 2, true }, { "WORK_STATUS", GEARMAN_COMMAND_WORK_STATUS, 3, false }, { "WORK_COMPLETE", GEARMAN_COMMAND_WORK_COMPLETE, 1, true }, { "WORK_FAIL",GEARMAN_COMMAND_WORK_FAIL, 1, false }, { "GET_STATUS",GEARMAN_COMMAND_GET_STATUS, 1, false }, { "ECHO_REQ", GEARMAN_COMMAND_ECHO_REQ, 0, true }, { "ECHO_RES", GEARMAN_COMMAND_ECHO_RES, 0, true }, { "SUBMIT_JOB_BG", GEARMAN_COMMAND_SUBMIT_JOB_BG, 2, true }, { "ERROR", GEARMAN_COMMAND_ERROR, 2, false }, { "STATUS_RES", GEARMAN_COMMAND_STATUS_RES, 5, false }, { "SUBMIT_JOB_HIGH", GEARMAN_COMMAND_SUBMIT_JOB_HIGH, 2, true }, { "SET_CLIENT_ID", GEARMAN_COMMAND_SET_CLIENT_ID, 1, false }, { "CAN_DO_TIMEOUT", GEARMAN_COMMAND_CAN_DO_TIMEOUT, 2, false }, { "ALL_YOURS", GEARMAN_COMMAND_ALL_YOURS, 0, false }, { "WORK_EXCEPTION", GEARMAN_COMMAND_WORK_EXCEPTION, 1, true }, { "OPTION_REQ", GEARMAN_COMMAND_OPTION_REQ, 1, false }, { "OPTION_RES", GEARMAN_COMMAND_OPTION_RES, 1, false }, { "WORK_DATA", GEARMAN_COMMAND_WORK_DATA, 1, true }, { "WORK_WARNING", GEARMAN_COMMAND_WORK_WARNING, 1, true }, { "GRAB_JOB_UNIQ", GEARMAN_COMMAND_GRAB_JOB_UNIQ, 0, false }, { "JOB_ASSIGN_UNIQ", GEARMAN_COMMAND_JOB_ASSIGN_UNIQ, 3, true }, { "SUBMIT_JOB_HIGH_BG", GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG, 2, true }, { "SUBMIT_JOB_LOW", GEARMAN_COMMAND_SUBMIT_JOB_LOW, 2, true }, { "SUBMIT_JOB_LOW_BG", GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG, 2, true }, { "SUBMIT_JOB_SCHED", GEARMAN_COMMAND_SUBMIT_JOB_SCHED, 7, true }, { "SUBMIT_JOB_EPOCH", GEARMAN_COMMAND_SUBMIT_JOB_EPOCH, 3, true }, { "SUBMIT_REDUCE_JOB", GEARMAN_COMMAND_SUBMIT_REDUCE_JOB, 4, true }, { "SUBMIT_REDUCE_JOB_BACKGROUND", GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND, 4, true }, { "GRAB_JOB_ALL", GEARMAN_COMMAND_GRAB_JOB_ALL, 0, false }, { "JOB_ASSIGN_ALL", GEARMAN_COMMAND_JOB_ASSIGN_ALL, 4, true }, { "GET_STATUS_UNIQUE", GEARMAN_COMMAND_GET_STATUS_UNIQUE, 1, false }, { "STATUS_RES_UNIQUE", GEARMAN_COMMAND_STATUS_RES_UNIQUE, 6, false } }; gearman_command_info_st *gearman_command_info(gearman_command_t command) { assert(command >= GEARMAN_COMMAND_TEXT); assert(command < GEARMAN_COMMAND_MAX); return &gearmand_command_info_list[command]; } gearmand-1.0.6/libgearman/worker.cc0000664000076400007640000011305712141153626017507 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include "libgearman/pipe.h" #include "libgearman/assert.hpp" #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 (memcmp(function_name, function->function_name, function_length) == 0) { 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 (worker == NULL) { 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 *source) { if (source == NULL) { return _worker_allocate(worker, false); } worker= _worker_allocate(worker, true); if (worker == NULL) { return worker; } worker->options.non_blocking= source->options.non_blocking; worker->options.change= source->options.change; worker->options.grab_uniq= source->options.grab_uniq; worker->options.grab_all= source->options.grab_all; worker->options.timeout_return= source->options.timeout_return; gearman_universal_clone(worker->universal, source->universal, true); if (gearman_failed(_worker_packet_init(worker))) { gearman_worker_free(worker); return NULL; } return worker; } void gearman_worker_free(gearman_worker_st *worker) { if (worker == NULL) { return; } if (worker->universal.wakeup_fd[0] != INVALID_SOCKET) { close(worker->universal.wakeup_fd[0]); } if (worker->universal.wakeup_fd[1] != INVALID_SOCKET) { close(worker->universal.wakeup_fd[1]); } 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 (worker == NULL) { return NULL; } return gearman_universal_error(worker->universal); } int gearman_worker_errno(gearman_worker_st *worker) { if (worker == NULL) { return EINVAL; } return gearman_universal_errno(worker->universal); } gearman_worker_options_t gearman_worker_options(const gearman_worker_st *worker) { if (worker == NULL) { 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 (worker == NULL) { 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 (worker == NULL) { 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)); (void)(rc); 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)); (void)(rc); 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 (worker) { 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 (worker == NULL) { return 0; } return gearman_universal_timeout(worker->universal); } void gearman_worker_set_timeout(gearman_worker_st *worker, int timeout) { if (worker) { 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 (worker) { return worker->context; } return NULL; } void gearman_worker_set_context(gearman_worker_st *worker, void *context) { if (worker) { 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 (worker) { 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 (worker) { 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 (worker) { if (gearman_connection_create_args(worker->universal, host, port) == NULL) { return gearman_universal_error_code(worker->universal); } return GEARMAN_SUCCESS; } return GEARMAN_INVALID_ARGUMENT; } 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 (worker) { gearman_free_all_cons(worker->universal); } } gearman_return_t gearman_worker_wait(gearman_worker_st *worker) { if (worker) { return gearman_wait(worker->universal); } return GEARMAN_INVALID_ARGUMENT; } 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) { if (worker) { struct _worker_function_st *function; function= _function_exist(worker, function_name, function_length); return (function && function->options.remove == false) ? true : false; } return false; } static inline gearman_return_t _worker_unregister(gearman_worker_st *worker, const char *function_name, size_t function_length) { if (worker) { _worker_function_st *function= _function_exist(worker, function_name, function_length); if (function == NULL || function->options.remove) { return GEARMAN_NO_REGISTERED_FUNCTION; } if (function->options.packet_in_use) { gearman_packet_free(&(function->packet())); function->options.packet_in_use= false; } const void *args[1]; size_t args_size[1]; args[0]= function->name(); args_size[0]= function->length(); gearman_return_t 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.packet_in_use= true; function->options.change= true; function->options.remove= true; worker->options.change= true; return GEARMAN_SUCCESS; } return GEARMAN_INVALID_ARGUMENT; } 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) { if (worker) { 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; 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; } return GEARMAN_INVALID_ARGUMENT; } gearman_job_st *gearman_worker_grab_job(gearman_worker_st *worker, gearman_job_st *job, gearman_return_t *ret_ptr) { if (worker) { 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_packet(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_packet(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_packet(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 or worker->job->assigned.command == GEARMAN_COMMAND_OPTION_RES) { gearman_packet_free(&(worker->job->assigned)); break; } if (worker->job->assigned.command != GEARMAN_COMMAND_NOOP) { gearman_universal_set_error(worker->universal, GEARMAN_UNEXPECTED_PACKET, GEARMAN_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_packet(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) { gearman_nap(GEARMAN_WORKER_WAIT_TIMEOUT); } else { if (worker->universal.timeout > 0) { gearman_nap(worker->universal); } if (worker->options.timeout_return) { *ret_ptr= gearman_error(worker->universal, GEARMAN_TIMEOUT, "Option timeout return reached"); 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; } } } return NULL; } void gearman_job_free_all(gearman_worker_st *worker) { if (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 (worker) { if (function_name == NULL) { return gearman_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "function name not given"); } if (worker_fn == NULL) { 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); } return GEARMAN_INVALID_ARGUMENT; } 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 (worker) { if (function_name == NULL 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; } void gearman_worker_reset_error(gearman_worker_st *worker) { if (worker) { universal_reset_error(worker->universal); } } gearman_return_t gearman_worker_work(gearman_worker_st *worker) { bool shutdown= false; if (worker) { universal_reset_error(worker->universal); 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_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "worker returned an invalid response, gearman_return_t"); 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 gearman_reset(worker->universal); 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 (worker->work_job->error_code == GEARMAN_SHUTDOWN) { } 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; if (shutdown) { return GEARMAN_SHUTDOWN; } return GEARMAN_SUCCESS; } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_worker_echo(gearman_worker_st *worker, const void *workload, size_t workload_size) { if (worker) { return gearman_echo(worker->universal, workload, workload_size); } return GEARMAN_INVALID_ARGUMENT; } /* * Static Definitions */ static gearman_worker_st *_worker_allocate(gearman_worker_st *worker, bool is_clone) { if (worker) { worker->options.allocated= false; } else { worker= new (std::nothrow) gearman_worker_st; if (worker == NULL) { return NULL; } worker->options.allocated= true; } 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 (is_clone == false) { gearman_universal_initialize(worker->universal); #if 0 gearman_universal_set_timeout(worker->universal, GEARMAN_WORKER_WAIT_TIMEOUT); #endif } if (setup_shutdown_pipe(worker->universal.wakeup_fd) == false) { if (worker->options.allocated) { delete worker; } return NULL; } 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]; if (worker == NULL) { return GEARMAN_INVALID_ARGUMENT; } if (function_length == 0 or function_name == NULL or function_length > GEARMAN_FUNCTION_MAX_SIZE) { if (function_length > GEARMAN_FUNCTION_MAX_SIZE) { gearman_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "function name longer then GEARMAN_MAX_FUNCTION_SIZE"); } else { gearman_error(worker->universal, GEARMAN_INVALID_ARGUMENT, "invalid function"); } return GEARMAN_INVALID_ARGUMENT; } _worker_function_st *function= make(worker->universal._namespace, function_name, function_length, function_arg, context); if (function == NULL) { 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 (worker == NULL) { 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 (self) { gearman_universal_set_namespace(self->universal, namespace_key, namespace_key_size); } } gearman_id_t gearman_worker_id(gearman_worker_st *self) { if (self == NULL) { gearman_id_t handle= { INVALID_SOCKET, INVALID_SOCKET }; return handle; } return gearman_universal_id(self->universal); } gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job) { if (job) { return gearman_worker_clone(NULL, job->worker); } return NULL; } gearman_return_t gearman_worker_set_identifier(gearman_worker_st *worker, const char *id, size_t id_size) { if (worker) { return gearman_set_identifier(worker->universal, id, id_size); } return GEARMAN_INVALID_ARGUMENT; } const char *gearman_worker_namespace(gearman_worker_st *self) { return gearman_univeral_namespace(self->universal); } gearmand-1.0.6/libgearman/task.cc0000664000076400007640000002367212127430346017144 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include #include #include /* * Public Definitions */ #define TASK_MAGIC 134 #define TASK_ANTI_MAGIC 157 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.is_initialized= 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->magic_= TASK_MAGIC; task->created_id= 0; task->numerator= 0; task->denominator= 0; task->client_count= 0; task->client= client; task->func= client->actions; task->result_rc= GEARMAN_UNKNOWN_STATE; // Add the task to the client { 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; task->unique_length= 0; task->unique[0]= 0; return task; } void gearman_task_free(gearman_task_st *task) { if (task) { if (task->options.is_initialized == false) { return; } assert(task->magic_ != TASK_ANTI_MAGIC); assert(task->magic_ == TASK_MAGIC); task->magic_= TASK_ANTI_MAGIC; gearman_task_free_result(task); if (task->client) { 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 the task we are removing is a current task, remove it from the client // structures. if (task->client->task == task) { task->client->task= NULL; } task->client= NULL; } task->job_handle[0]= 0; task->options.is_initialized= false; if (task->options.allocated) { delete task; } } } void gearman_task_free_result(gearman_task_st *task) { assert(task); if (task) { delete task->result_ptr; task->result_ptr= NULL; } } bool gearman_task_is_active(const gearman_task_st *self) { assert(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(const gearman_task_st *self) { if (self == NULL) { return NULL; } 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) { if (task == NULL) { return; } task->func= gearman_actions_default(); } void *gearman_task_context(const gearman_task_st *task) { if (task == NULL) { return NULL; } return const_cast(task->context); } void gearman_task_set_context(gearman_task_st *task, void *context) { if (task) { task->context= context; } } const char *gearman_task_function_name(const gearman_task_st *task) { if (task == NULL) { return NULL; } return task->send.arg[0]; } const char *gearman_task_unique(const gearman_task_st *task) { if (task == NULL) { return NULL; } return task->unique; } const char *gearman_task_job_handle(const gearman_task_st *task) { if (task == NULL) { return NULL; } return task->job_handle; } bool gearman_task_is_known(const gearman_task_st *task) { if (task == NULL) { return false; } return task->options.is_known; } bool gearman_task_is_running(const gearman_task_st *task) { if (task == NULL) { return false; } return task->options.is_running; } uint32_t gearman_task_numerator(const gearman_task_st *task) { if (task == NULL) { return 0; } return task->numerator; } uint32_t gearman_task_denominator(const gearman_task_st *task) { if (task == NULL) { return 0; } return task->denominator; } void gearman_task_give_workload(gearman_task_st *task, const void *workload, size_t workload_size) { if (task) { 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 (task == NULL) { if (ret_ptr) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; } return 0; } return task->con->send_and_flush(workload, workload_size, ret_ptr); } gearman_result_st *gearman_task_result(gearman_task_st *task) { if (task) { return task->result_ptr; } return NULL; } gearman_result_st *gearman_task_mutable_result(gearman_task_st *task) { assert(task); // Programmer error if (task) { if (task->result_ptr == NULL) { task->result_ptr= new (std::nothrow) gearman_result_st(); assert(task->result_ptr); } return task->result_ptr; } return NULL; } const void *gearman_task_data(const gearman_task_st *task) { if (task and task->recv and task->recv->data) { return task->recv->data; } return NULL; } size_t gearman_task_data_size(const gearman_task_st *task) { if (task) { 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 (task == NULL) { 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) { gearman_return_t unused; if (ret_ptr == NULL) { ret_ptr= &unused; } if (task == NULL) { *ret_ptr= GEARMAN_INVALID_ARGUMENT; return 0; } return task->con->receive_data(data, data_size, *ret_ptr); } const char *gearman_task_error(const gearman_task_st *task) { if (task == NULL) { 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) { if (task == NULL) { return GEARMAN_INVALID_ARGUMENT; } return task->result_rc; } gearmand-1.0.6/libgearman/add.hpp0000664000076400007640000000740712107145705017132 0ustar00brianbrian00000000000000/* 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, gearman_unique_t &unique, const gearman_string_t &work, time_t when, const gearman_actions_t &actions); gearman_task_st *add_task_ptr(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, const 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, gearman_unique_t &unique, const gearman_string_t &workload, time_t when, const 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, const gearman_actions_t &actions, const time_t epoch, void *context); gearmand-1.0.6/libgearman/error.cc0000664000076400007640000001565412127430346017334 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include #include #include #include static void correct_from_errno(gearman_universal_st& universal) { if (universal.error.rc == GEARMAN_ERRNO) { switch (universal.error.last_errno) { case EFAULT: case ENOMEM: universal.error.rc= GEARMAN_MEMORY_ALLOCATION_FAILURE; break; case EINVAL: universal.error.rc= GEARMAN_INVALID_ARGUMENT; break; case ECONNRESET: case EHOSTDOWN: case EPIPE: universal.error.rc= GEARMAN_LOST_CONNECTION; break; case ECONNREFUSED: case ENETUNREACH: case ETIMEDOUT: universal.error.rc= GEARMAN_COULD_NOT_CONNECT; break; default: break; } } else { universal.error.last_errno= 0; } } void universal_reset_error(gearman_universal_st& universal) { universal.error.rc= GEARMAN_SUCCESS; universal.error.last_errno= 0; universal.error.last_error[0]= 0; } #pragma GCC diagnostic ignored "-Wformat-nonliteral" gearman_return_t gearman_universal_set_error(gearman_universal_st& universal, gearman_return_t rc, const char *function, const char *position, const char *format, ...) { if (rc == GEARMAN_SUCCESS) { return GEARMAN_SUCCESS; } va_list args; universal.error.rc= rc; correct_from_errno(universal); 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; } length= snprintf(universal.error.last_error, GEARMAN_MAX_ERROR_SIZE, "%s(%s) %s -> %s", function, gearman_strerror(universal.error.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; } if (universal.log_fn) { universal.log_fn(universal.error.last_error, universal.error.rc == GEARMAN_MEMORY_ALLOCATION_FAILURE ? GEARMAN_VERBOSE_FATAL : GEARMAN_VERBOSE_ERROR, static_cast(universal.log_context)); } return universal.error.rc; } gearman_return_t gearman_universal_set_gerror(gearman_universal_st& universal, gearman_return_t rc, const char *func, const char *position) { if (rc == GEARMAN_SUCCESS or rc == GEARMAN_IO_WAIT) { return rc; } universal.error.rc= rc; correct_from_errno(universal); 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, universal.error.rc == GEARMAN_MEMORY_ALLOCATION_FAILURE ? GEARMAN_VERBOSE_FATAL : GEARMAN_VERBOSE_ERROR, 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) { if (errno == 0) { return GEARMAN_SUCCESS; } switch (errno) { case ENOMEM: universal.error.rc= GEARMAN_MEMORY_ALLOCATION_FAILURE; break; default: universal.error.rc= GEARMAN_ERRNO; break; } universal.error.last_errno= errno; correct_from_errno(universal); 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; } if (universal.log_fn) { universal.log_fn(universal.error.last_error, universal.error.rc == GEARMAN_MEMORY_ALLOCATION_FAILURE ? GEARMAN_VERBOSE_FATAL : GEARMAN_VERBOSE_ERROR, static_cast(universal.log_context)); } return universal.error.rc; } gearmand-1.0.6/libgearman/string.cc0000664000076400007640000000326012107145705017477 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include gearmand-1.0.6/libgearman/kill.cc0000664000076400007640000000605212107145705017126 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include gearman_id_t gearman_id_initialize(void) { static gearman_id_t tmp= { -1, -1 }; return tmp; } bool gearman_id_valid(const gearman_id_t handle) { if (handle.write_fd <= 0 and handle.read_fd <= 0) { return false; } return true; } gearman_return_t gearman_kill(const gearman_id_t handle, const gearman_signal_t sig) { if (handle.write_fd <= 0 or handle.read_fd <= 0) { return GEARMAN_COULD_NOT_CONNECT; } switch (sig) { case GEARMAN_SIGNAL_INTERRUPT: if (write(handle.write_fd, "1", 1) == 1) { return GEARMAN_SUCCESS; } break; case GEARMAN_SIGNAL_KILLWAIT: if (close(handle.write_fd) == 0) { gearman_kill(handle, GEARMAN_SIGNAL_CHECK); return GEARMAN_SUCCESS; } break; case GEARMAN_SIGNAL_KILL: if (close(handle.write_fd) == 0) { return GEARMAN_SUCCESS; } break; case GEARMAN_SIGNAL_CHECK: { struct pollfd pfds[1]; memset(&pfds, 0, sizeof(pfds)); pfds[0].fd= handle.read_fd; pfds[0].events= POLLIN; pfds[0].revents= 0; int ret= ::poll(pfds, 1, 1500); if (ret >= 0) { return GEARMAN_SUCCESS; } } break; } return GEARMAN_COULD_NOT_CONNECT; } gearmand-1.0.6/libgearman/task_attr.cc0000664000076400007640000000567112107145705020175 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include "libgearman/assert.hpp" #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_EPOCH, priority, {{0}} }; local.options.epoch.value= epoch; return local; } time_t gearman_task_attr_has_epoch(const gearman_task_attr_t *self) { if (self and self->kind == GEARMAN_TASK_ATTR_EPOCH) { return self->options.epoch.value; } return 0; } gearman_job_priority_t gearman_task_attr_priority(const gearman_task_attr_t *self) { if (self == NULL) { return GEARMAN_JOB_PRIORITY_NORMAL; } return self->priority; } bool gearman_task_attr_is_background(const gearman_task_attr_t *self) { if (self) { return (self->kind == GEARMAN_TASK_ATTR_BACKGROUND or self->kind == GEARMAN_TASK_ATTR_EPOCH); } return false; } gearmand-1.0.6/libgearman/backtrace.hpp0000664000076400007640000000330612107145705020313 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * libgearman client library. * * Copyright (C) 2012 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 custom_backtrace(void); gearmand-1.0.6/libgearman/assert.hpp0000664000076400007640000000572412120542515017676 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * libmcachedd client 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 // __cplusplus #ifdef NDEBUG # define assert_msg(__expr, __mesg) (void)(__expr); (void)(__mesg); # define assert_vmsg(__expr, __mesg, ...) (void)(__expr); (void)(__mesg); #else # ifdef _WIN32 # include # else # include # endif # ifdef __cplusplus # include # include # else # include # include # endif // __cplusplus # include # define assert_msg(__expr, __mesg) \ do \ { \ if (not (__expr)) \ { \ fprintf(stderr, "\n%s:%d Assertion \"%s\" failed for function \"%s\" likely for %s\n", __FILE__, __LINE__, #__expr, __func__, (#__mesg));\ custom_backtrace(); \ abort(); \ } \ } while (0) # define assert_vmsg(__expr, __mesg, ...) \ do \ { \ if (not (__expr)) \ { \ size_t ask= snprintf(0, 0, (__mesg), __VA_ARGS__); \ ask++; \ char *_error_message= (char*)alloca(sizeof(char) * ask); \ size_t _error_message_size= snprintf(_error_message, ask, (__mesg), __VA_ARGS__); \ fprintf(stderr, "\n%s:%d Assertion '%s' failed for function '%s' [ %.*s ]\n", __FILE__, __LINE__, #__expr, __func__, int(_error_message_size), _error_message);\ custom_backtrace(); \ abort(); \ } \ } while (0) #endif // NDEBUG gearmand-1.0.6/libgearman/pipe.h0000664000076400007640000000333612107145705016774 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 bool setup_shutdown_pipe(int pipedes_[2]); gearmand-1.0.6/libgearman/task_attr.h0000664000076400007640000000365512107145705020037 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 // Everything below here is private time_t gearman_task_attr_has_epoch(const gearman_task_attr_t *); gearman_job_priority_t gearman_task_attr_priority(const gearman_task_attr_t *); bool gearman_task_attr_is_background(const gearman_task_attr_t *); gearmand-1.0.6/libgearman/gearman.cc0000664000076400007640000000500712107145705017604 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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]; } gearmand-1.0.6/libgearman/argument.cc0000664000076400007640000000372012107145705020014 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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; } gearmand-1.0.6/libgearman/connection.cc0000664000076400007640000007536012141153474020342 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include #include #include #include #include #include #if HAVE_NETINET_TCP_H # include /* for TCP_NODELAY */ #endif #ifdef HAVE_FCNTL_H # include #endif #ifndef SOCK_CLOEXEC # define SOCK_CLOEXEC 0 #endif #ifndef SOCK_NONBLOCK # define SOCK_NONBLOCK 0 #endif #ifndef FD_CLOEXEC # define FD_CLOEXEC 0 #endif #ifndef MSG_DONTWAIT # define MSG_DONTWAIT 0 #endif static 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; } /** * @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), next(NULL), prev(NULL), context(NULL), _addrinfo(NULL), addrinfo_next(NULL), send_buffer_ptr(NULL), _recv_packet(NULL) { 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; universal.con_list= this; universal.con_count++; send_buffer_ptr= send_buffer; recv_buffer_ptr= recv_buffer; host[0]= 0; } gearman_connection_st::gearman_connection_st(const gearman_connection_st& copy): state(GEARMAN_CON_UNIVERSAL_ADDRINFO), send_state(GEARMAN_CON_SEND_STATE_NONE), recv_state(GEARMAN_CON_RECV_UNIVERSAL_NONE), port(copy.port), 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(copy.universal), next(NULL), prev(NULL), context(NULL), _addrinfo(NULL), addrinfo_next(NULL), send_buffer_ptr(NULL), _recv_packet(NULL) { if (universal.con_list) { universal.con_list->prev= this; } next= universal.con_list; universal.con_list= this; universal.con_count++; send_buffer_ptr= send_buffer; recv_buffer_ptr= recv_buffer; if (host[0]) { strcpy(host, copy.host); } else { 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 (connection == NULL) { 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 (connection) { connection->set_host(host, port); if (gearman_failed(connection->lookup())) { gearman_gerror(universal, GEARMAN_GETADDRINFO); delete connection; return NULL; } } 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 (connection) { connection->options.ready= from.options.ready; // @todo Is this right? 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 != INVALID_SOCKET) { close_socket(); } 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--; } free_private_packet(); } void gearman_connection_st::free_private_packet() { if (options.packet_in_use) { gearman_packet_free(&_packet); options.packet_in_use= false; } } /** @} */ /* * Public Definitions */ void gearman_connection_st::set_host(const char *host_arg, const in_port_t port_arg) { reset_addrinfo(); if (host_arg and host_arg[0]) { } else { host_arg= GEARMAN_DEFAULT_TCP_HOST; } strncpy(host, host_arg, GEARMAN_NI_MAXHOST); host[GEARMAN_NI_MAXHOST - 1]= 0; if (port_arg < 1) { port= GEARMAN_DEFAULT_TCP_PORT; } else { port= port_arg; } } /* Do not call error within this function. */ void gearman_connection_st::close_socket() { if (fd == INVALID_SOCKET) { return; } /* in case of death shutdown to avoid blocking at close_socket() */ if (shutdown(fd, SHUT_RDWR) == SOCKET_ERROR && get_socket_errno() != ENOTCONN) { } else { if (closesocket(fd) == SOCKET_ERROR) { } } 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; free_recv_packet(); recv_buffer_ptr= recv_buffer; recv_buffer_size= 0; options.server_options_sent= false; // created_id_next is incremented for every outbound packet (except status). // created_id is incremented for every response packet received, and also when // no packets are received due to an error. There are lots of such error paths // and it seems simpler to just reset these both to zero when a connection is // 'closed'. created_id= 0; created_id_next= 0; } void gearman_connection_st::free_recv_packet() { if (_recv_packet) { gearman_packet_free(recv_packet()); _recv_packet= NULL; } } void gearman_connection_st::reset_addrinfo() { if (_addrinfo) { freeaddrinfo(_addrinfo); _addrinfo= NULL; } addrinfo_next= NULL; } /* * The send_packet() method does not only send the passed-in packet_arg. If there are any server options * established, and they haven't yet been sent over, then these options are sent over first. * Only if that succeeds is the packet_arg sent. * The reason for this is server options are only set once by the client/worker. In the older code, this * resulted in them being sent over exactly once. If the connection was dropped and rebuilt, then the options * were not sent over again, rendering them moot. This way, we're guaranteed that the options are always sent * at least once to a connected server. */ gearman_return_t gearman_connection_st::send_packet(const gearman_packet_st& packet_arg, const bool flush_buffer) { if (options.server_options_sent == false) { for (gearman_server_options_st* head= universal.server_options_list; head; head= head->next) { gearman_packet_st message; const void *args[]= { (void*)(head->value()) }; size_t args_size[]= { head->size() }; gearman_return_t ret= gearman_packet_create_args(universal, message, GEARMAN_MAGIC_REQUEST, GEARMAN_COMMAND_OPTION_REQ, args, args_size, 1); if (gearman_failed(ret)) { gearman_packet_free(&message); return gearman_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "gearman_packet_create_args()"); } PUSH_BLOCKING(universal); OptionCheck check(universal); ret= _send_packet(message, true); if (gearman_failed(ret)) { gearman_packet_free(&message); gearman_error(universal, ret, "Failed to send server-options packet"); return ret; } options.packet_in_use= true; gearman_packet_st *packet_ptr= receiving(_packet, ret, true); if (packet_ptr == NULL) { gearman_packet_free(&message); options.packet_in_use= false; gearman_error(universal, ret, "Failed in receiving()"); return ret; } if (gearman_failed(ret) || gearman_failed(ret= check.success(this))) { gearman_packet_free(&message); free_private_packet(); reset_recv_packet(); gearman_error(universal, ret, "receiving()"); return ret; } free_private_packet(); reset_recv_packet(); gearman_packet_free(&message); } options.server_options_sent= true; } return _send_packet(packet_arg, flush_buffer); } /* * This is the real implementation that actually sends a packet. Read the comments for send_packet() for why * that is. Note that this is a private method. External callers should only call send_packet(). */ gearman_return_t gearman_connection_st::_send_packet(const gearman_packet_st& packet_arg, const bool flush_buffer) { switch (send_state) { case GEARMAN_CON_SEND_STATE_NONE: assert_msg(packet_arg.universal, "send_packet() was to execute against a packet with no universal"); universal_reset_error(*(packet_arg.universal)); if (packet_arg.options.complete == false) { return gearman_error(universal, GEARMAN_INVALID_PACKET, "packet not complete"); } /* Pack first part of packet, which is everything but the payload. */ while (1) { { // Scoping to shut compiler up about switch/case jump gearman_return_t rc; 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) { return gearman_universal_set_error(universal, GEARMAN_SEND_BUFFER_TOO_SMALL, GEARMAN_AT, "send buffer too small (%u)", GEARMAN_SEND_BUFFER_SIZE); } /* 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 (packet_arg.data_size == 0) { 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 (packet_arg.data == NULL) { 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, (const char*)(packet_arg.data) +send_data_offset, send_buffer_size); send_data_size= 0; send_data_offset= 0; break; } send_buffer_ptr= (const char*)(size_t(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= (const char*)data; send_buffer_size= data_size; *ret_ptr= flush(); return data_size -send_buffer_size; } gearman_return_t gearman_connection_st::lookup() { reset_addrinfo(); char port_str[GEARMAN_NI_MAXSERV]= { 0 }; int port_str_length; if (size_t(port_str_length= snprintf(port_str, sizeof(port_str), "%hu", uint16_t(port))) >= sizeof(port_str)) { return gearman_universal_set_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, GEARMAN_AT, "snprintf(%d)", port_str_length); } assert(port_str[0]); assert(host[0]); struct addrinfo ai; memset(&ai, 0, sizeof(struct addrinfo)); ai.ai_socktype= SOCK_STREAM; ai.ai_protocol= IPPROTO_TCP; assert_msg(_addrinfo == NULL, "Programmer error, reset_addrinfo() is either broke, or was not called."); int ret; if ((ret= getaddrinfo(host, port_str, &ai, &(_addrinfo)))) { reset_addrinfo(); return gearman_universal_set_error(universal, GEARMAN_GETADDRINFO, GEARMAN_AT, "getaddrinfo:%s", gai_strerror(ret)); } addrinfo_next= _addrinfo; assert(addrinfo_next); state= GEARMAN_CON_UNIVERSAL_CONNECT; return GEARMAN_SUCCESS; } gearman_return_t gearman_connection_st::flush() { while (1) { switch (state) { case GEARMAN_CON_UNIVERSAL_ADDRINFO: { gearman_return_t ret= lookup(); if (gearman_failed(ret)) { return ret; } } case GEARMAN_CON_UNIVERSAL_CONNECT: if (fd != INVALID_SOCKET) { close_socket(); } 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)); } // rewrite tye if HAVE_SOCK_CLOEXEC { int type= addrinfo_next->ai_socktype; if (SOCK_CLOEXEC) { type|= SOCK_CLOEXEC; } if (SOCK_NONBLOCK) { type|= SOCK_NONBLOCK; } fd= socket(addrinfo_next->ai_family, type, addrinfo_next->ai_protocol); } if (fd == INVALID_SOCKET) { state= GEARMAN_CON_UNIVERSAL_ADDRINFO; return gearman_perror(universal, "socket"); } { gearman_return_t gret= set_socket_options(); if (gearman_failed(gret)) { close_socket(); return gret; } } while (1) { if (connect(fd, addrinfo_next->ai_addr, addrinfo_next->ai_addrlen) == 0) { state= GEARMAN_CON_UNIVERSAL_CONNECTED; addrinfo_next= NULL; break; } switch (errno) { // Treat as an async connect case EINTR: case EINPROGRESS: state= GEARMAN_CON_UNIVERSAL_CONNECTING; break; case ECONNREFUSED: case ENETUNREACH: case ETIMEDOUT: addrinfo_next= addrinfo_next->ai_next; // We will treat this as an error but retry the address case EAGAIN: state= GEARMAN_CON_UNIVERSAL_CONNECT; close_socket(); break; default: gearman_perror(universal, "connect"); close_socket(); return GEARMAN_COULD_NOT_CONNECT; } break; } 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, MSG_NOSIGNAL); if (write_size == 0) // Zero value on send() { } else if (write_size == -1) { switch (errno) { #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN case EWOULDBLOCK: #endif case EAGAIN: { set_events(POLLOUT); if (gearman_universal_is_non_blocking(universal)) { return gearman_gerror(universal, GEARMAN_IO_WAIT); } gearman_return_t gret= gearman_wait(universal); if (gearman_failed(gret)) { return gret; } continue; } case EPIPE: case ECONNRESET: case EHOSTDOWN: { gearman_return_t ret= gearman_perror(universal, "lost connection to server during send"); close_socket(); return ret; } default: break; } gearman_return_t ret= gearman_perror(universal, "send"); close_socket(); return ret; } 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) { ret= gearman_error(universal, GEARMAN_NOT_CONNECTED, "not connected"); return NULL; } _recv_packet= gearman_packet_create(universal, &packet_arg); if (_recv_packet == NULL) { ret= gearman_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "gearman_packet_create()"); return NULL; } recv_state= GEARMAN_CON_RECV_UNIVERSAL_READ; case GEARMAN_CON_RECV_UNIVERSAL_READ: while (1) { // If we have data, see if it is a complete packet 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_socket(); 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_socket(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 (recv_data == false ) { recv_state= GEARMAN_CON_RECV_STATE_READ_DATA; break; } assert(packet_arg.universal); packet_arg.data= gearman_malloc((*packet_arg.universal), packet_arg.data_size); if (packet_arg.data == NULL) { ret= gearman_error(universal, GEARMAN_MEMORY_ALLOCATION_FAILURE, "gearman_malloc((*packet_arg.universal), packet_arg.data_size)"); close_socket(); 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)receive_data(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(); reset_recv_packet(); return tmp_packet_arg; } size_t gearman_connection_st::receive_data(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_socket(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_socket(void *data, size_t data_size, gearman_return_t& ret) { ssize_t read_size; while (1) { read_size= ::recv(fd, data, data_size, MSG_NOSIGNAL); if (read_size == 0) { ret= gearman_error(universal, GEARMAN_LOST_CONNECTION, "lost connection to server (EOF)"); close_socket(); return 0; } else if (read_size == -1) { if (errno == EAGAIN) { set_events(POLLIN); if (gearman_universal_is_non_blocking(universal)) { ret= gearman_gerror(universal, GEARMAN_IO_WAIT); return 0; } ret= gearman_wait(universal); if (gearman_failed(ret)) { if (ret == GEARMAN_SHUTDOWN) { close_socket(); } return 0; } continue; } else if (errno == EINTR) { continue; } else if (errno == EPIPE || errno == ECONNRESET || errno == EHOSTDOWN) { ret= gearman_perror(universal, "lost connection to server during read"); } else { ret= gearman_perror(universal, "recv"); } close_socket(); 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 */ gearman_return_t gearman_connection_st::set_socket_options() { if (SOCK_CLOEXEC == 0) { if (FD_CLOEXEC) { int flags; do { flags= fcntl(fd, F_GETFD, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags != -1) { int rval; do { rval= fcntl (fd, F_SETFD, flags | FD_CLOEXEC); } while (rval == -1 && (errno == EINTR or errno == EAGAIN)); // we currently ignore the case where rval is -1 } } } { int ret= 1; ret= setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &ret, socklen_t(sizeof(int))); if (ret == -1 && errno != EOPNOTSUPP) { gearman_perror(universal, "setsockopt(TCP_NODELAY)"); return GEARMAN_ERRNO; } } { struct linger linger; linger.l_onoff= 1; linger.l_linger= GEARMAN_DEFAULT_SOCKET_TIMEOUT; int ret= setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger, socklen_t(sizeof(struct linger))); if (ret == -1) { gearman_perror(universal, "setsockopt(SO_LINGER)"); return GEARMAN_ERRNO; } } if (0) { struct timeval waittime; waittime.tv_sec= GEARMAN_DEFAULT_SOCKET_TIMEOUT; waittime.tv_usec= 0; int ret= setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &waittime, socklen_t(sizeof(struct timeval))); if (ret == -1 && errno != ENOPROTOOPT) { gearman_perror(universal, "setsockopt(SO_SNDTIMEO)"); return GEARMAN_ERRNO; } ret= setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &waittime, socklen_t(sizeof(struct timeval))); if (ret == -1 && errno != ENOPROTOOPT) { gearman_perror(universal, "setsockopt(SO_RCVTIMEO)"); return GEARMAN_ERRNO; } } { int optval= 1; int ret= setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)); if (ret == -1 && errno != ENOPROTOOPT) { gearman_perror(universal, "setsockopt(SO_KEEPALIVE)"); return GEARMAN_ERRNO; } } { int ret= GEARMAN_DEFAULT_SOCKET_SEND_SIZE; ret= setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &ret, socklen_t(sizeof(int))); if (ret == -1) { gearman_perror(universal, "setsockopt(SO_SNDBUF)"); return GEARMAN_ERRNO; } } #if defined(SO_NOSIGPIPE) if (SO_NOSIGPIPE) { int ret= 1; ret= setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, static_cast(&ret), sizeof(int)); // This is not considered a fatal error if (ret == -1) { gearman_perror(universal, "setsockopt(SO_NOSIGPIPE)"); } } #endif { int ret= GEARMAN_DEFAULT_SOCKET_RECV_SIZE; ret= setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &ret, socklen_t(sizeof(int))); if (ret == -1) { gearman_perror(universal, "setsockopt(SO_RCVBUF)"); return GEARMAN_ERRNO; } } // If SOCK_NONBLOCK doesn't work, just enable non_block via fcntl if (SOCK_NONBLOCK == 0) { int flags; do { flags= fcntl(fd, F_GETFL, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags == -1) { gearman_perror(universal, "fcntl(F_GETFL)"); return GEARMAN_ERRNO; } else if ((flags & O_NONBLOCK) == 0) { int retval; do { retval= fcntl(fd, F_SETFL, flags | O_NONBLOCK); } while (retval == -1 and (errno == EINTR or errno == EAGAIN)); if (retval == -1) { gearman_perror(universal, "fcntl(F_SETFL)"); return GEARMAN_ERRNO; } } } return GEARMAN_SUCCESS; } gearmand-1.0.6/libgearman/byteorder.h0000664000076400007640000000427512107145705020041 0ustar00brianbrian00000000000000/* Taken from libmemcached. */ /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 #ifndef HAVE_HTONLL GEARMAN_INTERNAL_API uint64_t ntohll(uint64_t); GEARMAN_INTERNAL_API uint64_t htonll(uint64_t); #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 gearmand-1.0.6/libgearman/vector.hpp0000664000076400007640000000733512141160415017675 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Libgearman library * * Copyright (C) 2011-2013 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 #include #include #include #include "libgearman-1.0/string.h" #define GEARMAN_VECTOR_BLOCK_SIZE 1024*4 /** 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 Options { bool is_allocated; bool is_initialized; Options() : is_allocated(false), is_initialized(true) { } } options; gearman_vector_st() : end(NULL), string(NULL), current_size(0) { } gearman_vector_st(const gearman_vector_st& copy) : end(NULL), string(NULL), current_size(0) { store(copy); } gearman_vector_st(const size_t reserve); ~gearman_vector_st(); bool resize(const size_t); bool reserve(const size_t); int vec_printf(const char *format__, ...); // __printflike(1, 2); int vec_append_printf(const char *format__, ...); // __printflike(1, 2); void clear() { end= string; if (current_size) { string[0]= 0; } } const char* value() const { return string; } size_t capacity() const { // We tell a white lie about size since we always keep things null // terminated if (current_size == 1) { return 0; } return current_size; } bool store(const gearman_vector_st&); bool store(const char*, const size_t); bool append(const char* arg_, const size_t arg_length_); bool append_character(const char character); size_t size() const; gearman_string_t take(); private: void init(); int vec_size_printf(const char *format__, va_list args__); int vec_ptr_printf(const int required_size, const char *format__, va_list args__); }; gearman_vector_st *gearman_string_create(gearman_vector_st *string, size_t initial_size); gearman_vector_st *gearman_string_create(gearman_vector_st *self, const char *str, size_t initial_size); gearmand-1.0.6/libgearman/status.hpp0000664000076400007640000000411412107145705017715 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 gearman_status_set_return(gearman_status_t&, const gearman_return_t); void gearman_init(gearman_status_t&); void gearman_status_set(gearman_status_t& arg, const bool is_known, const bool is_running, const uint32_t numerator, const uint32_t denominator, const uint32_t client_count); gearmand-1.0.6/libgearman/strerror.cc0000664000076400007640000001224112107145705020052 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2010-2012 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 gearman_strerror() */ #include "gear_config.h" #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_INVALID_SERVER_OPTION: return "GEARMAN_INVALID_SERVER_OPTION"; case GEARMAN_MAX_RETURN: default: return "GEARMAN_MAX_RETURN"; } } gearmand-1.0.6/libgearman/function.cc0000664000076400007640000000542312107145705020021 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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_v2(gearman_function_fn func) { return gearman_function_create(func); } 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; } gearmand-1.0.6/libgearman/job.cc0000664000076400007640000004242212141162002016731 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include "libgearman/vector.h" #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 (task == NULL) { 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; if (check_task) { 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; } static inline void gearman_job_reset_error(gearman_job_st *job) { if (job->worker) { gearman_worker_reset_error(job->worker); } } gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size) { if (job) { 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 ((job->options.work_in_use) == false) { args[0]= job->assigned.arg[0]; args_size[0]= job->assigned.arg_size[0]; args[1]= data; args_size[1]= data_size; gearman_return_t 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); } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size) { if (job) { const void *args[2]; size_t args_size[2]; if ((job->options.work_in_use) == false) { 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); } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator) { if (job) { 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); } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size) { if (job) { if (job->reducer) { return GEARMAN_INVALID_ARGUMENT; } return gearman_job_send_complete_fin(job, result, result_size); } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_complete_fin(gearman_job_st *job, const void *result, size_t result_size) { if (job) { 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"); } const 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; } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size) { if (job) { 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); } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_fail(gearman_job_st *job) { if (job) { if (job->reducer) { return GEARMAN_INVALID_ARGUMENT; } return gearman_job_send_fail_fin(job); } return GEARMAN_INVALID_ARGUMENT; } gearman_return_t gearman_job_send_fail_fin(gearman_job_st *job) { if (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; } return GEARMAN_INVALID_ARGUMENT; } const char *gearman_job_handle(const gearman_job_st *job) { if (job) { return static_cast(job->assigned.arg[0]); } return NULL; } const char *gearman_job_function_name(const gearman_job_st *job) { if (job) { return static_cast(job->assigned.arg[1]); } return NULL; } gearman_string_t gearman_job_function_name_string(const gearman_job_st *job) { if (job) { gearman_string_t temp= { job->assigned.arg[1], job->assigned.arg_size[1] }; return temp; } static gearman_string_t ret= {0, 0}; return ret; } const char *gearman_job_unique(const gearman_job_st *job) { if (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 ""; } return NULL; } bool gearman_job_is_map(const gearman_job_st *job) { if (job) { return bool(job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL) and job->assigned.arg_size[3] > 1; } return false; } gearman_string_t gearman_job_reducer_string(const gearman_job_st *job) { if (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; } static gearman_string_t ret= {0, 0}; return ret; } const char *gearman_job_reducer(const gearman_job_st *job) { if (job) { if (job->assigned.command == GEARMAN_COMMAND_JOB_ASSIGN_ALL) { return static_cast(job->assigned.arg[3]); } return ""; } return NULL; } const void *gearman_job_workload(const gearman_job_st *job) { if (job) { return job->assigned.data; } return NULL; } size_t gearman_job_workload_size(const gearman_job_st *job) { if (job) { return job->assigned.data_size; } return 0; } void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size) { if (job) { return gearman_packet_take_data(job->assigned, data_size); } return NULL; } void gearman_job_free(gearman_job_st *job) { if (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) { 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) { if (job) { gearman_return_t ret= job->con->send_packet(job->work, true); while ((ret == GEARMAN_IO_WAIT) or (ret == GEARMAN_TIMEOUT)) { #if 0 assert(job->work.universal); ret= gearman_wait(*(job->work.universal)); #endif ret= gearman_wait(job->worker->universal); if (ret == GEARMAN_SUCCESS) { ret= job->con->send_packet(job->work, true); } } if (gearman_failed(ret)) { return ret; } gearman_packet_free(&(job->work)); job->options.work_in_use= false; return GEARMAN_SUCCESS; } return GEARMAN_INVALID_ARGUMENT; } const char *gearman_job_error(gearman_job_st *job) { if (job and job->worker) { return gearman_worker_error(job->worker); } return NULL; } gearmand-1.0.6/libgearman/uuid.hpp0000664000076400007640000000337412107145705017347 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2012 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 int safe_uuid_generate(char* buffer, size_t& length); gearmand-1.0.6/libgearman/function/0000775000076400007640000000000012142673674017520 5ustar00brianbrian00000000000000gearmand-1.0.6/libgearman/function/base.hpp0000664000076400007640000000714312141161751021133 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "libgearman/vector.h" 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; _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 (function_name == NULL) { 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; } gearman_packet_st& packet() { return _packet; } private: gearman_packet_st _packet; }; gearmand-1.0.6/libgearman/function/partition.hpp0000664000076400007640000000432012107145705022227 0ustar00brianbrian00000000000000/* 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); }; gearmand-1.0.6/libgearman/function/null.hpp0000664000076400007640000000375412107145705021202 0ustar00brianbrian00000000000000/* 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; } }; gearmand-1.0.6/libgearman/function/function_v2.cc0000664000076400007640000001001012107145705022241 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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_INVALID_SERVER_OPTION: case GEARMAN_MAX_RETURN: break; } return GEARMAN_FUNCTION_INVALID_ARGUMENT; } gearmand-1.0.6/libgearman/function/make.cc0000664000076400007640000000622012107145705020732 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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 function->init(namespace_arg, name, name_length) == false) { delete function; return NULL; } return function; } gearmand-1.0.6/libgearman/function/partition.cc0000664000076400007640000001002112107145705022020 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #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_INVALID_SERVER_OPTION: case GEARMAN_MAX_RETURN: break; } return GEARMAN_FUNCTION_INVALID_ARGUMENT; } gearmand-1.0.6/libgearman/function/function_v2.hpp0000664000076400007640000000411112107145705022450 0ustar00brianbrian00000000000000/* 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); }; gearmand-1.0.6/libgearman/function/function_v1.hpp0000664000076400007640000000521112107145705022451 0ustar00brianbrian00000000000000/* 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 (job->error_code == GEARMAN_SHUTDOWN) { return GEARMAN_FUNCTION_SHUTDOWN; } if (gearman_failed(job->error_code)) { return GEARMAN_FUNCTION_FATAL; } return GEARMAN_FUNCTION_SUCCESS; } }; gearmand-1.0.6/libgearman/function/make.hpp0000664000076400007640000000367512107145705021147 0ustar00brianbrian00000000000000/* 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); gearmand-1.0.6/libgearman/aggregator.cc0000664000076400007640000000373012107145705020315 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include "libgearman/assert.hpp" #include #include #include #include void *gearman_aggegator_context(gearman_aggregator_st *self) { if (not self) return NULL; return self->context; } gearmand-1.0.6/configure0000775000076400007640000413072312142673563015510 0ustar00brianbrian00000000000000#! /bin/sh # From configure.ac 801. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for gearmand 1.0.6. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO 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 -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 as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: https://bugs.launchpad.net/gearmand about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` 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" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # 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. as_fn_error () { 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: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO 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'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # 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` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gearmand' PACKAGE_TARNAME='gearmand' PACKAGE_VERSION='1.0.6' PACKAGE_STRING='gearmand 1.0.6' PACKAGE_BUGREPORT='https://bugs.launchpad.net/gearmand' PACKAGE_URL='http://gearman.info/' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_unique_file="libgearman/gearman.cc" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS SHARED_ENABLED_FALSE SHARED_ENABLED_TRUE TARGET_MINGW_FALSE TARGET_MINGW_TRUE HAVE_VISIBILITY CFLAG_VISIBILITY CXX_VERSION CXX_VERSION_VENDOR CC_VERSION CC_VERSION_VENDOR LIBGEARMAN_VERSION_HEX LIBGEARMAN_VERSION_STRING PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC ax_pthread_config TARGET_HOSTILE_FALSE TARGET_HOSTILE_TRUE INC_AMINCLUDE AMINCLUDE HAVE_LIBUUID_FALSE HAVE_LIBUUID_TRUE LIBUUID_LIB HAVE_LIBEVENT_FALSE HAVE_LIBEVENT_TRUE LIBEVENT_LIB HAVE_LIBMEMCACHED_FALSE HAVE_LIBMEMCACHED_TRUE LIBMEMCACHED_UTIL_LIB LIBMEMCACHED_LIB LIBMEMCACHED_CFLAGS CYASSL_LIB CYASSL_LDFLAGS CYASSL_CPPFLAGS LIBM RT_LIB DL_LIB DL_LDFLAGS DL_CPPFLAGS ALLOCA LIBOBJS BUILD_WIN32_WRAPPERS_FALSE BUILD_WIN32_WRAPPERS_TRUE LCOV_GENHTML LCOV SPHINXBUILD MEMCACHED_BINARY WINE VALGRIND PERL DPKG_GENSYMBOLS HIREDIS_LIB HIREDIS_LDFLAGS HIREDIS_CPPFLAGS HAVE_TOKYOCABINET_FALSE HAVE_TOKYOCABINET_TRUE TOKYOCABINET_LIB TOKYOCABINET_LDFLAGS TOKYOCABINET_CPPFLAGS HAVE_LIBPQ_FALSE HAVE_LIBPQ_TRUE POSTGRESQL_LDFLAGS POSTGRESQL_CFLAGS POSTGRESQL_VERSION PG_CONFIG DTRACE_NEEDS_OBJECTS_FALSE DTRACE_NEEDS_OBJECTS_TRUE HAVE_DTRACE_FALSE HAVE_DTRACE_TRUE DTRACEFLAGS DTRACE HAVE_LIBSQLITE3_FALSE HAVE_LIBSQLITE3_TRUE SQLITE3_VERSION SQLITE3_LDFLAGS SQLITE3_CFLAGS LIBDRIZZLE_LIB LIBDRIZZLE_LDFLAGS LIBDRIZZLE_CPPFLAGS DRIZZLED_BINARY HAVE_LIBCURL_FALSE HAVE_LIBCURL_TRUE LIBCURL_LIB LIBCURL_LDFLAGS LIBCURL_CPPFLAGS CURL_LIBS CURL_CFLAGS CURL_CONFIG _WITH_LIBGEARMAN_SUPPORT HAVE_LIBGEARMAN_FALSE HAVE_LIBGEARMAN_TRUE BUILDING_GEARMAN_FALSE BUILDING_GEARMAN_TRUE HAVE_LIBMYSQL_FALSE HAVE_LIBMYSQL_TRUE MYSQL_LDFLAGS MYSQL_CFLAGS MYSQL_INCLUDE MYSQL_VERSION MYSQL_CONFIG MYSQLD LIBTEST_VERSION INCLUDE_HSIEH_SRC_FALSE INCLUDE_HSIEH_SRC_TRUE HASHKIT_LIBRARY_VERSION BOOST_PROGRAM_OPTIONS_LIBS BOOST_LDPATH BOOST_PROGRAM_OPTIONS_LDPATH BOOST_PROGRAM_OPTIONS_LDFLAGS BOOST_CPPFLAGS DISTCHECK_CONFIGURE_FLAGS BOOST_ROOT IS_VCS_CHECKOUT_FALSE IS_VCS_CHECKOUT_TRUE DEBUG_FALSE DEBUG_TRUE MCHECK MCHECK_LIB MCHECK_LDFLAGS MCHECK_CPPFLAGS AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V TARGET_FREEBSD_FALSE TARGET_FREEBSD_TRUE TARGET_LINUX_FALSE TARGET_LINUX_TRUE TARGET_OSX_FALSE TARGET_OSX_TRUE BUILD_WIN32_FALSE BUILD_WIN32_TRUE CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED LIBTOOL GEARMAN_LIBRARY_VERSION AUTOHEADER_FILE am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_static enable_shared with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_silent_rules enable_debug enable_assert with_boost enable_static_boost with_mysql with_curl_prefix with_curl_exec_prefix with_drizzled enable_libdrizzle with_sqlite3 enable_dtrace enable_libpq with_postgresql enable_libtokyocabinet enable_hiredis with_memcached with_sphinx_build with_lcov with_genhtml enable_libmemcached enable_jobserver ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP MCHECK_CPPFLAGS MCHECK_LDFLAGS BOOST_ROOT MYSQL_CONFIG CURL_CONFIG CURL_CFLAGS CURL_LIBS LIBCURL_CPPFLAGS LIBCURL_LDFLAGS DRIZZLED_BINARY LIBDRIZZLE_CPPFLAGS LIBDRIZZLE_LDFLAGS TOKYOCABINET_CPPFLAGS TOKYOCABINET_LDFLAGS HIREDIS_CPPFLAGS HIREDIS_LDFLAGS MEMCACHED_BINARY SPHINXBUILD LCOV LCOV_GENHTML DL_CPPFLAGS DL_LDFLAGS CYASSL_CPPFLAGS CYASSL_LDFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) 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" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) 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" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) 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" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) 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" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --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" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # 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'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` 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" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac 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' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null 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" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no 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" 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" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # 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 1.0.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --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 --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 --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/gearmand] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of gearmand 1.0.6:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-debug Add debug code/turns off optimizations (yes|no) [default=no] --enable-assert Enable assert, this will be overridden by --enable-debug (yes|no) [default=no] --enable-static-boost Prefer the static boost libraries over the shared ones [no] --disable-libdrizzle Build with libdrizzle support [default=on] --enable-dtrace Build with support for the DTRACE. [default=no] --disable-libpq Build with libpq, ie Postgres, support [default=on] --disable-libtokyocabinet Build with libtokyocabinet support [default=on] --disable-hiredis Build with hiredis support [default=on] --disable-libmemcached Build with libmemcached support [default=on] --enable-jobserver[=no/yes/#] default=yes Enable up to # make jobs yes: enable one more than CPU count Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-boost=DIR prefix of Boost 1.39 [guess] --with-mysql=[ARG] use MySQL client library [default=yes], optionally specify path to mysql_config --with-curl-prefix=PREFIX Prefix where curl is installed (optional) --with-curl-exec-prefix=EPREFIX Exec prefix where curl is installed (optional) --with-drizzled=[PATH] absolute path to drizzled executable --with-sqlite3=[ARG] use SQLite 3 library [default=yes], optionally specify the prefix for sqlite3 library --with-postgresql=[ARG] use PostgreSQL library [default=yes], optionally specify path to pg_config --with-memcached=[PATH] absolute path to memcached executable --with-sphinx-build=[PATH] absolute path to sphinx-build executable --with-lcov=[PATH] absolute path to lcov executable --with-genhtml=[PATH] absolute path to genhtml executable Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory 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 CXXCPP C++ preprocessor MCHECK_CPPFLAGS C preprocessor flags for MCHECK headers MCHECK_LDFLAGS linker flags for MCHECK libraries BOOST_ROOT Location of Boost installation MYSQL_CONFIG Full path to mysql_config program CURL_CONFIG config script used for curl CURL_CFLAGS CFLAGS used for curl CURL_LIBS LIBS used for curl LIBCURL_CPPFLAGS C preprocessor flags for LIBCURL headers LIBCURL_LDFLAGS linker flags for LIBCURL libraries DRIZZLED_BINARY Absolute path to drizzled executable LIBDRIZZLE_CPPFLAGS C preprocessor flags for LIBDRIZZLE headers LIBDRIZZLE_LDFLAGS linker flags for LIBDRIZZLE libraries TOKYOCABINET_CPPFLAGS C preprocessor flags for TOKYOCABINET headers TOKYOCABINET_LDFLAGS linker flags for TOKYOCABINET libraries HIREDIS_CPPFLAGS C preprocessor flags for HIREDIS headers HIREDIS_LDFLAGS linker flags for HIREDIS libraries MEMCACHED_BINARY Absolute path to memcached executable SPHINXBUILD Absolute path to sphinx-build executable LCOV Absolute path to lcov executable LCOV_GENHTML Absolute path to genhtml executable DL_CPPFLAGS C preprocessor flags for DL headers DL_LDFLAGS linker flags for DL libraries CYASSL_CPPFLAGS C preprocessor flags for CYASSL headers CYASSL_LDFLAGS linker flags for CYASSL libraries Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . gearmand home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF gearmand configure 1.0.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_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_c_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; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" 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_cpp conftest.$ac_ext") 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; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; 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; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_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_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; 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_c_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; } # 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_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i 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_c_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://bugs.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 \${$3+:} false; 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; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 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>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { 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_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { 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 eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 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; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext 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_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { 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 eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* 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 $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext 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; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # 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; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" 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_cpp conftest.$ac_ext") 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; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; 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; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext 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 || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # 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 () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; 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; } # 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.i 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://bugs.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 \${$3+:} false; 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; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_header_mongrel # 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_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 \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 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; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { 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 eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=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 eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # 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 \${$3+:} false; 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 test_array [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 test_array [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; ${as_lineno_stack:+:} 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 \${$3+:} false; 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 test_array [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; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_cxx_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_cxx_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 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>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { 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_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run 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 1.0.6, which was generated by GNU Autoconf 2.69. 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 do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # 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 else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $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" \ || { { $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 if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " arpa/inet.h" as_fn_append ac_header_list " errno.h" as_fn_append ac_header_list " execinfo.h" as_fn_append ac_header_list " fcntl.h" as_fn_append ac_header_list " features.h" as_fn_append ac_header_list " fnmatch.h" as_fn_append ac_header_list " getopt.h" as_fn_append ac_header_list " inttypes.h" as_fn_append ac_header_list " limits.h" as_fn_append ac_header_list " mach/mach.h" as_fn_append ac_header_list " netdb.h" as_fn_append ac_header_list " netinet/in.h" as_fn_append ac_header_list " netinet/tcp.h" as_fn_append ac_header_list " poll.h" as_fn_append ac_header_list " pwd.h" as_fn_append ac_header_list " signal.h" as_fn_append ac_header_list " spawn.h" as_fn_append ac_header_list " stdarg.h" as_fn_append ac_header_list " stddef.h" as_fn_append ac_header_list " stdint.h" as_fn_append ac_header_list " stdio.h" as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " string.h" as_fn_append ac_header_list " strings.h" as_fn_append ac_header_list " sys/resource.h" as_fn_append ac_header_list " sys/socket.h" as_fn_append ac_header_list " sys/stat.h" as_fn_append ac_header_list " sys/time.h" as_fn_append ac_header_list " sys/types.h" as_fn_append ac_header_list " sys/utsname.h" as_fn_append ac_header_list " sys/wait.h" as_fn_append ac_header_list " syslog.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " winsock2.h" as_fn_append ac_header_list " libmemcached-1.0/types/return.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $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 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## 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 ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do 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 build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # 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_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias 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 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 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;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then 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 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then 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 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` 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 -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $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 CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $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_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" 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 CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $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 CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $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 test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$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 CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe 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 ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" 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 CC=$ac_ct_CC fi fi fi 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; } # 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" 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_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 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; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } 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>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done 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; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { 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>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { 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 cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes 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. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj 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>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $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; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $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 ${ac_cv_c_compiler_gnu+:} false; 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_c_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_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_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_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : 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 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 ${ac_cv_prog_CPP+:} false; 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.i 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.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP 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.i 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.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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 \"$CPP\" 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 { $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 ${ac_cv_path_GREP+:} false; 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" as_fn_executable_p "$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 $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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; 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" as_fn_executable_p "$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 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 ${ac_cv_header_stdc+:} false; 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 _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 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 " 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/gear_config.h" "ac_cv_header_minix_gear_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_gear_config_h" = xyes; then : MINIX=yes else MINIX= 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 ;; 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 ${ac_cv_safe_to_define___extensions__+:} false; 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 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 am__api_version='1.12' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) 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;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # 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 alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else 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 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $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 STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $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_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" 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 STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } 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 ${ac_cv_prog_AWK+:} false; 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 as_fn_executable_p "$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 test -n "$AWK" && break done { $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 \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # 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 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 rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." 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 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='gearmand' VERSION='1.0.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' { $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 ${am_cv_prog_tar_ustar+:} false; 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; } depcc="$CC" 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 ${am_cv_CC_dependencies_compiler_type+:} false; 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". rm -rf conftest.dir 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_CC_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 10 /bin/sh. echo '/* dummy */' > 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 ;; msvc7 | msvc7msys | 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_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_config_headers="$ac_config_headers gear_config.h:gear_config.in" AUTOHEADER_FILE=gear_config.h GEARMAN_LIBRARY_VERSION=7:1:0 # | | | # +------+ | +---+ # | | | # current:revision:age # | | | # | | +- increment if interfaces have been added # | | set to zero if interfaces have been removed # | | or changed # | +- increment if source code has changed # | set to zero if current is incremented # +- increment if interfaces have been added, removed or changed 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.4.2' macro_revision='1.3337' 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 # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # 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 a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; 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" as_fn_executable_p "$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 ${ac_cv_path_FGREP+:} false; 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" as_fn_executable_p "$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 ${lt_cv_path_LD+:} false; 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 ${lt_cv_prog_gnu_ld+:} false; 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 ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$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 DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$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_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" 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 DUMPBIN=$ac_ct_DUMPBIN 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" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&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:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $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 # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). 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. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # 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"`env 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` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $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 OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $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_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" 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 OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # 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. # 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 # 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*) # 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' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) 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 ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' 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])(-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_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $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 DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $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_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" 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 DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar 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 ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$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 AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar 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 ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$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_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" 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 AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $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 STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $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_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" 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 STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: 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 ${ac_cv_prog_RANLIB+:} false; 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 as_fn_executable_p "$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 ${ac_cv_prog_ac_ct_RANLIB+:} false; 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 as_fn_executable_p "$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 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 test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF 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; }; 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 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext 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; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. 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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext 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; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext 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; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $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 MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $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_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" 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 MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $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 DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $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_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" 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 DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $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 NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $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_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" 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 NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $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 LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $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_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" 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 LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $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 OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $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_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" 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 OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $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 OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $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_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" 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 OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" 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; } { $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 ${lt_cv_ld_force_load+:} false; 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 -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; 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 # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options # 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 enable_static=no fi 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; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac 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 fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" 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 # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then 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; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&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 "$_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 fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files 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 # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; 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,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; 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\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # 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='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&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 "$_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 fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&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 "$_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 fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&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 "$_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 fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; 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}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= 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 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** 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 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 ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _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 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no 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 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' 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 | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' 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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; 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' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; 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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$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~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in 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='${wl}-rpath ${wl}$libdir' 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 $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" 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") || (\$ 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 aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ 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 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' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' 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' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # 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 `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. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported 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 ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then 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}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${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 if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) 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' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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 ${lt_cv_prog_compiler__b+:} false; 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 if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_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' # 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. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_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 ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else 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' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) 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' 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" && 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" && 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' hardcode_libdir_separator=: ;; 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} $pic_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" && 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 "-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' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # 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. { $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; } if ${lt_cv_archive_cmds_need_lc+:} false; 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 (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 (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 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 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac 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 '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= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ 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 ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # 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 library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; 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=`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 ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in 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="$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}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. 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 # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor 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 need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # 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]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' 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 if ${lt_cv_shlibpath_overrides_runpath+:} false; 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 main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : 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 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 # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # 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;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 # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor 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=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor 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=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $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= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $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 dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* 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)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* 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)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $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; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } 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 CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: 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 ${ac_cv_prog_CXX+:} false; 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 as_fn_executable_p "$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 ${ac_cv_prog_ac_ct_CXX+:} false; 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 as_fn_executable_p "$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 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 ${ac_cv_cxx_compiler_gnu+:} false; 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 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 ${ac_cv_prog_cxx_g+:} false; 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. */ 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 ${am_cv_CXX_dependencies_compiler_type+:} false; 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". rm -rf conftest.dir 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 10 /bin/sh. echo '/* dummy */' > 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 ;; msvc7 | msvc7msys | 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 func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf 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 ${ac_cv_prog_CXXCPP+:} false; 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.i 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.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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.i 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.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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' 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 archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= 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 # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # 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 ${lt_cv_path_LD+:} false; 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 ${lt_cv_prog_gnu_ld+:} false; 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 # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # 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 -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi 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 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' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' 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. archive_expsym_cmds_CXX="\$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' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _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 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported 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 ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then 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}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; 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=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='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' ;; irix5* | irix6*) 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" && 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 # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared $pic_flag -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 $pic_flag -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 ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *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 | 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 | 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 | 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 | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # 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' ;; esac 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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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=`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* | 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' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' 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; 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='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' 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=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) 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" && 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" && 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 "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # 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=`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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -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 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # 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 -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes 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 # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # 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 -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # 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 -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in 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' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in 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' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac 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; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in 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 # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # 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. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; 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 # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; 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' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&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 "$_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 fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&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 "$_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 fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -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:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&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 "$_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 fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in 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") || (\$ 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 ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # 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. { $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; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; 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 (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 (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 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 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; 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=`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 ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in 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}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. 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 # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor 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 need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # 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]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' 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 if ${lt_cv_shlibpath_overrides_runpath+:} false; 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 main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : 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 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 # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # 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;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 # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no 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=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor 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=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor 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=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $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= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes 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 for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : fi if test "x${ac_cv_prog_cc_c99}" == "xno"; then : as_fn_error $? "No c99 compatible compiler found" "$LINENO" 5 fi cat >>confdefs.h <<_ACEOF #define HOST_VENDOR "$host_vendor" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_OS "$host_os" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_CPU "$host_cpu" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_VENDOR "$target_vendor" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_OS "$target_os" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_CPU "$target_cpu" _ACEOF case $target_os in #( *mingw*) : TARGET_WINDOWS="true" $as_echo "#define TARGET_OS_WINDOWS 1" >>confdefs.h $as_echo "#define EAI_SYSTEM 11" >>confdefs.h ;; #( *freebsd*) : $as_echo "#define TARGET_OS_FREEBSD 1" >>confdefs.h $as_echo "#define __APPLE_CC__ 1" >>confdefs.h ;; #( *solaris*) : $as_echo "#define TARGET_OS_SOLARIS 1" >>confdefs.h ;; #( *darwin*) : TARGET_OSX="true" ;; #( *linux*) : TARGET_LINUX="true" $as_echo "#define TARGET_OS_LINUX 1" >>confdefs.h ;; #( *) : ;; 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 if test "x${TARGET_LINUX}" = "xtrue"; then TARGET_LINUX_TRUE= TARGET_LINUX_FALSE='#' else TARGET_LINUX_TRUE='#' TARGET_LINUX_FALSE= fi if test "x${TARGET_OS_FREEBSD}" = "xtrue"; then TARGET_FREEBSD_TRUE= TARGET_FREEBSD_FALSE='#' else TARGET_FREEBSD_TRUE='#' TARGET_FREEBSD_FALSE= fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts " >&5 $as_echo_n "checking whether the linker accepts ... " >&6; } if ${ax_cv_check_ldflags__+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS " cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_check_ldflags__=yes else ax_cv_check_ldflags__=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__" >&5 $as_echo "$ax_cv_check_ldflags__" >&6; } if test x"$ax_cv_check_ldflags__" = xyes; then : : else : fi if ${CFLAGS+:} false; then : case " $CFLAGS " in *" "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains "; } >&5 (: CFLAGS already contains ) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \""; } >&5 (: CFLAGS="$CFLAGS ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS " ;; esac else CFLAGS="" fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; ax_enable_debug=yes $as_echo "#define DEBUG 1" >>confdefs.h if ${ax_cv_have_MCHECK+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$MCHECK_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $MCHECK_CPPFLAGS" fi if test "x$MCHECK_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $MCHECK_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "mcheck.h" "ac_cv_header_mcheck_h" "$ac_includes_default" if test "x$ac_cv_header_mcheck_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5 $as_echo_n "checking for main in -lmcheck... " >&6; } if ${ac_cv_lib_mcheck_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmcheck $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mcheck_main=yes else ac_cv_lib_mcheck_main=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_mcheck_main" >&5 $as_echo "$ac_cv_lib_mcheck_main" >&6; } if test "x$ac_cv_lib_mcheck_main" = xyes; then : ax_cv_have_MCHECK=yes else ax_cv_have_MCHECK=no fi else ax_cv_have_MCHECK=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_MCHECK" = "yes"; then : $as_echo "#define HAVE_MCHECK 1" >>confdefs.h MCHECK_LIB=-lmcheck for flag in -lmcheck; do as_CACHEVAR=`$as_echo "ax_cv_check_ldflags__$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5 $as_echo_n "checking whether the linker accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${LDFLAGS+:} false; then : case " $LDFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains \$flag"; } >&5 (: LDFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS \$flag\""; } >&5 (: LDFLAGS="$LDFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } LDFLAGS="$LDFLAGS $flag" ;; esac else LDFLAGS="$flag" fi else : fi done else : fi else ax_enable_debug=no $as_echo "#define DEBUG 0" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debug" >&5 $as_echo_n "checking for debug... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_debug" >&5 $as_echo "$ax_enable_debug" >&6; } if test "x${ax_enable_debug}" = "xyes"; then DEBUG_TRUE= DEBUG_FALSE='#' else DEBUG_TRUE='#' DEBUG_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vcs system" >&5 $as_echo_n "checking for vcs system... " >&6; } if ${ac_cv_vcs_system+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_vcs_system="none" if test -d ".bzr"; then : ac_cv_vcs_system="bazaar" fi if test -d ".svn"; then : ac_cv_vcs_system="svn" fi if test -d ".hg"; then : ac_cv_vcs_system="mercurial" fi if test -d ".git"; then : ac_cv_vcs_system="git" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_vcs_system" >&5 $as_echo "$ac_cv_vcs_system" >&6; } cat >>confdefs.h <<_ACEOF #define VCS_SYSTEM "$ac_cv_vcs_system" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vcs checkout" >&5 $as_echo_n "checking for vcs checkout... " >&6; } if ${ac_cv_vcs_checkout+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$ac_cv_vcs_system" != "xnone"; then : ac_cv_vcs_checkout=yes else ac_cv_vcs_checkout=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_vcs_checkout" >&5 $as_echo "$ac_cv_vcs_checkout" >&6; } if test "x$ac_cv_vcs_checkout" = "xyes"; then IS_VCS_CHECKOUT_TRUE= IS_VCS_CHECKOUT_FALSE='#' else IS_VCS_CHECKOUT_TRUE='#' IS_VCS_CHECKOUT_FALSE= fi if test "x$ac_cv_vcs_checkout" = "xyes"; then : $as_echo "#define VCS_CHECKOUT 1" >>confdefs.h else $as_echo "#define VCS_CHECKOUT 0" >>confdefs.h fi # Check whether --enable-assert was given. if test "${enable_assert+set}" = set; then : enableval=$enable_assert; ax_enable_assert=yes else ax_enable_assert=no fi if test "$ax_enable_assert" = "yes" -o "$ax_enable_debug" = "yes" -o "$ac_cv_vcs_checkout" = "yes" ; then : ax_enable_assert="yes" else ax_enable_assert="no" $as_echo "#define NDEBUG 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assert" >&5 $as_echo_n "checking for assert... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_assert" >&5 $as_echo "$ax_enable_assert" >&6; } # First look for Boost, maybe for a specific minimum version: { $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 ${boost_cv_lib_tag+:} false; 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__ == 8 && !defined __ICC @ gcc48" \ "defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ == 7 && !defined __ICC @ gcc47" \ "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 int main () { ; return 0; } _ACEOF 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_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 # Check whether we do better use `mt' even though we weren't ask to. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _REENTRANT || defined _MT || defined __MT__ /* use -mt */ #else # error MT not needed #endif int main () { ; 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 echo "$as_me: this is boost.m4 serial 16" >&5 boost_save_IFS=$IFS boost_version_req=1.39 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 ${boost_cv_inc_path+:} false; 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 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 $as_echo "#define HAVE_BOOST 1" >>confdefs.h { $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 ${boost_cv_lib_version+:} false; 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* 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 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" = xyes; then : $as_echo "#define HAVE_BOOST_PROGRAM_OPTIONS_HPP 1" >>confdefs.h 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 ${boost_cv_lib_program_options+:} false; then : $as_echo_n "(cached) " >&6 else boost_cv_lib_program_options=no case "" in #( mt | mt-) boost_mt=-mt; boost_rtopt=;; #( mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X" : 'Xmt-*\(.*\)'`;; #( *) boost_mt=; boost_rtopt=;; 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 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_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 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_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 HASHKIT_LIBRARY_VERSION=2:0:0 ac_config_files="$ac_config_files libhashkit/hashkitcon.h" ac_config_files="$ac_config_files libhashkit-1.0/configure.h" if false; then INCLUDE_HSIEH_SRC_TRUE= INCLUDE_HSIEH_SRC_FALSE='#' else INCLUDE_HSIEH_SRC_TRUE='#' INCLUDE_HSIEH_SRC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of cstdint" >&5 $as_echo_n "checking for location of cstdint... " >&6; } if ${ac_cv_cxx_cstdint+:} false; 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 CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uint32_t t ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cxx_cstdint_cstdint="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uint32_t t ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cxx_cstdint_tr1_cstdint="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uint32_t t ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cxx_cstdint_boost_cstdint_hpp="" 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" if test -n "$ac_cxx_cstdint_cstdint"; then : ac_cv_cxx_cstdint=$ac_cxx_cstdint_cstdint elif test -n "$ac_cxx_cstdint_tr1_cstdint"; then : ac_cv_cxx_cstdint=$ac_cxx_cstdint_tr1_cstdint elif test -n "$ac_cxx_cstdint_boost_cstdint_hpp"; then : ac_cv_cxx_cstdint=$ac_cxx_cstdint_boost_cstdint_hpp fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_cstdint" >&5 $as_echo "$ac_cv_cxx_cstdint" >&6; } 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 ac_cv_cxx_cstdint="" { $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;} { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_cstdint" >&5 $as_echo "$ac_cv_cxx_cstdint" >&6; } fi cat >>confdefs.h <<_ACEOF #define CSTDINT_H $ac_cv_cxx_cstdint _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of cinttypes" >&5 $as_echo_n "checking for location of cinttypes... " >&6; } if ${ac_cv_cxx_cinttypes+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" 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 int main () { uint32_t foo= UINT32_C(1); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cxx_cinttypes_cinttypes="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Look for tr1/cinttypes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uint32_t foo= UINT32_C(1); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cxx_cinttypes_tr1_cinttypes="" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Look for boost/cinttypes.hpp cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uint32_t foo= UINT32_C(1); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cxx_cinttypes_boost_cinttypes_hpp="" 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" if test -n "$ac_cxx_cinttypes_cinttypes"; then : ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_cinttypes elif test -n "$ac_cxx_cinttypes_tr1_cinttypes"; then : ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_tr1_cinttypes elif test -n "$ac_cxx_cinttypes_boost_cinttypes_hpp"; then : ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_boost_cinttypes_hpp fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_cinttypes" >&5 $as_echo "$ac_cv_cxx_cinttypes" >&6; } 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}: WARNING: Could not find a cinttypes header." >&5 $as_echo "$as_me: WARNING: Could not find a cinttypes header." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_cinttypes" >&5 $as_echo "$ac_cv_cxx_cinttypes" >&6; } fi $as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define CINTTYPES_H $ac_cv_cxx_cinttypes _ACEOF LIBTEST_VERSION=1.0 ac_config_files="$ac_config_files libtest/version.h" # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_mysql.html # =========================================================================== # # SYNOPSIS # # AX_LIB_MYSQL([MINIMUM-VERSION]) # # DESCRIPTION # # This macro provides tests of availability of MySQL client library of # particular version or newer. # # AX_LIB_MYSQL macro takes only one argument which is optional. If there # is no required version passed, then macro does not run version test. # # The --with-mysql option takes one of three possible values: # # no - do not check for MySQL client library # # yes - do check for MySQL library in standard locations (mysql_config # should be in the PATH) # # path - complete path to mysql_config utility, use this option if # mysql_config can't be found in the PATH # # This macro calls: # # AC_SUBST(MYSQL_INCLUDE) # AC_SUBST(MYSQL_CFLAGS) # AC_SUBST(MYSQL_LDFLAGS) # AC_SUBST(MYSQL_VERSION) # # And sets: # # HAVE_MYSQL # # LICENSE # # Copyright (c) 2008 Mateusz Loskot # # 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. This file is offered as-is, without any # warranty. #serial 13 # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_prog_mysqld.html # =========================================================================== # # SYNOPSIS # # AX_PROG_MYSQLD # # DESCRIPTION # # Check for the program 'mysqld' let script continue if exists & works # pops up error message if not. # # Besides checking existence, this macro also set these environment # variables upon completion: # # MYSQLD = which mysqld # # LICENSE # # Copyright (c) 2008 Gleen Salmon # # 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 2 of the License, or (at your # option) any later version. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 6 # This is what autoupdate's m4 run will expand. It fires # the warning (with _au_warn_XXX), outputs it into the # updated configure.ac (with AC_DIAGNOSE), and then outputs # the replacement expansion. # This is an auxiliary macro that is also run when # autoupdate runs m4. It simply calls m4_warning, but # we need a wrapper so that each warning is emitted only # once. We break the quoting in m4_warning's argument in # order to expand this macro's arguments, not AU_DEFUN's. # Finally, this is the expansion that is picked up by # autoconf. It tells the user to run autoupdate, and # then outputs the replacement expansion. We do not care # about autoupdate's warning because that contains # information on what to do *after* running autoupdate. #serial 1 # Extract the first word of "mysqld$EXEEXT", so it can be a program name with args. set dummy mysqld$EXEEXT; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MYSQLD+:} false; then : $as_echo_n "(cached) " >&6 else case $MYSQLD in [\\/]* | ?:[\\/]*) ac_cv_path_MYSQLD="$MYSQLD" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MYSQLD="$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_MYSQLD" && ac_cv_path_MYSQLD="nocommand" ;; esac fi MYSQLD=$ac_cv_path_MYSQLD if test -n "$MYSQLD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYSQLD" >&5 $as_echo "$MYSQLD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$MYSQLD" = nocommand; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: mysqld not found in $PATH" >&5 $as_echo "$as_me: WARNING: mysqld not found in $PATH" >&2;} fi; # Check whether --with-mysql was given. if test "${with_mysql+set}" = set; then : withval=$with_mysql; if test "$withval" = "no"; then want_mysql="no" elif test "$withval" = "yes"; then want_mysql="yes" else want_mysql="yes" MYSQL_CONFIG="$withval" fi else want_mysql="yes" fi MYSQL_INCLUDE="" MYSQL_CFLAGS="" MYSQL_LDFLAGS="" MYSQL_VERSION="" if test "$want_mysql" = "yes"; then if test -z "$MYSQL_CONFIG" ; then for ac_prog in mysql_config mysql_config5 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 ${ac_cv_path_MYSQL_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $MYSQL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_MYSQL_CONFIG="$MYSQL_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MYSQL_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 MYSQL_CONFIG=$ac_cv_path_MYSQL_CONFIG if test -n "$MYSQL_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYSQL_CONFIG" >&5 $as_echo "$MYSQL_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$MYSQL_CONFIG" && break done test -n "$MYSQL_CONFIG" || MYSQL_CONFIG="no" fi if test "$MYSQL_CONFIG" != "no"; then MYSQL_INCLUDE="`$MYSQL_CONFIG --include`" MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`" MYSQL_VERSION=`$MYSQL_CONFIG --version` found_mysql="yes" else found_mysql="no" fi fi mysql_version_req=5.0 if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if MySQL version is >= $mysql_version_req" >&5 $as_echo_n "checking if MySQL version is >= $mysql_version_req... " >&6; } mysql_version_req_major=`expr $mysql_version_req : '\([0-9]*\)'` mysql_version_req_minor=`expr $mysql_version_req : '[0-9]*\.\([0-9]*\)'` mysql_version_req_micro=`expr $mysql_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$mysql_version_req_micro" = "x"; then mysql_version_req_micro="0" fi mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \ \+ $mysql_version_req_minor \* 1000 \ \+ $mysql_version_req_micro` mysql_version_major=`expr $MYSQL_VERSION : '\([0-9]*\)'` mysql_version_minor=`expr $MYSQL_VERSION : '[0-9]*\.\([0-9]*\)'` mysql_version_micro=`expr $MYSQL_VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$mysql_version_micro" = "x"; then mysql_version_micro="0" fi mysql_version_number=`expr $mysql_version_major \* 1000000 \ \+ $mysql_version_minor \* 1000 \ \+ $mysql_version_micro` mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number` if test "$mysql_version_check" = "1"; 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; } fi fi if test "$found_mysql" = "yes" ; then $as_echo "#define HAVE_MYSQL 1" >>confdefs.h fi if test "x${found_mysql}" = "xyes"; then HAVE_LIBMYSQL_TRUE= HAVE_LIBMYSQL_FALSE='#' else HAVE_LIBMYSQL_TRUE='#' HAVE_LIBMYSQL_FALSE= fi if test "x${found_mysql}" = "xyes"; then : $as_echo "#define HAVE_LIBMYSQL_BUILD 1" >>confdefs.h else $as_echo "#define HAVE_LIBMYSQL_BUILD 0" >>confdefs.h fi if test -f "$ac_cv_path_MYSQLD"; then : $as_echo "#define HAVE_MYSQLD_BUILD 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define MYSQLD_BINARY "$ac_cv_path_MYSQLD" _ACEOF else $as_echo "#define HAVE_MYSQLD_BUILD 0" >>confdefs.h $as_echo "#define MYSQLD_BINARY 0" >>confdefs.h fi ac_config_files="$ac_config_files libtest/yatlcon.h" if true; then BUILDING_GEARMAN_TRUE= BUILDING_GEARMAN_FALSE='#' else BUILDING_GEARMAN_TRUE='#' BUILDING_GEARMAN_FALSE= fi if true; then HAVE_LIBGEARMAN_TRUE= HAVE_LIBGEARMAN_FALSE='#' else HAVE_LIBGEARMAN_TRUE='#' HAVE_LIBGEARMAN_FALSE= fi _WITH_LIBGEARMAN_SUPPORT="_WITH_LIBGEARMAN_SUPPORT 0" $as_echo "#define GEARMAND_BINARY \"./gearmand/gearmand\"" >>confdefs.h $as_echo "#define HAVE_LIBGEARMAN 1" >>confdefs.h $as_echo "#define HAVE_GEARMAND_BINARY 1" >>confdefs.h # Check whether --with-curl-prefix was given. if test "${with_curl_prefix+set}" = set; then : withval=$with_curl_prefix; curl_config_prefix="$withval" else curl_config_prefix="" fi # Check whether --with-curl-exec-prefix was given. if test "${with_curl_exec_prefix+set}" = set; then : withval=$with_curl_exec_prefix; curl_config_exec_prefix="$withval" else curl_config_exec_prefix="" fi if test x$CURL_CFLAGS != x -o x$CURL_LIBS != x; then : : if ${ax_cv_have_LIBCURL+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$LIBCURL_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" fi if test "x$LIBCURL_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default" if test "x$ac_cv_header_curl_curl_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcurl" >&5 $as_echo_n "checking for main in -lcurl... " >&6; } if ${ac_cv_lib_curl_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curl_main=yes else ac_cv_lib_curl_main=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_curl_main" >&5 $as_echo "$ac_cv_lib_curl_main" >&6; } if test "x$ac_cv_lib_curl_main" = xyes; then : ax_cv_have_LIBCURL=yes else ax_cv_have_LIBCURL=no fi else ax_cv_have_LIBCURL=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_LIBCURL" = "yes"; then : $as_echo "#define HAVE_LIBCURL 1" >>confdefs.h LIBCURL_LIB=-lcurl : else : fi else if test x$curl_config_exec_prefix != x; then : curl_config_args="$curl_config_args --exec-prefix=$curl_config_exec_prefix" if test x${CURL_CONFIG+set} != xset; then : CURL_CONFIG=$curl_config_exec_prefix/bin/curl-config fi fi if test x$curl_config_prefix != x; then : curl_config_args="$curl_config_args --prefix=$curl_config_prefix" if test x${CURL_CONFIG+set} != xset; then : CURL_CONFIG=$curl_config_prefix/bin/curl-config fi fi for ac_prog in curl-config 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 ${ac_cv_path_CURL_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $CURL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_CURL_CONFIG="$CURL_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_CURL_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 CURL_CONFIG=$ac_cv_path_CURL_CONFIG if test -n "$CURL_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL_CONFIG" >&5 $as_echo "$CURL_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CURL_CONFIG" && break done test -n "$CURL_CONFIG" || CURL_CONFIG="no" if test "$CURL_CONFIG" == "no"; then : : $as_echo "#define HAVE_LIBCURL 0" >>confdefs.h else if test x"" == x; then : CURL_CFLAGS="`$CURL_CONFIG $curl_config_args --cflags`" else CURL_CFLAGS="`$CURL_CONFIG $curl_config_args `" fi if test x"" == x; then : CURL_LIBS="`$CURL_CONFIG $curl_config_args --libs`" else CURL_LIBS="`$CURL_CONFIG $curl_config_args `" fi if test x"7.21.7" != x; then : if test x"'s/^libcurl\ \+//'" != x; then : curl_version="`$CURL_CONFIG $curl_config_args --version | $SED -e 's/^libcurl\ \+//'`" else curl_version="`$CURL_CONFIG $curl_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl ($curl_version) >= 7.21.7" >&5 $as_echo_n "checking for curl ($curl_version) >= 7.21.7... " >&6; } # Used to indicate true or false condition ax_compare_version=false # Convert the two version strings to be compared into a format that # allows a simple string comparison. The end result is that a version # string of the form 1.12.5-r617 will be converted to the form # 0001001200050617. In other words, each number is zero padded to four # digits, and non digits are removed. ax_compare_version_A=`echo "$curl_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/[^0-9]//g'` ax_compare_version_B=`echo "7.21.7" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/[^0-9]//g'` ax_compare_version=`echo "x$ax_compare_version_A x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` if test "$ax_compare_version" = "true" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : if ${ax_cv_have_LIBCURL+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$LIBCURL_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" fi if test "x$LIBCURL_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default" if test "x$ac_cv_header_curl_curl_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcurl" >&5 $as_echo_n "checking for main in -lcurl... " >&6; } if ${ac_cv_lib_curl_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curl_main=yes else ac_cv_lib_curl_main=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_curl_main" >&5 $as_echo "$ac_cv_lib_curl_main" >&6; } if test "x$ac_cv_lib_curl_main" = xyes; then : ax_cv_have_LIBCURL=yes else ax_cv_have_LIBCURL=no fi else ax_cv_have_LIBCURL=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_LIBCURL" = "yes"; then : $as_echo "#define HAVE_LIBCURL 1" >>confdefs.h LIBCURL_LIB=-lcurl : else : fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } : $as_echo "#define HAVE_LIBCURL 0" >>confdefs.h fi else : if ${ax_cv_have_LIBCURL+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$LIBCURL_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" fi if test "x$LIBCURL_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default" if test "x$ac_cv_header_curl_curl_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcurl" >&5 $as_echo_n "checking for main in -lcurl... " >&6; } if ${ac_cv_lib_curl_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curl_main=yes else ac_cv_lib_curl_main=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_curl_main" >&5 $as_echo "$ac_cv_lib_curl_main" >&6; } if test "x$ac_cv_lib_curl_main" = xyes; then : ax_cv_have_LIBCURL=yes else ax_cv_have_LIBCURL=no fi else ax_cv_have_LIBCURL=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_LIBCURL" = "yes"; then : $as_echo "#define HAVE_LIBCURL 1" >>confdefs.h LIBCURL_LIB=-lcurl : else : fi fi fi fi if test "x${ax_cv_have_LIBCURL}" = "xyes"; then HAVE_LIBCURL_TRUE= HAVE_LIBCURL_FALSE='#' else HAVE_LIBCURL_TRUE='#' HAVE_LIBCURL_FALSE= fi if test -z "$DRIZZLED_BINARY"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether drizzled executable path has been provided" >&5 $as_echo_n "checking whether drizzled executable path has been provided... " >&6; } # Check whether --with-drizzled was given. if test "${with_drizzled+set}" = set; then : withval=$with_drizzled; if test "$withval" != yes && test "$withval" != no; then : DRIZZLED_BINARY="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DRIZZLED_BINARY" >&5 $as_echo "$DRIZZLED_BINARY" >&6; } else DRIZZLED_BINARY="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "$withval" != no; then : # Extract the first word of "drizzled", so it can be a program name with args. set dummy drizzled; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DRIZZLED_BINARY+:} false; then : $as_echo_n "(cached) " >&6 else case $DRIZZLED_BINARY in [\\/]* | ?:[\\/]*) ac_cv_path_DRIZZLED_BINARY="$DRIZZLED_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DRIZZLED_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 ;; esac fi DRIZZLED_BINARY=$ac_cv_path_DRIZZLED_BINARY if test -n "$DRIZZLED_BINARY"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DRIZZLED_BINARY" >&5 $as_echo "$DRIZZLED_BINARY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Extract the first word of "drizzled", so it can be a program name with args. set dummy drizzled; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DRIZZLED_BINARY+:} false; then : $as_echo_n "(cached) " >&6 else case $DRIZZLED_BINARY in [\\/]* | ?:[\\/]*) ac_cv_path_DRIZZLED_BINARY="$DRIZZLED_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DRIZZLED_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 ;; esac fi DRIZZLED_BINARY=$ac_cv_path_DRIZZLED_BINARY if test -n "$DRIZZLED_BINARY"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DRIZZLED_BINARY" >&5 $as_echo "$DRIZZLED_BINARY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -f "$ac_cv_path_DRIZZLED_BINARY"; then : $as_echo "#define HAVE_DRIZZLED_BINARY 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define DRIZZLED_BINARY "$ac_cv_path_DRIZZLED_BINARY" _ACEOF else $as_echo "#define HAVE_DRIZZLED_BINARY 0" >>confdefs.h $as_echo "#define DRIZZLED_BINARY 0" >>confdefs.h fi # Check whether --enable-libdrizzle was given. if test "${enable_libdrizzle+set}" = set; then : enableval=$enable_libdrizzle; ac_enable_libdrizzle="$enableval" else ac_enable_libdrizzle="yes" fi if test "x$ac_enable_libdrizzle" = "xyes"; then : if ${ax_cv_have_LIBDRIZZLE+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$LIBDRIZZLE_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $LIBDRIZZLE_CPPFLAGS" fi if test "x$LIBDRIZZLE_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $LIBDRIZZLE_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "libdrizzle-5.1/drizzle_client.h" "ac_cv_header_libdrizzle_5_1_drizzle_client_h" "$ac_includes_default" if test "x$ac_cv_header_libdrizzle_5_1_drizzle_client_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ldrizzle" >&5 $as_echo_n "checking for main in -ldrizzle... " >&6; } if ${ac_cv_lib_drizzle_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldrizzle $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_drizzle_main=yes else ac_cv_lib_drizzle_main=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_drizzle_main" >&5 $as_echo "$ac_cv_lib_drizzle_main" >&6; } if test "x$ac_cv_lib_drizzle_main" = xyes; then : ax_cv_have_LIBDRIZZLE=yes else ax_cv_have_LIBDRIZZLE=no fi else ax_cv_have_LIBDRIZZLE=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_LIBDRIZZLE" = "yes"; then : $as_echo "#define HAVE_LIBDRIZZLE 1" >>confdefs.h LIBDRIZZLE_LIB=-ldrizzle : else $as_echo "#define HAVE_LIBDRIZZLE 0" >>confdefs.h fi else $as_echo "#define HAVE_LIBDRIZZLE 0" >>confdefs.h fi # Check whether --with-sqlite3 was given. if test "${with_sqlite3+set}" = set; then : withval=$with_sqlite3; if test "$withval" = "no"; then WANT_SQLITE3="no" elif test "$withval" = "yes"; then WANT_SQLITE3="yes" ac_sqlite3_path="" else WANT_SQLITE3="yes" ac_sqlite3_path="$withval" fi else WANT_SQLITE3="yes" fi SQLITE3_CFLAGS="" SQLITE3_LDFLAGS="" SQLITE3_VERSION="" if test "x$WANT_SQLITE3" = "xyes"; then ac_sqlite3_header="sqlite3.h" sqlite3_version_req=3.0.0 sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([0-9]*\.[0-9]*\)'` sqlite3_version_req_major=`expr $sqlite3_version_req : '\([0-9]*\)'` sqlite3_version_req_minor=`expr $sqlite3_version_req : '[0-9]*\.\([0-9]*\)'` sqlite3_version_req_micro=`expr $sqlite3_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$sqlite3_version_req_micro" = "x" ; then sqlite3_version_req_micro="0" fi sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ \+ $sqlite3_version_req_minor \* 1000 \ \+ $sqlite3_version_req_micro` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLite3 library >= $sqlite3_version_req" >&5 $as_echo_n "checking for SQLite3 library >= $sqlite3_version_req... " >&6; } if test "$ac_sqlite3_path" != ""; then ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" else for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then ac_sqlite3_path=$ac_sqlite3_path_tmp ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include" ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib" break; fi done fi ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3" saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ac_sqlite3_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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) // Everything is okay #else # error SQLite version is too old #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } success="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } success="no" WANT_SQLITE3="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 CPPFLAGS="$saved_CPPFLAGS" if test "$success" = "yes"; then SQLITE3_CFLAGS="$ac_sqlite3_cppflags" SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" if test "x$ac_sqlite3_header_path" != "x"; then ac_sqlite3_version=`cat $ac_sqlite3_header_path \ | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ | sed -e 's/"//'` if test $ac_sqlite3_version != ""; then SQLITE3_VERSION=$ac_sqlite3_version else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&5 $as_echo "$as_me: WARNING: Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&2;} fi fi $as_echo "#define HAVE_SQLITE3 /**/" >>confdefs.h fi fi if test "x${WANT_SQLITE3}" = "xyes"; then : $as_echo "#define HAVE_LIBSQLITE3 1" >>confdefs.h else $as_echo "#define HAVE_LIBSQLITE3 0" >>confdefs.h fi if test "x${WANT_SQLITE3}" = "xyes"; then HAVE_LIBSQLITE3_TRUE= HAVE_LIBSQLITE3_FALSE='#' else HAVE_LIBSQLITE3_TRUE='#' HAVE_LIBSQLITE3_FALSE= fi # Check whether --enable-dtrace was given. if test "${enable_dtrace+set}" = set; then : enableval=$enable_dtrace; ac_cv_enable_dtrace="$enableval" else ac_cv_enable_dtrace="no" fi if test "$ac_cv_enable_dtrace" = "yes"; then : for ac_prog in dtrace 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 ${ac_cv_prog_DTRACE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DTRACE"; then ac_cv_prog_DTRACE="$DTRACE" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DTRACE="$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 DTRACE=$ac_cv_prog_DTRACE if test -n "$DTRACE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DTRACE" >&5 $as_echo "$DTRACE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DTRACE" && break done 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" = xyes; 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 ${ac_cv_dtrace_works+:} false; 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; } if ${ac_cv_dtrace_needs_objects+:} false; 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 : ac_cv_dtrace_needs_objects=yes else ac_cv_dtrace_needs_objects=no fi 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_dtrace_works" = "xyes"; then HAVE_DTRACE_TRUE= HAVE_DTRACE_FALSE='#' else HAVE_DTRACE_TRUE='#' HAVE_DTRACE_FALSE= fi if test "x$ac_cv_dtrace_needs_objects" = "xyes"; then DTRACE_NEEDS_OBJECTS_TRUE= DTRACE_NEEDS_OBJECTS_FALSE='#' else DTRACE_NEEDS_OBJECTS_TRUE='#' DTRACE_NEEDS_OBJECTS_FALSE= fi # Check whether --with-postgresql was given. if test "${with_postgresql+set}" = set; then : withval=$with_postgresql; if test "$withval" = "no"; then want_postgresql="no" elif test "$withval" = "yes"; then want_postgresql="yes" else want_postgresql="yes" PG_CONFIG="$withval" fi else want_postgresql="yes" fi POSTGRESQL_CFLAGS="" POSTGRESQL_LDFLAGS="" POSTGRESQL_VERSION="" if test "$want_postgresql" = "yes"; then if test -z "$PG_CONFIG" -o test; then # Extract the first word of "pg_config", so it can be a program name with args. set dummy pg_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 ${ac_cv_path_PG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PG_CONFIG="$PG_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PG_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 PG_CONFIG=$ac_cv_path_PG_CONFIG if test -n "$PG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PG_CONFIG" >&5 $as_echo "$PG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test ! -x "$PG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $PG_CONFIG does not exist or it is not an exectuable file" >&5 $as_echo "$as_me: WARNING: $PG_CONFIG does not exist or it is not an exectuable file" >&2;} PG_CONFIG="no" found_postgresql="no" fi if test "$PG_CONFIG" != "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PostgreSQL libraries" >&5 $as_echo_n "checking for PostgreSQL libraries... " >&6; } POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`" POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq" POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'` $as_echo "#define HAVE_POSTGRESQL 1" >>confdefs.h found_postgresql="yes" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else found_postgresql="no" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi postgresql_version_req= if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PostgreSQL version is >= $postgresql_version_req" >&5 $as_echo_n "checking if PostgreSQL version is >= $postgresql_version_req... " >&6; } postgresql_version_req_major=`expr $postgresql_version_req : '\([0-9]*\)'` postgresql_version_req_minor=`expr $postgresql_version_req : '[0-9]*\.\([0-9]*\)'` postgresql_version_req_micro=`expr $postgresql_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$postgresql_version_req_micro" = "x"; then postgresql_version_req_micro="0" fi postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \ \+ $postgresql_version_req_minor \* 1000 \ \+ $postgresql_version_req_micro` postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([0-9]*\)'` postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[0-9]*\.\([0-9]*\)'` postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$postgresql_version_micro" = "x"; then postgresql_version_micro="0" fi postgresql_version_number=`expr $postgresql_version_major \* 1000000 \ \+ $postgresql_version_minor \* 1000 \ \+ $postgresql_version_micro` postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number` if test "$postgresql_version_check" = "1"; 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; } fi fi # Check whether --enable-libpq was given. if test "${enable_libpq+set}" = set; then : enableval=$enable_libpq; ac_cv_libpq="$enableval" else ac_cv_libpq="yes" fi if test "x$ac_cv_libpq" = "xyes" -a "x$found_postgresql" = "xyes"; then : $as_echo "#define HAVE_LIBPQ 1 " >>confdefs.h else $as_echo "#define HAVE_LIBPQ 0 " >>confdefs.h # if --enable-libpq, but no Postgres, force --disable-libpq ac_cv_libpq="no" fi if test "x$ac_cv_libpq" = "xyes"; then HAVE_LIBPQ_TRUE= HAVE_LIBPQ_FALSE='#' else HAVE_LIBPQ_TRUE='#' HAVE_LIBPQ_FALSE= fi # Check whether --enable-libtokyocabinet was given. if test "${enable_libtokyocabinet+set}" = set; then : enableval=$enable_libtokyocabinet; ac_enable_libtokyocabinet="$enableval" else ac_enable_libtokyocabinet="yes" fi if test "x$ac_enable_libtokyocabinet" = "xyes"; then : tokyocabinet_header="tcadb.h" else tokyocabinet_header="does_not_exist" fi if ${ax_cv_have_TOKYOCABINET+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$TOKYOCABINET_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $TOKYOCABINET_CPPFLAGS" fi if test "x$TOKYOCABINET_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $TOKYOCABINET_LDFLAGS" fi as_ac_Header=`$as_echo "ac_cv_header_$tokyocabinet_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$tokyocabinet_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ltokyocabinet" >&5 $as_echo_n "checking for main in -ltokyocabinet... " >&6; } if ${ac_cv_lib_tokyocabinet_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltokyocabinet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tokyocabinet_main=yes else ac_cv_lib_tokyocabinet_main=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_tokyocabinet_main" >&5 $as_echo "$ac_cv_lib_tokyocabinet_main" >&6; } if test "x$ac_cv_lib_tokyocabinet_main" = xyes; then : ax_cv_have_TOKYOCABINET=yes else ax_cv_have_TOKYOCABINET=no fi else ax_cv_have_TOKYOCABINET=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_TOKYOCABINET" = "yes"; then : $as_echo "#define HAVE_TOKYOCABINET 1" >>confdefs.h TOKYOCABINET_LIB=-ltokyocabinet : else $as_echo "#define HAVE_TOKYOCABINET 0" >>confdefs.h fi if test "x$ax_cv_have_TOKYOCABINET" = xno; then : ac_enable_libtokyocabinet="no" fi if test "x${ac_enable_libtokyocabinet}" = "xyes"; then HAVE_TOKYOCABINET_TRUE= HAVE_TOKYOCABINET_FALSE='#' else HAVE_TOKYOCABINET_TRUE='#' HAVE_TOKYOCABINET_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" = xyes; then : ac_have_decl=1 else 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" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $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 ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else 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; ; 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 # 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 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 $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL" >&5 $as_echo_n "checking for MSG_NOSIGNAL... " >&6; } if ${ac_cv_msg_nosignal+:} false; 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 CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" 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_compile "$LINENO"; then : ac_cv_msg_nosignal="yes" 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_nosignal" >&5 $as_echo "$ac_cv_msg_nosignal" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_DONTWAIT" >&5 $as_echo_n "checking for MSG_DONTWAIT... " >&6; } if ${ac_cv_msg_dontwait+:} false; 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 CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" CFLAGS="$CFLAGS -I${srcdir}" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int flags= MSG_DONTWAIT ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_msg_dontwait="yes" 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_dontwait" >&5 $as_echo "$ac_cv_msg_dontwait" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_MORE" >&5 $as_echo_n "checking for MSG_MORE... " >&6; } if ${ac_cv_msg_more+:} false; 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 CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" CFLAGS="$CFLAGS -I${srcdir}" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int flags= MSG_MORE ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_msg_more="yes" 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_more" >&5 $as_echo "$ac_cv_msg_more" >&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 fi if test "x$ac_cv_msg_more" = "xyes"; then : $as_echo "#define HAVE_MSG_MORE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 $as_echo_n "checking for O_CLOEXEC... " >&6; } if ${ac_cv_o_cloexec+:} false; 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= O_CLOEXEC ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_o_cloexec="yes" else ac_cv_o_cloexec="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="$save_CFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_o_cloexec" >&5 $as_echo "$ac_cv_o_cloexec" >&6; } if test "x$ac_cv_o_cloexec" = "xyes"; then : $as_echo "#define HAVE_O_CLOEXEC 1" >>confdefs.h fi # Check whether --enable-hiredis was given. if test "${enable_hiredis+set}" = set; then : enableval=$enable_hiredis; ac_enable_hiredis="$enableval" else ac_enable_hiredis="yes" fi if test "x$ac_enable_hiredis" = "xyes"; then : hiredis_header="hiredis/hiredis.h" else hiredis_header="does_not_exist" fi if ${ax_cv_have_HIREDIS+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$HIREDIS_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $HIREDIS_CPPFLAGS" fi if test "x$HIREDIS_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $HIREDIS_LDFLAGS" fi as_ac_Header=`$as_echo "ac_cv_header_$hiredis_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$hiredis_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lhiredis" >&5 $as_echo_n "checking for main in -lhiredis... " >&6; } if ${ac_cv_lib_hiredis_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhiredis $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hiredis_main=yes else ac_cv_lib_hiredis_main=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_hiredis_main" >&5 $as_echo "$ac_cv_lib_hiredis_main" >&6; } if test "x$ac_cv_lib_hiredis_main" = xyes; then : ax_cv_have_HIREDIS=yes else ax_cv_have_HIREDIS=no fi else ax_cv_have_HIREDIS=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_HIREDIS" = "yes"; then : $as_echo "#define HAVE_HIREDIS 1" >>confdefs.h HIREDIS_LIB=-lhiredis : else $as_echo "#define HAVE_HIREDIS 0" >>confdefs.h fi if test "x$ax_cv_have_HIREDIS" = xno; then : ac_enable_hiredis="no" fi # Checks for programs. for ac_prog in dpkg-gensymbols 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 ${ac_cv_prog_DPKG_GENSYMBOLS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DPKG_GENSYMBOLS"; then ac_cv_prog_DPKG_GENSYMBOLS="$DPKG_GENSYMBOLS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DPKG_GENSYMBOLS="$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 DPKG_GENSYMBOLS=$ac_cv_prog_DPKG_GENSYMBOLS if test -n "$DPKG_GENSYMBOLS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DPKG_GENSYMBOLS" >&5 $as_echo "$DPKG_GENSYMBOLS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DPKG_GENSYMBOLS" && break done for ac_prog in perl 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 ${ac_cv_prog_PERL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PERL"; then ac_cv_prog_PERL="$PERL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PERL="$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 PERL=$ac_cv_prog_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PERL" && break done for ac_prog in 'valgrind' 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 ${ac_cv_prog_VALGRIND+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$VALGRIND"; then ac_cv_prog_VALGRIND="$VALGRIND" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_VALGRIND="$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 VALGRIND=$ac_cv_prog_VALGRIND if test -n "$VALGRIND"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 $as_echo "$VALGRIND" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$VALGRIND" && break done for ac_prog in 'wine' 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 ${ac_cv_prog_WINE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$WINE"; then ac_cv_prog_WINE="$WINE" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_WINE="$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 WINE=$ac_cv_prog_WINE if test -n "$WINE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINE" >&5 $as_echo "$WINE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$WINE" && break done 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 ${ac_cv_prog_AWK+:} false; 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 as_fn_executable_p "$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 test -n "$AWK" && break 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 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 \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # 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 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 if test -z "$MEMCACHED_BINARY"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memcached executable path has been provided" >&5 $as_echo_n "checking whether memcached executable path has been provided... " >&6; } # Check whether --with-memcached was given. if test "${with_memcached+set}" = set; then : withval=$with_memcached; if test "$withval" != yes && test "$withval" != no; then : MEMCACHED_BINARY="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MEMCACHED_BINARY" >&5 $as_echo "$MEMCACHED_BINARY" >&6; } else MEMCACHED_BINARY="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "$withval" != no; then : # Extract the first word of "memcached", so it can be a program name with args. set dummy 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 ${ac_cv_path_MEMCACHED_BINARY+:} false; 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 as_fn_executable_p "$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="unknown" ;; 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 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Extract the first word of "memcached", so it can be a program name with args. set dummy 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 ${ac_cv_path_MEMCACHED_BINARY+:} false; 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 as_fn_executable_p "$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="unknown" ;; 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 fi fi ax_memcached_success= if test x"$MEMCACHED_BINARY" != xunknown; then : if test -x "$MEMCACHED_BINARY"; then : ax_memcached_version=`$MEMCACHED_BINARY -h | sed 1q | awk '{print \$ 2 }' | sed 's|\-a-z0-9*$||' | awk -F. '{printf "%d.%d.%d", $1, $2, $3}'` if test -n "$ax_memcached_version"; then : ax_memcached_success='ok' { $as_echo "$as_me:${as_lineno-$LINENO}: result: memcached version \"$ax_memcached_version\"" >&5 $as_echo "memcached version \"$ax_memcached_version\"" >&6; } cat >>confdefs.h <<_ACEOF #define MEMCACHED_VERSION "$ax_memcached_version" _ACEOF fi fi fi if test -n "$ax_memcached_success"; then : $as_echo "#define HAVE_MEMCACHED_BINARY 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define MEMCACHED_BINARY "$MEMCACHED_BINARY" _ACEOF else $as_echo "#define HAVE_MEMCACHED_BINARY 0" >>confdefs.h MEMCACHED_BINARY= fi if test -z "$SPHINXBUILD"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sphinx-build executable path has been provided" >&5 $as_echo_n "checking whether sphinx-build executable path has been provided... " >&6; } # Check whether --with-sphinx-build was given. if test "${with_sphinx_build+set}" = set; then : withval=$with_sphinx_build; if test "$withval" != yes && test "$withval" != no; then : SPHINXBUILD="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SPHINXBUILD" >&5 $as_echo "$SPHINXBUILD" >&6; } else SPHINXBUILD="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "$withval" != no; then : # Extract the first word of "sphinx-build", so it can be a program name with args. set dummy sphinx-build; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SPHINXBUILD+:} false; then : $as_echo_n "(cached) " >&6 else case $SPHINXBUILD in [\\/]* | ?:[\\/]*) ac_cv_path_SPHINXBUILD="$SPHINXBUILD" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SPHINXBUILD="$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_SPHINXBUILD" && ac_cv_path_SPHINXBUILD=":" ;; esac fi SPHINXBUILD=$ac_cv_path_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 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Extract the first word of "sphinx-build", so it can be a program name with args. set dummy sphinx-build; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SPHINXBUILD+:} false; then : $as_echo_n "(cached) " >&6 else case $SPHINXBUILD in [\\/]* | ?:[\\/]*) ac_cv_path_SPHINXBUILD="$SPHINXBUILD" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SPHINXBUILD="$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_SPHINXBUILD" && ac_cv_path_SPHINXBUILD=":" ;; esac fi SPHINXBUILD=$ac_cv_path_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 fi fi if test x"SPHINXBUILD" = x":"; then : SPHINXBUILD= else if test -x "$SPHINXBUILD"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking to see if $SPHINXBUILD is recent" >&5 $as_echo_n "checking Checking to see if $SPHINXBUILD is recent... " >&6; } junk=`$SPHINXBUILD &> version_file` ax_sphinx_build_version=`head -1 version_file` rm version_file { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SPHINXBUILD is version \"$ax_sphinx_build_version\"" >&5 $as_echo "$SPHINXBUILD is version \"$ax_sphinx_build_version\"" >&6; } $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1 if test $? -eq 0; then : else SPHINXBUILD= fi rm -rf conftest.d fi fi if test -n "${SPHINXBUILD}"; then : : else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sphinx-build version 1.0 or greater is required to build man pages" >&5 $as_echo "$as_me: WARNING: sphinx-build version 1.0 or greater is required to build man pages" >&2;} fi if test -z "$LCOV"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lcov executable path has been provided" >&5 $as_echo_n "checking whether lcov executable path has been provided... " >&6; } # Check whether --with-lcov was given. if test "${with_lcov+set}" = set; then : withval=$with_lcov; if test "$withval" != yes && test "$withval" != no; then : LCOV="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5 $as_echo "$LCOV" >&6; } else LCOV="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "$withval" != no; then : # Extract the first word of "lcov", so it can be a program name with args. set dummy lcov; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LCOV+:} false; then : $as_echo_n "(cached) " >&6 else case $LCOV in [\\/]* | ?:[\\/]*) ac_cv_path_LCOV="$LCOV" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LCOV="$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 LCOV=$ac_cv_path_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 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Extract the first word of "lcov", so it can be a program name with args. set dummy lcov; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LCOV+:} false; then : $as_echo_n "(cached) " >&6 else case $LCOV in [\\/]* | ?:[\\/]*) ac_cv_path_LCOV="$LCOV" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LCOV="$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 LCOV=$ac_cv_path_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 fi fi if test -z "$LCOV_GENHTML"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether genhtml executable path has been provided" >&5 $as_echo_n "checking whether genhtml executable path has been provided... " >&6; } # Check whether --with-genhtml was given. if test "${with_genhtml+set}" = set; then : withval=$with_genhtml; if test "$withval" != yes && test "$withval" != no; then : LCOV_GENHTML="$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV_GENHTML" >&5 $as_echo "$LCOV_GENHTML" >&6; } else LCOV_GENHTML="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "$withval" != no; then : # Extract the first word of "genhtml", so it can be a program name with args. set dummy genhtml; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LCOV_GENHTML+:} false; then : $as_echo_n "(cached) " >&6 else case $LCOV_GENHTML in [\\/]* | ?:[\\/]*) ac_cv_path_LCOV_GENHTML="$LCOV_GENHTML" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LCOV_GENHTML="$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 LCOV_GENHTML=$ac_cv_path_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 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Extract the first word of "genhtml", so it can be a program name with args. set dummy genhtml; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LCOV_GENHTML+:} false; then : $as_echo_n "(cached) " >&6 else case $LCOV_GENHTML in [\\/]* | ?:[\\/]*) ac_cv_path_LCOV_GENHTML="$LCOV_GENHTML" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LCOV_GENHTML="$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 LCOV_GENHTML=$ac_cv_path_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 fi fi # 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 ${ac_cv_header_stdc+:} false; 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 _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 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 { $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 ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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 : 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 $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi for ac_header in $ac_header_list 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 if test "x$ac_cv_header_winsock2_h" = "xyes"; then BUILD_WIN32_WRAPPERS_TRUE= BUILD_WIN32_WRAPPERS_FALSE='#' else BUILD_WIN32_WRAPPERS_TRUE='#' BUILD_WIN32_WRAPPERS_FALSE= fi if test "x$ac_cv_header_winsock2_h" = "xyes"; then : AM_LDFLAGS="$AM_LDFLAGS -lws2_32" AM_CFLAGS="$AM_CFLAGS $NO_WERROR" AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR" fi # Checks for typedefs, structures, and compiler characteristics. ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTRDIFF_T 1 _ACEOF fi { $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 ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* 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 sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *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 sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; 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 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=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_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; 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 _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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 $as_echo_n "checking for working volatile... " >&6; } if ${ac_cv_c_volatile+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $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 ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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 struct s { _Bool s: 1; _Bool t; } s; 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]; /* See body of main program for 'e'. */ 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]; /* 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 () { bool e = &s; *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" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h 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 ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=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_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 ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" case $ac_cv_c_int64_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int64_t $ac_cv_c_int64_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; 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" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi { $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 ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _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 ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # 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 ${ac_cv_lib_error_at_line+:} false; then : $as_echo_n "(cached) " >&6 else 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 ac_cv_lib_error_at_line=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_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 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" = xyes; 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 fi done 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 ${ac_cv_func_fork_works+:} false; 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 () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; 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; } 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 ${ac_cv_func_vfork_works+:} false; 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); } } } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; 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 () { /* 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_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else 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 fi { $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 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" = xyes; then : ac_have_decl=1 else 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" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $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 ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else 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; ; 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 # 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 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 $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done # 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 ${ac_cv_working_alloca_h+:} false; 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 ${ac_cv_func_alloca_works+:} false; 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 */ void *alloca (size_t); # endif # endif # endif # endif #endif 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_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 $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 { $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 ${ac_cv_os_cray+:} false; 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* 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 : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $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 ${ac_cv_c_stack_direction+:} false; 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 (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 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 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 $as_echo_n "checking for mbstate_t... " >&6; } if ${ac_cv_type_mbstate_t+:} false; 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 $as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h else $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 ${ac_cv_func_fnmatch_works+:} false; 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 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" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETENV $ac_have_decl _ACEOF 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 fi done 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 fi 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 fi for ac_func in accept4 do : ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4" if test "x$ac_cv_func_accept4" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ACCEPT4 1 _ACEOF fi done for ac_func in dup2 do : ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" if test "x$ac_cv_func_dup2" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DUP2 1 _ACEOF fi done for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF fi done for ac_func in memchr do : ac_fn_c_check_func "$LINENO" "memchr" "ac_cv_func_memchr" if test "x$ac_cv_func_memchr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMCHR 1 _ACEOF fi done for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" if test "x$ac_cv_func_memmove" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF fi done for ac_func in memset do : ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" if test "x$ac_cv_func_memset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMSET 1 _ACEOF fi done for ac_func in pipe do : ac_fn_c_check_func "$LINENO" "pipe" "ac_cv_func_pipe" if test "x$ac_cv_func_pipe" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PIPE 1 _ACEOF fi done for ac_func in pipe2 do : ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" if test "x$ac_cv_func_pipe2" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PIPE2 1 _ACEOF fi done for ac_func in select do : ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SELECT 1 _ACEOF fi done for ac_func in setenv do : ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" if test "x$ac_cv_func_setenv" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETENV 1 _ACEOF fi done for ac_func in socket do : ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SOCKET 1 _ACEOF fi done for ac_func in strcasecmp do : ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" if test "x$ac_cv_func_strcasecmp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRCASECMP 1 _ACEOF fi done for ac_func in strdup do : ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" if test "x$ac_cv_func_strdup" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRDUP 1 _ACEOF fi done for ac_func in strerror do : ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR 1 _ACEOF fi done for ac_func in strncasecmp do : ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" if test "x$ac_cv_func_strncasecmp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRNCASECMP 1 _ACEOF fi done for ac_func in strtol do : ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" if test "x$ac_cv_func_strtol" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOL 1 _ACEOF fi done for ac_func in strtoul do : ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" if test "x$ac_cv_func_strtoul" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOUL 1 _ACEOF fi done for ac_func in uname do : ac_fn_c_check_func "$LINENO" "uname" "ac_cv_func_uname" if test "x$ac_cv_func_uname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNAME 1 _ACEOF fi done for ac_func in atexit do : ac_fn_c_check_func "$LINENO" "atexit" "ac_cv_func_atexit" if test "x$ac_cv_func_atexit" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ATEXIT 1 _ACEOF fi done for ac_func in clock_gettime do : ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" if test "x$ac_cv_func_clock_gettime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CLOCK_GETTIME 1 _ACEOF fi done for ac_func in getcwd do : ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" if test "x$ac_cv_func_getcwd" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETCWD 1 _ACEOF fi done for ac_func in strstr do : ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" if test "x$ac_cv_func_strstr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRSTR 1 _ACEOF fi done ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" if test "x$ac_cv_func_setsockopt" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 $as_echo_n "checking for setsockopt in -lsocket... " >&6; } if ${ac_cv_lib_socket_setsockopt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $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 setsockopt (); int main () { return setsockopt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_setsockopt=yes else ac_cv_lib_socket_setsockopt=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_socket_setsockopt" >&5 $as_echo "$ac_cv_lib_socket_setsockopt" >&6; } if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi fi ac_fn_c_check_func "$LINENO" "bind" "ac_cv_func_bind" if test "x$ac_cv_func_bind" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bind in -lbind" >&5 $as_echo_n "checking for bind in -lbind... " >&6; } if ${ac_cv_lib_bind_bind+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $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 bind (); int main () { return bind (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bind_bind=yes else ac_cv_lib_bind_bind=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_bind_bind" >&5 $as_echo "$ac_cv_lib_bind_bind" >&6; } if test "x$ac_cv_lib_bind_bind" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBBIND 1 _ACEOF LIBS="-lbind $LIBS" fi fi # Check for the ability to call dlopen (used in libhostile) if test "x$enable_shared" = xyes; then : if ${ax_cv_have_DL+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$DL_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $DL_CPPFLAGS" fi if test "x$DL_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $DL_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" if test "x$ac_cv_header_dlfcn_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ldl" >&5 $as_echo_n "checking for main in -ldl... " >&6; } if ${ac_cv_lib_dl_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_main=yes else ac_cv_lib_dl_main=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_dl_main" >&5 $as_echo "$ac_cv_lib_dl_main" >&6; } if test "x$ac_cv_lib_dl_main" = xyes; then : ax_cv_have_DL=yes else ax_cv_have_DL=no fi else ax_cv_have_DL=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_DL" = "yes"; then : $as_echo "#define HAVE_DL 1" >>confdefs.h DL_LIB=-ldl $as_echo "#define HAVE_LIBDL 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dladdr in -ldl" >&5 $as_echo_n "checking for dladdr in -ldl... " >&6; } if ${ac_cv_lib_dl_dladdr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $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 dladdr (); int main () { return dladdr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dladdr=yes else ac_cv_lib_dl_dladdr=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_dl_dladdr" >&5 $as_echo "$ac_cv_lib_dl_dladdr" >&6; } if test "x$ac_cv_lib_dl_dladdr" = xyes; then : $as_echo "#define HAVE_DLADDR 1" >>confdefs.h fi else : fi fi # Check for -lrt { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 $as_echo_n "checking for clock_gettime in -lrt... " >&6; } if ${ac_cv_lib_rt_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $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 clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_rt_clock_gettime=yes else ac_cv_lib_rt_clock_gettime=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_rt_clock_gettime" >&5 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : RT_LIB=-lrt $as_echo "#define HAVE_LIBRT 1" >>confdefs.h fi # Check for -lm LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 $as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmw $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 _mwvalidcheckl (); int main () { return _mwvalidcheckl (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mw__mwvalidcheckl=yes else ac_cv_lib_mw__mwvalidcheckl=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_mw__mwvalidcheckl" >&5 $as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : LIBM="-lmw" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $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 cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=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_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : LIBM="$LIBM -lm" fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 $as_echo_n "checking for cos in -lm... " >&6; } if ${ac_cv_lib_m_cos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $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 cos (); int main () { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_cos=yes else ac_cv_lib_m_cos=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_m_cos" >&5 $as_echo "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes; then : LIBM="-lm" fi ;; esac # Check for CyaSSL if ${ax_cv_have_CYASSL+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" if test "x$CYASSL_CPPFLAGS" != "x"; then : CPPFLAGS="$CPPFLAGS $CYASSL_CPPFLAGS" fi if test "x$CYASSL_LDFLAGS" != "x"; then : LDFLAGS="$LDFLAGS $CYASSL_LDFLAGS" fi ac_fn_c_check_header_mongrel "$LINENO" "cyassl/ssl.h" "ac_cv_header_cyassl_ssl_h" "$ac_includes_default" if test "x$ac_cv_header_cyassl_ssl_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcyassl" >&5 $as_echo_n "checking for main in -lcyassl... " >&6; } if ${ac_cv_lib_cyassl_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcyassl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_cyassl_main=yes else ac_cv_lib_cyassl_main=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_cyassl_main" >&5 $as_echo "$ac_cv_lib_cyassl_main" >&6; } if test "x$ac_cv_lib_cyassl_main" = xyes; then : ax_cv_have_CYASSL=yes else ax_cv_have_CYASSL=no fi else ax_cv_have_CYASSL=no fi CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi if test "$ax_cv_have_CYASSL" = "yes"; then : $as_echo "#define HAVE_CYASSL 1" >>confdefs.h CYASSL_LIB=-lcyassl : else : fi ac_fn_c_check_header_mongrel "$LINENO" "libmemcached-1.0/memcached.h" "ac_cv_header_libmemcached_1_0_memcached_h" "$ac_includes_default" if test "x$ac_cv_header_libmemcached_1_0_memcached_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking check for -lmemcached" >&5 $as_echo_n "checking check for -lmemcached... " >&6; } if ${ax_cv_libmemcached+:} false; 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 CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" LIBS="-lmemcached $LIBS" if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test program execution failed" >&5 $as_echo "$as_me: WARNING: test program execution failed" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { memcached_st *memc; memc= memcached(NULL, 0); memcached_free(memc); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_libmemcached=yes else ax_cv_libmemcached=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_libmemcached" >&5 $as_echo "$ax_cv_libmemcached" >&6; } fi if test "x$ax_cv_libmemcached" = "xyes"; then : $as_echo "#define HAVE_LIBMEMCACHED_MEMCACHED_H 1" >>confdefs.h else $as_echo "#define HAVE_LIBMEMCACHED_MEMCACHED_H 0" >>confdefs.h fi if test "$ax_cv_libmemcached" = yes; then : ac_fn_c_check_header_mongrel "$LINENO" "libmemcachedutil-1.0/util.h" "ac_cv_header_libmemcachedutil_1_0_util_h" "$ac_includes_default" if test "x$ac_cv_header_libmemcachedutil_1_0_util_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking check for -lmemcachedutil" >&5 $as_echo_n "checking check for -lmemcachedutil... " >&6; } if ${ax_cv_libmemcached_util+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" 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="-lmemcachedutil -lmemcached $LIBS" if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test program execution failed" >&5 $as_echo "$as_me: WARNING: test program execution failed" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { memcached_pool_st *memc_pool= memcached_pool_create(NULL, 0, 3); memcached_pool_destroy(memc_pool); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_libmemcached_util=yes else ax_cv_libmemcached_util=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_libmemcached_util" >&5 $as_echo "$ax_cv_libmemcached_util" >&6; } fi fi if test "x$ax_cv_libmemcached_util" = "xyes"; then : $as_echo "#define HAVE_LIBMEMCACHED_UTIL_H 1" >>confdefs.h else $as_echo "#define HAVE_LIBMEMCACHED_UTIL_H 0" >>confdefs.h fi # Check whether --enable-libmemcached was given. if test "${enable_libmemcached+set}" = set; then : enableval=$enable_libmemcached; ax_enable_libmemcached="$enableval" else ax_enable_libmemcached="yes" fi if test "x$ax_cv_libmemcached" != "xyes"; then : ax_enable_libmemcached="not found" fi if test "x$ax_enable_libmemcached" = "xyes"; then : $as_echo "#define HAVE_LIBMEMCACHED 1" >>confdefs.h LIBMEMCACHED_CFLAGS= LIBMEMCACHED_LIB="-lmemcached" if test "x$ax_cv_libmemcached_util" = "xyes"; then : LIBMEMCACHED_UTIL_LIB="-lmemcached -lmemcachedutil" fi else $as_echo "#define HAVE_LIBMEMCACHED 0" >>confdefs.h fi if test "x${ax_enable_libmemcached}" = "xyes"; then HAVE_LIBMEMCACHED_TRUE= HAVE_LIBMEMCACHED_FALSE='#' else HAVE_LIBMEMCACHED_TRUE='#' HAVE_LIBMEMCACHED_FALSE= fi $as_echo "#define GEARMAND_BLOBSLAP_WORKER 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking test for a working libevent" >&5 $as_echo_n "checking test for a working libevent... " >&6; } if ${ax_cv_libevent+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" LIBS="-levent $LIBS" 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 "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test program execution failed" >&5 $as_echo "$as_me: WARNING: test program execution failed" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { struct event_base *tmp_event= event_init(); event_base_free(tmp_event); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_libevent=yes else ax_cv_libevent=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_libevent" >&5 $as_echo "$ax_cv_libevent" >&6; } if test "x$ax_cv_libevent" = "xyes"; then : LIBEVENT_LIB=-levent $as_echo "#define HAVE_LIBEVENT 1" >>confdefs.h else $as_echo "#define HAVE_LIBEVENT 0" >>confdefs.h fi if test "x$ax_cv_libevent" = "xyes"; then HAVE_LIBEVENT_TRUE= HAVE_LIBEVENT_FALSE='#' else HAVE_LIBEVENT_TRUE='#' HAVE_LIBEVENT_FALSE= fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_cv_libevent" = xyes; then : else as_fn_error $? "Unable to find libevent" "$LINENO" 5 fi ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default" if test "x$ac_cv_header_uuid_uuid_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking check to see if -luuid is needed" >&5 $as_echo_n "checking check to see if -luuid is needed... " >&6; } if ${ax_cv_libuuid_is_required+:} false; 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 if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test program execution failed" >&5 $as_echo "$as_me: WARNING: test program execution failed" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uuid_t out; uuid_generate(out); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_libuuid_is_required=no else ax_cv_libuuid_is_required=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_libuuid_is_required" >&5 $as_echo "$ax_cv_libuuid_is_required" >&6; } if test "$ax_cv_libuuid_is_required" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking check to see if -luuid is needed" >&5 $as_echo_n "checking check to see if -luuid is needed... " >&6; } if ${ax_cv_libuuid_works+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" LIBS="-luuid $LIBS" 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 "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test program execution failed" >&5 $as_echo "$as_me: WARNING: test program execution failed" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uuid_t out; uuid_generate(out); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_libuuid_works=yes else ax_cv_libuuid_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 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_libuuid_works" >&5 $as_echo "$ax_cv_libuuid_works" >&6; } fi if test "$ax_cv_libuuid_is_required" = yes; then : if test "$ax_cv_libuuid_works" = yes; then : ax_libuuid=yes fi else ax_libuuid=yes fi else ax_libuuid=no fi if test "x$ax_libuuid" = xyes; then : $as_echo "#define HAVE_UUID_UUID_H 1" >>confdefs.h if test "x$ax_cv_libuuid_is_required" = xyes; then : LIBUUID_LIB='-luuid' fi else $as_echo "#define HAVE_UUID_UUID_H 0" >>confdefs.h fi if test "x$ax_libuuid" = xyes; then HAVE_LIBUUID_TRUE= HAVE_LIBUUID_FALSE='#' else HAVE_LIBUUID_TRUE='#' HAVE_LIBUUID_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time_safe" >&5 $as_echo_n "checking for uuid_generate_time_safe... " >&6; } if ${ax_cv_uuid_generate_time_safe+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" LIBS="$LIBUUID_LIB $LIBS" 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 "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test program execution failed" >&5 $as_echo "$as_me: WARNING: test program execution failed" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { uuid_t out; uuid_generate_time_safe(out); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ax_cv_uuid_generate_time_safe=yes else ax_cv_uuid_generate_time_safe=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_uuid_generate_time_safe" >&5 $as_echo "$ax_cv_uuid_generate_time_safe" >&6; } if test "$ax_cv_uuid_generate_time_safe" = yes; then : $as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h else $as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 0" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 $as_echo_n "checking the number of available CPUs... " >&6; } CPU_COUNT="0" case $host_os in #( *darwin*) : if test -x /usr/sbin/sysctl; then : sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu` if test sysctl_a; then : CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu` fi fi ;; #( *linux*) : if test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo; then : if test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo; then : CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo` fi fi ;; #( *) : ;; esac if test "x$CPU_COUNT" = "x0"; then : CPU_COUNT="1" { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1) " >&5 $as_echo "unable to detect (assuming 1) " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT " >&5 $as_echo "$CPU_COUNT " >&6; } fi AX_DOLLAR="\$" AX_SRB="\\135" AX_SLB="\\133" AX_BS="\\\\" AX_DQ="\"" { $as_echo "$as_me:${as_lineno-$LINENO}: adding automake macro support" >&5 $as_echo "$as_me: adding automake macro support" >&6;} AMINCLUDE="aminclude.am" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $AMINCLUDE" >&5 $as_echo "$as_me: creating $AMINCLUDE" >&6;} AMINCLUDE_TIME=`date` printf " # generated automatically by configure from AX_AUTOMAKE_MACROS # on $AMINCLUDE_TIME " > "$AMINCLUDE" INC_AMINCLUDE="include \$(top_builddir)/$AMINCLUDE" # Check whether --enable-jobserver was given. if test "${enable_jobserver+set}" = set; then : enableval=$enable_jobserver; else enable_jobserver=yes fi if test "x$enable_jobserver" = "xyes"; then enable_jobserver=$CPU_COUNT ((enable_jobserver++)) fi if test "x$enable_jobserver" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: added jobserver support to make for $enable_jobserver jobs" >&5 $as_echo "$as_me: added jobserver support to make for $enable_jobserver jobs" >&6;} printf "AM_MAKEFLAGS += -j$enable_jobserver " >> "$AMINCLUDE" fi if test "x${TARGET_LINUX}" = "xtrue"; then : $as_echo "#define BUILD_LIBHOSTILE 1" >>confdefs.h else $as_echo "#define BUILD_LIBHOSTILE 0" >>confdefs.h fi if test "x${TARGET_LINUX}" = "xtrue"; then TARGET_HOSTILE_TRUE= TARGET_HOSTILE_FALSE='#' else TARGET_HOSTILE_TRUE='#' TARGET_HOSTILE_FALSE= 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 ax_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 () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_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: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" 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). # 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. ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # 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_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: ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; darwin12*) ax_pthread_flags="$ax_pthread_flags" ;; darwin*) ax_pthread_flags="-pthread $ax_pthread_flags" ;; esac if test x"$ax_pthread_ok" = xno; then for flag in $ax_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" ;; 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 ${ac_cv_prog_ax_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ax_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 test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 $as_echo "$ax_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$ax_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 static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; } int main () { pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_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: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_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 int main () { int attr = $attr; return attr /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : attr_name=$attr; break 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 { $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_os} in aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; osf* | hpux*) flag="-D_REENTRANT";; solaris*) if test "$GCC" = "yes"; then flag="-D_REENTRANT" else flag="-mt -D_REENTRANT" fi ;; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 $as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int i = PTHREAD_PRIO_INHERIT; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_PTHREAD_PRIO_INHERIT=yes else ax_cv_PTHREAD_PRIO_INHERIT=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: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 $as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : $as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h 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 ${ac_cv_prog_PTHREAD_CC+:} false; 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 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 as_fn_executable_p "$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 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 test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$ax_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else ax_pthread_ok=no as_fn_error $? "could not find libpthread" "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking check for pthread_timedjoin_np" >&5 $as_echo_n "checking check for pthread_timedjoin_np... " >&6; } if ${ax_cv_pthread_timedjoin_np+:} false; then : $as_echo_n "(cached) " >&6 else CPPFLAGS_save="${CPPFLAGS}" CFLAGS_save="${CFLAGS}" CXXFLAGS_save="${CXXFLAGS}" OBJCFLAGS_save="${OBJCFLAGS}" LDFLAGS_save="${LDFLAGS}" LIBS_save="${LIBS}" CFLAGS="$PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS" 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { pthread_t thread; pthread_timedjoin_np(thread, NULL, NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ax_cv_pthread_timedjoin_np=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext 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 CPPFLAGS="${CPPFLAGS_save}" CFLAGS="${CFLAGS_save}" CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS="${OBJCFLAGS_save}" LDFLAGS="${LDFLAGS_save}" LIBS="${LIBS_save}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_pthread_timedjoin_np" >&5 $as_echo "$ax_cv_pthread_timedjoin_np" >&6; } if test "$ax_cv_pthread_timedjoin_np" = yes; then : $as_echo "#define HAVE_PTHREAD_TIMEDJOIN_NP 1" >>confdefs.h else $as_echo "#define HAVE_PTHREAD_TIMEDJOIN_NP 0" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no 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 if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no 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 if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=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_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h $as_echo "#define ENDIAN_BIG 1" >>confdefs.h $as_echo "#define ENDIAN_LITTLE 0" >>confdefs.h ;; #( no) ;; #( universal) as_fn_error $? "unable to determine endian" "$LINENO" 5 ;; #( *) $as_echo "#define WORDS_BIGENDIAN 0" >>confdefs.h $as_echo "#define ENDIAN_BIG 0" >>confdefs.h $as_echo "#define ENDIAN_LITTLE 1" >>confdefs.h ;; esac string_version_LIBGEARMAN=`echo $VERSION | sed 's|\-a-z0-9*$||' | awk -F. '{printf "%d.%d.%d", $1, $2, $3}'` hex_version_LIBGEARMAN=`echo $VERSION | sed 's|\-a-z0-9*$||' | awk -F. '{printf "0x%0.2d%0.3d%0.3d", $1, $2, $3}'` LIBGEARMAN_VERSION_STRING="$string_version_LIBGEARMAN" LIBGEARMAN_VERSION_HEX="$hex_version_LIBGEARMAN" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if all warnings into errors" >&5 $as_echo_n "checking if all warnings into errors... " >&6; } if ${ac_cv_warnings_as_errors+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$ac_cv_vcs_checkout" = xyes; then : ac_cv_warnings_as_errors=yes else ac_cv_warnings_as_errors=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_warnings_as_errors" >&5 $as_echo "$ac_cv_warnings_as_errors" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler vendor" >&5 $as_echo_n "checking for C compiler vendor... " >&6; } if ${ax_cv_c_compiler_vendor+:} false; then : $as_echo_n "(cached) " >&6 else # note: don't check for gcc first since some other compilers define __GNUC__ vendors="intel: __ICC,__ECC,__INTEL_COMPILER ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale: __PATHCC__,__PATHSCALE__ clang: __clang__ gnu: __GNUC__ sun: __SUNPRO_C,__SUNPRO_CC hp: __HP_cc,__HP_aCC dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland: __BORLANDC__,__TURBOC__ comeau: __COMO__ cray: _CRAYC kai: __KCC lcc: __LCC__ sgi: __sgi,sgi microsoft: _MSC_VER metrowerks: __MWERKS__ watcom: __WATCOMC__ portland: __PGI unknown: UNKNOWN" for ventest in $vendors; do case $ventest in *:) vendor=$ventest; continue ;; *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #if !($vencpp) thisisanerror; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done ax_cv_c_compiler_vendor=`echo $vendor | cut -d: -f1` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_vendor" >&5 $as_echo "$ax_cv_c_compiler_vendor" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking C Compiler version" >&5 $as_echo_n "checking C Compiler version... " >&6; } case "$ax_cv_c_compiler_vendor" in #( sun) : ax_c_compiler_version=`$CC -V 2>&1 | sed 1q` ;; #( intel) : ax_c_compiler_version=`$CC --version 2>&1 | sed 1q` ;; #( clang) : ax_c_compiler_version=`$CC --version 2>&1 | sed 1q` ;; #( gnu) : ax_c_compiler_version=`$CC --version | sed 1q` ;; #( mingw) : ax_c_compiler_version=`$CC --version | sed 1q` ;; #( *) : ax_c_compiler_version="unknown: $ax_cv_c_compiler_vendor" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$ax_c_compiler_version\"" >&5 $as_echo "\"$ax_c_compiler_version\"" >&6; } CC_VERSION_VENDOR="$ax_cv_c_compiler_vendor" CC_VERSION="$ax_c_compiler_version" { $as_echo "$as_me:${as_lineno-$LINENO}: checking C++ Compiler version" >&5 $as_echo_n "checking C++ Compiler version... " >&6; } case "$ax_cv_c_compiler_vendor" in #( sun) : ax_cxx_compiler_version=`$CXX -V 2>&1 | sed 1q` ;; #( intel) : ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q` ;; #( clang) : ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q` ;; #( gnu) : ax_cxx_compiler_version=`$CXX --version | sed 1q` ;; #( mingw) : ax_cxx_compiler_version=`$CXX --version | sed 1q` ;; #( *) : ax_cxx_compiler_version="unknown: $ax_cv_c_compiler_vendor" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$ax_cxx_compiler_version\"" >&5 $as_echo "\"$ax_cxx_compiler_version\"" >&6; } CXX_VERSION_VENDOR="$ax_cv_c_compiler_vendor" CXX_VERSION="$ax_cxx_compiler_version" { $as_echo "$as_me:${as_lineno-$LINENO}: checking MINGW" >&5 $as_echo_n "checking MINGW... " >&6; } ac_fn_c_check_decl "$LINENO" "__MINGW32__" "ac_cv_have_decl___MINGW32__" "$ac_includes_default" if test "x$ac_cv_have_decl___MINGW32__" = xyes; then : MINGW=yes ax_c_compiler_version_vendor=mingw else MINGW=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MINGW" >&5 $as_echo "$MINGW" >&6; } if test "x$GCC" = xyes; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 7)) # error GCC is Too Old! #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_c_gcc_recent=yes else ac_c_gcc_recent=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 $as_echo_n "checking whether the -Werror option is usable... " >&6; } if ${gl_cv_cc_vis_werror+:} false; then : $as_echo_n "(cached) " >&6 else gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_cc_vis_werror=yes else gl_cv_cc_vis_werror=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_vis_werror" >&5 $as_echo "$gl_cv_cc_vis_werror" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 $as_echo_n "checking for simple visibility declarations... " >&6; } if ${gl_cv_cc_visibility+:} false; then : $as_echo_n "(cached) " >&6 else gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" if test $gl_cv_cc_vis_werror = yes; then CFLAGS="$CFLAGS -Werror" fi 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); void dummyfunc (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 cat >>confdefs.h <<_ACEOF #define HAVE_VISIBILITY $HAVE_VISIBILITY _ACEOF if test "$CC" != "clang"; then : for flag in -z relro -z now; do as_CACHEVAR=`$as_echo "ax_cv_check_ldflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5 $as_echo_n "checking whether the linker accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${LDFLAGS+:} false; then : case " $LDFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains \$flag"; } >&5 (: LDFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS \$flag\""; } >&5 (: LDFLAGS="$LDFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } LDFLAGS="$LDFLAGS $flag" ;; esac else LDFLAGS="$flag" fi else : fi done if test "x$ac_cv_warnings_as_errors" = xyes; then : for flag in -Werror; do as_CACHEVAR=`$as_echo "ax_cv_check_ldflags__$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5 $as_echo_n "checking whether the linker accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${LDFLAGS+:} false; then : case " $LDFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains \$flag"; } >&5 (: LDFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS \$flag\""; } >&5 (: LDFLAGS="$LDFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } LDFLAGS="$LDFLAGS $flag" ;; esac else LDFLAGS="$flag" fi else : fi done fi if test "x$ac_cv_vcs_checkout" = xyes; then : for flag in -rdynamic; do as_CACHEVAR=`$as_echo "ax_cv_check_ldflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5 $as_echo_n "checking whether the linker accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${LDFLAGS+:} false; then : case " $LDFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains \$flag"; } >&5 (: LDFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS \$flag\""; } >&5 (: LDFLAGS="$LDFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } LDFLAGS="$LDFLAGS $flag" ;; esac else LDFLAGS="$flag" fi else : fi done fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts " >&5 $as_echo_n "checking whether C compiler accepts ... " >&6; } if ${ax_cv_check_cflags__+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS " cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags__=yes else ax_cv_check_cflags__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__" >&5 $as_echo "$ax_cv_check_cflags__" >&6; } if test x"$ax_cv_check_cflags__" = xyes; then : : else : fi for flag in ; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : 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 if test "x$ax_enable_debug" = xyes; then : CFLAGS='' for flag in -H; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -ggdb; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -g; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -O0; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done , for flag in -fno-omit-frame-pointer; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done else for flag in -g; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -O2; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi if test "x$ac_cv_vcs_checkout" = xyes; then : for flag in -fstack-check; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wpragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunknown-pragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done else for flag in -Wno-unknown-pragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wno-pragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi if test "$CC" = "clang"; then : for flag in -Qunused-arguments; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi for flag in -Wall; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wextra; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Weverything; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wthis-test-should-fail; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done # Anything below this comment please keep sorted. # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) for flag in -Wunsuffixed-float-constants; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wjump-misses-init; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wno-attributes; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Waddress; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wvarargs; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Warray-bounds; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wbad-function-cast; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done # Not in use -Wc++-compat for flag in -Wchar-subscripts; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wcomment; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wfloat-equal; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wformat-security; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wformat=2; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wformat-y2k; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wlogical-op; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wmaybe-uninitialized; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wmissing-field-initializers; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done if test "x$MINGW" = xyes; then : for flag in -Wno-missing-noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done else for flag in -Wmissing-noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi for flag in -Wmissing-prototypes; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wnested-externs; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wnormalized=id; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Woverride-init; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wpointer-arith; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wpointer-sign; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done if test "x$MINGW" = xyes; then : for flag in -Wno-suggest-attribute=const; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wno-suggest-attribute=noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wno-suggest-attribute=pure; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wno-redundant-decls; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done else for flag in -Wredundant-decls; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi for flag in -Wshadow; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wshorten-64-to-32; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wsign-compare; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wstrict-overflow=1; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wstrict-prototypes; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wswitch-enum; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wtrampolines; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wundef; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunsafe-loop-optimizations; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -funsafe-loop-optimizations; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done if test "x$MINGW" != xyes; then : if test "x$ac_cv_vcs_checkout" = xyes; then : if test "x$enable_shared" = "xyes"; then : for flag in -fno-omit-frame-pointer; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=address; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=integer; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=thread; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=memory; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=alignment; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=bool; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=bounds; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=enum; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=float-cast-overflow; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=float-divide-by-zero; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=integer-divide-by-zero; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=null; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=object-size; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=return; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=shift; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=signed-integer-overflow; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=unreachable; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=unsigned-integer-overflow; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=vla-bound; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fsanitize=vptr; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi fi fi for flag in -Wclobbered; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunused; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunused-result; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunused-variable; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunused-parameter; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wunused-local-typedefs; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wwrite-strings; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -floop-parallelize-all; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fwrapv; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fmudflapt; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -pipe; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -fPIE -pie; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wsizeof-pointer-memaccess; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done for flag in -Wpacked; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) for flag in -Wunreachable-code; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done if test "x$ax_enable_debug" = xno; then : if test "x$ac_cv_vcs_checkout" = xyes; then : if test "x${target_os}" != "xmingw"; then : if test "x$ac_c_gcc_recent" = xyes; then : for flag in -D_FORTIFY_SOURCE=2; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector --param=ssp-buffer-size=4]) for flag in -fstack-protector-all; do as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 $as_echo_n "checking whether C compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 (: CFLAGS="$CFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $flag" ;; esac else CFLAGS="$flag" fi else : fi done fi fi fi fi if test "x$ac_cv_warnings_as_errors" = xyes; then : if ${CFLAGS+:} false; then : case " $CFLAGS " in *" -Werror "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains -Werror"; } >&5 (: CFLAGS already contains -Werror) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS -Werror\""; } >&5 (: CFLAGS="$CFLAGS -Werror") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS -Werror" ;; esac else CFLAGS="-Werror" 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 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$ax_enable_debug" = xyes; then : CXXFLAGS='' for flag in -H; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -ggdb; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -g; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -O0; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done , for flag in -fno-omit-frame-pointer; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done else for flag in -g; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -O2; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done fi if test "x$ac_cv_vcs_checkout" = xyes; then : for flag in -fstack-check; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wpragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunknown-pragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done else for flag in -Wno-unknown-pragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wno-pragmas; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done fi if test "$CXX" = "clang++"; then : for flag in -Qunused-arguments; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done fi for flag in -Wall; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wextra; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Weverything; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wthis-test-should-fail; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done # Anything below this comment please keep sorted. # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) for flag in -Wno-attributes; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wvarargs; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Waddress; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Warray-bounds; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wchar-subscripts; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wcomment; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wctor-dtor-privacy; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wfloat-equal; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wformat=2; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wformat-y2k; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wmaybe-uninitialized; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wmissing-field-initializers; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wlogical-op; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wnon-virtual-dtor; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wnormalized=id; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Woverloaded-virtual; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wpointer-arith; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done if test "x$MINGW" = xyes; then : for flag in -Wno-suggest-attribute=const; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wno-missing-noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wmissing-noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wno-suggest-attribute=noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wno-error=suggest-attribute=noreturn; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wno-redundant-decls; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done else for flag in -Wredundant-decls; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done fi for flag in -Wshadow; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wshorten-64-to-32; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wsign-compare; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wstrict-overflow=1; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wswitch-enum; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wtrampolines; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wundef; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunsafe-loop-optimizations; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -funsafe-loop-optimizations; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wc++11-compat; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done # _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) if test "x$MINGW" != xyes; then : if test "x$ac_cv_vcs_checkout" = xyes; then : if test "x$enable_shared" = "xyes"; then : for flag in -fno-omit-frame-pointer; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=address; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=integer; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=thread; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=memory; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=alignment; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=bool; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=bounds; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=enum; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=float-cast-overflow; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=float-divide-by-zero; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=integer-divide-by-zero; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=null; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=object-size; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=return; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=shift; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=signed-integer-overflow; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=unreachable; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=unsigned-integer-overflow; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=vla-bound; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fsanitize=vptr; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done fi fi fi # _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) for flag in -Wclobbered; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunused; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunused-result; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunused-variable; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunused-parameter; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wunused-local-typedefs; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wwrite-strings; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wformat-security; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -floop-parallelize-all; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fwrapv; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fmudflapt; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -pipe; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -fPIE -pie; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wsizeof-pointer-memaccess; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done for flag in -Wpacked; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) for flag in -Wunreachable-code; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done if test "x$ax_enable_debug" = xno; then : if test "x$ac_cv_vcs_checkout" = xyes; then : if test "x${target_os}" != "xmingw"; then : if test "x$ac_c_gcc_recent" = xyes; then : for flag in -D_FORTIFY_SOURCE=2; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector --param=ssp-buffer-size=4]) for flag in -fstack-protector-all; do as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_$flag" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $flag" >&5 $as_echo_n "checking whether C++ compiler accepts $flag... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" $flag "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains \$flag"; } >&5 (: CXXFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS \$flag\""; } >&5 (: CXXFLAGS="$CXXFLAGS $flag") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS $flag" ;; esac else CXXFLAGS="$flag" fi else : fi done fi fi fi fi if test "x$ac_cv_warnings_as_errors" = xyes; then : if ${CXXFLAGS+:} false; then : case " $CXXFLAGS " in *" -Werror "*) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS already contains -Werror"; } >&5 (: CXXFLAGS already contains -Werror) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; *) { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXXFLAGS=\"\$CXXFLAGS -Werror\""; } >&5 (: CXXFLAGS="$CXXFLAGS -Werror") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXXFLAGS="$CXXFLAGS -Werror" ;; esac else CXXFLAGS="-Werror" 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 -n "$CFLAG_VISIBILITY"; then : CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY" fi if test "x${MINGW}" = "xtrue"; then TARGET_MINGW_TRUE= TARGET_MINGW_FALSE='#' else TARGET_MINGW_TRUE='#' TARGET_MINGW_FALSE= fi # backtrace(), others require shared builds if test "x$enable_shared" = "xyes"; then : $as_echo "#define HAVE_SHARED_ENABLED 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GCC C++ ABI name demangling" >&5 $as_echo_n "checking whether the compiler supports GCC C++ ABI name demangling... " >&6; } if ${ax_cv_cxx_gcc_abi_demangle+:} false; 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 if test "$cross_compiling" = yes; then : ax_cv_cxx_gcc_abi_demangle=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include template class A {}; int main () { A instance; #if defined(_WIN32) return EXIT_FAILURE; #endif int status = 0; char* c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status); std::string name(c_name); ::free(c_name); if (name.compare("A") != 0) { return EXIT_FAILURE; } ; return 0; } _ACEOF if ac_fn_cxx_try_run "$LINENO"; then : ax_cv_cxx_gcc_abi_demangle=yes else ax_cv_cxx_gcc_abi_demangle=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_gcc_abi_demangle" >&5 $as_echo "$ax_cv_cxx_gcc_abi_demangle" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for cxx_gcc_abi_demangle" >&5 $as_echo_n "checking checking for cxx_gcc_abi_demangle... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$ax_cv_cxx_gcc_abi_demangle\"" >&5 $as_echo "\"$ax_cv_cxx_gcc_abi_demangle\"" >&6; } if test "x$ax_cv_cxx_gcc_abi_demangle" = xyes; then : $as_echo "#define HAVE_GCC_ABI_DEMANGLE 1" >>confdefs.h fi fi if test "x$enable_shared" = "xyes"; then SHARED_ENABLED_TRUE= SHARED_ENABLED_FALSE='#' else SHARED_ENABLED_TRUE='#' SHARED_ENABLED_FALSE= fi ac_config_files="$ac_config_files Makefile docs/conf.py libgearman-1.0/version.h scripts/gearmand scripts/gearmand-init scripts/gearmand.xml scripts/smf_install.sh support/gearmand.pc support/gearmand.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H 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$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then 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. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= 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 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 "${TARGET_LINUX_TRUE}" && test -z "${TARGET_LINUX_FALSE}"; then as_fn_error $? "conditional \"TARGET_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TARGET_FREEBSD_TRUE}" && test -z "${TARGET_FREEBSD_FALSE}"; then as_fn_error $? "conditional \"TARGET_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then as_fn_error $? "conditional \"DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${IS_VCS_CHECKOUT_TRUE}" && test -z "${IS_VCS_CHECKOUT_FALSE}"; then as_fn_error $? "conditional \"IS_VCS_CHECKOUT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INCLUDE_HSIEH_SRC_TRUE}" && test -z "${INCLUDE_HSIEH_SRC_FALSE}"; then as_fn_error $? "conditional \"INCLUDE_HSIEH_SRC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBMYSQL_TRUE}" && test -z "${HAVE_LIBMYSQL_FALSE}"; then as_fn_error $? "conditional \"HAVE_LIBMYSQL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILDING_GEARMAN_TRUE}" && test -z "${BUILDING_GEARMAN_FALSE}"; then as_fn_error $? "conditional \"BUILDING_GEARMAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBGEARMAN_TRUE}" && test -z "${HAVE_LIBGEARMAN_FALSE}"; then as_fn_error $? "conditional \"HAVE_LIBGEARMAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBCURL_TRUE}" && test -z "${HAVE_LIBCURL_FALSE}"; then as_fn_error $? "conditional \"HAVE_LIBCURL\" 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_DTRACE_TRUE}" && test -z "${HAVE_DTRACE_FALSE}"; then 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. 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. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_TOKYOCABINET_TRUE}" && test -z "${HAVE_TOKYOCABINET_FALSE}"; then as_fn_error $? "conditional \"HAVE_TOKYOCABINET\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_WIN32_WRAPPERS_TRUE}" && test -z "${BUILD_WIN32_WRAPPERS_FALSE}"; then as_fn_error $? "conditional \"BUILD_WIN32_WRAPPERS\" 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. 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. 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. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TARGET_HOSTILE_TRUE}" && test -z "${TARGET_HOSTILE_FALSE}"; then as_fn_error $? "conditional \"TARGET_HOSTILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TARGET_MINGW_TRUE}" && test -z "${TARGET_MINGW_FALSE}"; then as_fn_error $? "conditional \"TARGET_MINGW\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SHARED_ENABLED_TRUE}" && test -z "${SHARED_ENABLED_FALSE}"; then as_fn_error $? "conditional \"SHARED_ENABLED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # 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. as_fn_error () { 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: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` 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" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # 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 1.0.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # 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 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration links: $config_links Configuration commands: $config_commands Report bugs to . gearmand home page: ." _ACEOF 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 1.0.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # 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 sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $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"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $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"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $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"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $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"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $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_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $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"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $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_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"`' 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"`' postlink_cmds='`$ECHO "$postlink_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_pic_CXX='`$ECHO "$lt_prog_compiler_pic_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_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_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"`' 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"`' postlink_cmds_CXX='`$ECHO "$postlink_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 SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ 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 \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ 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 \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "gear_config.h") CONFIG_HEADERS="$CONFIG_HEADERS gear_config.h:gear_config.in" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "libhashkit/hashkitcon.h") CONFIG_FILES="$CONFIG_FILES libhashkit/hashkitcon.h" ;; "libhashkit-1.0/configure.h") CONFIG_FILES="$CONFIG_FILES libhashkit-1.0/configure.h" ;; "libtest/version.h") CONFIG_FILES="$CONFIG_FILES libtest/version.h" ;; "libtest/yatlcon.h") CONFIG_FILES="$CONFIG_FILES libtest/yatlcon.h" ;; "$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" ;; "docs/conf.py") CONFIG_FILES="$CONFIG_FILES docs/conf.py" ;; "libgearman-1.0/version.h") CONFIG_FILES="$CONFIG_FILES libgearman-1.0/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" ;; "scripts/smf_install.sh") CONFIG_FILES="$CONFIG_FILES scripts/smf_install.sh" ;; "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;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. 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 # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' 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' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && 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 '^'` 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 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 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 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 :L $CONFIG_LINKS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || 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'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_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 $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;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_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 "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } 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;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # 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, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # What type of objects to build. pic_mode=$pic_mode # 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 PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB 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 # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # 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 # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # 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 # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # 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 # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false 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 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 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo "---" echo "Configuration summary for $PACKAGE_NAME version $VERSION" echo "" echo " * Installation prefix: $prefix" echo " * System type: $host_vendor-$host_os" echo " * Host CPU: $host_cpu" echo " * C Compiler: $CC_VERSION" echo " * C Flags: $CFLAGS" echo " * C++ Compiler: $CXX_VERSION" echo " * C++ Flags: $CXXFLAGS" echo " * CPP Flags: $CPPFLAGS" echo " * LIBS: $LIBS" echo " * LDFLAGS Flags: $LDFLAGS" echo " * Assertions enabled: $ax_enable_assert" echo " * Debug enabled: $ax_enable_debug" echo " * Warnings as failure: $ac_cv_warnings_as_errors" echo " * Building with libsqlite3 $WANT_SQLITE3" echo " * Building with libdrizzle $ac_enable_libdrizzle" echo " * Building with libmemcached $ax_enable_libmemcached" echo " * Building with libpq $ac_cv_libpq" echo " * Building with tokyocabinet $ac_enable_libtokyocabinet" echo " * Building with libmysql $found_mysql" echo " * make -j: $enable_jobserver" echo " * VCS checkout: $ac_cv_vcs_checkout" echo "" echo "---" case "$host_os" in *freebsd*) echo "*****" echo "*" echo "* NOTE: You are on FreeBSD. BSD 'make' will not work." echo "*" echo "* use 'gmake' To build gearmand" echo "*" echo "*****" ;; esac gearmand-1.0.6/configure.ac0000664000076400007640000002232212141651120016036 0ustar00brianbrian00000000000000# Gearman server and library # Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ # Copyright (C) 2008 Brian Aker, Eric Day, Monty Taylor # All rights reserved. # # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. AC_REVISION([m4_esyscmd_s([bzr revno])]) AC_PREREQ([2.63]) AC_INIT([gearmand],[1.0.6],[https://bugs.launchpad.net/gearmand],[gearmand],[http://gearman.info/]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_TARGET AC_ARG_PROGRAM AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-ustar]) AC_CONFIG_HEADERS([gear_config.h:gear_config.in])dnl Keep filename to 8.3 for MS-DOS. AC_SUBST([AUTOHEADER_FILE],[gear_config.h]) AC_CONFIG_SRCDIR([libgearman/gearman.cc]) GEARMAN_LIBRARY_VERSION=7:1:0 # | | | # +------+ | +---+ # | | | # current:revision:age # | | | # | | +- increment if interfaces have been added # | | set to zero if interfaces have been removed # | | or changed # | +- increment if source code has changed # | set to zero if current is incremented # +- increment if interfaces have been added, removed or changed AC_SUBST([GEARMAN_LIBRARY_VERSION]) LT_PREREQ([2.2]) LT_INIT([disable-static]) LT_LANG([C++]) AC_PROG_CC_C99 AS_IF([test "x${ac_cv_prog_cc_c99}" == "xno"],[AC_MSG_ERROR([No c99 compatible compiler found])]) AX_PLATFORM m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AX_ASSERT # First look for Boost, maybe for a specific minimum version: AC_DEFUN([CHECK_BOOST], [BOOST_REQUIRE([1.39]) BOOST_PROGRAM_OPTIONS]) CHECK_BOOST m4_include([libhashkit/include.m4]) AX_CXX_CINTTYPES CONFIG_EXTRA m4_include([libtest/yatl.m4]) AM_CONDITIONAL([BUILDING_GEARMAN],true) AM_CONDITIONAL([HAVE_LIBGEARMAN],true) AC_SUBST([_WITH_LIBGEARMAN_SUPPORT],["_WITH_LIBGEARMAN_SUPPORT 0"]) AC_DEFINE([GEARMAND_BINARY],["./gearmand/gearmand"],[Name of the gearmand binary used in make test]) AC_DEFINE([HAVE_LIBGEARMAN],[1], [libgearman support]) AC_DEFINE([HAVE_GEARMAND_BINARY],[1],[gearmand binary was found]) AC_DEFUN([CHECK_CURL], [AX_LIB_CURL([7.21.7], [AX_CHECK_LIBRARY([LIBCURL],[curl/curl.h],[curl])], [AC_DEFINE([HAVE_LIBCURL],[0],[Have the LIBCURL library]) ]) ]) CHECK_CURL AM_CONDITIONAL([HAVE_LIBCURL],[test "x${ax_cv_have_LIBCURL}" = "xyes"]) m4_include([m4/drizzled.m4]) WITH_LIBDRIZZLE AX_LIB_SQLITE3 AS_IF([test "x${WANT_SQLITE3}" = "xyes"], [AC_DEFINE([HAVE_LIBSQLITE3],[1],[Have the SQLITE3 library])], [AC_DEFINE([HAVE_LIBSQLITE3],[0],[Have the SQLITE3 library])]) AM_CONDITIONAL([HAVE_LIBSQLITE3],[test "x${WANT_SQLITE3}" = "xyes"]) PANDORA_ENABLE_DTRACE AX_HAVE_LIBPQ PANDORA_HAVE_LIBTOKYOCABINET AC_FUNC_STRERROR_R SOCKET_SEND_FLAGS FCNTL_FLAGS AX_ENABLE_LIBHIREDIS # Checks for programs. AC_CHECK_PROGS([DPKG_GENSYMBOLS],[dpkg-gensymbols]) AC_CHECK_PROGS([PERL],[perl]) AC_CHECK_PROGS([VALGRIND],['valgrind']) AC_CHECK_PROGS([WINE],['wine']) AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AX_PROG_MEMCACHED AX_PROG_SPHINX_BUILD(,[AC_MSG_WARN([sphinx-build version 1.0 or greater is required to build man pages])]) AX_WITH_PROG([LCOV],[lcov]) AX_WITH_PROG([LCOV_GENHTML],[genhtml]) # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS_ONCE([arpa/inet.h]) AC_CHECK_HEADERS_ONCE([errno.h]) AC_CHECK_HEADERS_ONCE([execinfo.h]) AC_CHECK_HEADERS_ONCE([fcntl.h]) AC_CHECK_HEADERS_ONCE([features.h]) AC_CHECK_HEADERS_ONCE([fnmatch.h]) AC_CHECK_HEADERS_ONCE([getopt.h]) AC_CHECK_HEADERS_ONCE([inttypes.h]) AC_CHECK_HEADERS_ONCE([limits.h]) AC_CHECK_HEADERS_ONCE([mach/mach.h]) AC_CHECK_HEADERS_ONCE([netdb.h]) AC_CHECK_HEADERS_ONCE([netinet/in.h]) AC_CHECK_HEADERS_ONCE([netinet/tcp.h]) AC_CHECK_HEADERS_ONCE([poll.h]) AC_CHECK_HEADERS_ONCE([pwd.h]) AC_CHECK_HEADERS_ONCE([signal.h]) AC_CHECK_HEADERS_ONCE([spawn.h]) AC_CHECK_HEADERS_ONCE([stdarg.h]) AC_CHECK_HEADERS_ONCE([stddef.h]) AC_CHECK_HEADERS_ONCE([stdint.h]) AC_CHECK_HEADERS_ONCE([stdio.h]) AC_CHECK_HEADERS_ONCE([stdlib.h]) AC_CHECK_HEADERS_ONCE([string.h]) AC_CHECK_HEADERS_ONCE([strings.h]) AC_CHECK_HEADERS_ONCE([sys/resource.h]) AC_CHECK_HEADERS_ONCE([sys/socket.h]) AC_CHECK_HEADERS_ONCE([sys/stat.h]) AC_CHECK_HEADERS_ONCE([sys/time.h]) AC_CHECK_HEADERS_ONCE([sys/types.h]) AC_CHECK_HEADERS_ONCE([sys/utsname.h]) AC_CHECK_HEADERS_ONCE([sys/wait.h]) AC_CHECK_HEADERS_ONCE([syslog.h]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_HEADERS_ONCE([winsock2.h]) AC_CHECK_HEADERS_ONCE([libmemcached-1.0/types/return.h]) AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"]) AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"], [AM_LDFLAGS="$AM_LDFLAGS -lws2_32" AM_CFLAGS="$AM_CFLAGS $NO_WERROR" AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR" ]) # Checks for typedefs, structures, and compiler characteristics. AC_CHECK_TYPES([ptrdiff_t]) AC_C_CONST AC_C_INLINE AC_C_VOLATILE AC_HEADER_STDBOOL AC_HEADER_TIME AC_TYPE_INT32_T AC_TYPE_INT64_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UID_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_FORK AC_FUNC_MEMCMP AC_FUNC_STRERROR_R AC_FUNC_VPRINTF AC_REPLACE_FNMATCH AC_CHECK_FUNCS([accept4]) AC_CHECK_FUNCS([dup2]) AC_CHECK_FUNCS([gettimeofday]) AC_CHECK_FUNCS([memchr]) AC_CHECK_FUNCS([memmove]) AC_CHECK_FUNCS([memset]) AC_CHECK_FUNCS([pipe]) AC_CHECK_FUNCS([pipe2]) AC_CHECK_FUNCS([select]) AC_CHECK_FUNCS([setenv]) AC_CHECK_FUNCS([socket]) AC_CHECK_FUNCS([strcasecmp]) AC_CHECK_FUNCS([strdup]) AC_CHECK_FUNCS([strerror]) AC_CHECK_FUNCS([strncasecmp]) AC_CHECK_FUNCS([strtol]) AC_CHECK_FUNCS([strtoul]) AC_CHECK_FUNCS([uname]) AC_CHECK_FUNCS([atexit]) AC_CHECK_FUNCS([clock_gettime]) AC_CHECK_FUNCS([getcwd]) AC_CHECK_FUNCS([strstr]) AC_CHECK_FUNC([setsockopt],[],[AC_CHECK_LIB([socket],[setsockopt])]) AC_CHECK_FUNC([bind],[],[AC_CHECK_LIB([bind],[bind])]) # Check for the ability to call dlopen (used in libhostile) AX_DLOPEN # Check for -lrt AC_CHECK_LIB([rt],[clock_gettime], [AC_SUBST([RT_LIB],[-lrt]) AC_DEFINE([HAVE_LIBRT],[1],[Have clock_gettime]) ]) # Check for -lm LT_LIB_M # Check for CyaSSL AX_CHECK_LIBRARY([CYASSL],[cyassl/ssl.h],[cyassl]) AX_ENABLE_LIBMEMCACHED AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[1],[Have Gearman Blobslap Worker]) AX_LIBEVENT(,[AC_MSG_ERROR([Unable to find libevent])]) AX_UUID_GENERATE_TIME_SAFE AX_AM_JOBSERVER([yes]) AS_IF([test "x${TARGET_LINUX}" = "xtrue"], [AC_DEFINE([BUILD_LIBHOSTILE],[1],[Build libhostile])],[AC_DEFINE([BUILD_LIBHOSTILE],[0],[Build libhostile])]) AM_CONDITIONAL([TARGET_HOSTILE],[test "x${TARGET_LINUX}" = "xtrue"]) AX_PTHREAD(, [AC_MSG_ERROR(could not find libpthread)]) AX_PTHREAD_TIMEDJOIN_NP AX_ENDIAN AX_HEX_VERSION([LIBGEARMAN],[$VERSION]) AX_HARDEN_COMPILER_FLAGS AM_CONDITIONAL([TARGET_MINGW],[test "x${MINGW}" = "xtrue"]) # backtrace(), others require shared builds AS_IF([test "x$enable_shared" = "xyes"], [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().]) AX_CXX_GCC_ABI_DEMANGLE]) AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"]) AC_CONFIG_FILES([Makefile docs/conf.py libgearman-1.0/version.h scripts/gearmand scripts/gearmand-init scripts/gearmand.xml scripts/smf_install.sh support/gearmand.pc support/gearmand.spec]) AC_OUTPUT echo "---" echo "Configuration summary for $PACKAGE_NAME version $VERSION" echo "" echo " * Installation prefix: $prefix" echo " * System type: $host_vendor-$host_os" echo " * Host CPU: $host_cpu" echo " * C Compiler: $CC_VERSION" echo " * C Flags: $CFLAGS" echo " * C++ Compiler: $CXX_VERSION" echo " * C++ Flags: $CXXFLAGS" echo " * CPP Flags: $CPPFLAGS" echo " * LIBS: $LIBS" echo " * LDFLAGS Flags: $LDFLAGS" echo " * Assertions enabled: $ax_enable_assert" echo " * Debug enabled: $ax_enable_debug" echo " * Warnings as failure: $ac_cv_warnings_as_errors" echo " * Building with libsqlite3 $WANT_SQLITE3" echo " * Building with libdrizzle $ac_enable_libdrizzle" echo " * Building with libmemcached $ax_enable_libmemcached" echo " * Building with libpq $ac_cv_libpq" echo " * Building with tokyocabinet $ac_enable_libtokyocabinet" echo " * Building with libmysql $found_mysql" echo " * make -j: $enable_jobserver" echo " * VCS checkout: $ac_cv_vcs_checkout" echo "" echo "---" case "$host_os" in *freebsd*) echo "*****" echo "*" echo "* NOTE: You are on FreeBSD. BSD 'make' will not work." echo "*" echo "* use 'gmake' To build gearmand" echo "*" echo "*****" ;; esac gearmand-1.0.6/bin/0000775000076400007640000000000012142673675014343 5ustar00brianbrian00000000000000gearmand-1.0.6/bin/include.am0000664000076400007640000000634312120665566016307 0ustar00brianbrian00000000000000# 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 noinst_HEADERS+= bin/arguments.h noinst_HEADERS+= bin/error.h noinst_HEADERS+= bin/function.h bin_PROGRAMS+= bin/gearman bin_PROGRAMS+= bin/gearadmin bin_gearadmin_SOURCES= bin_gearadmin_SOURCES+= bin/gearadmin.cc bin_gearadmin_SOURCES+= util/instance.cc bin_gearadmin_SOURCES+= util/operation.cc bin_gearadmin_CXXFLAGS= @BOOST_CPPFLAGS@ bin_gearadmin_LDFLAGS= $(BOOST_PROGRAM_OPTIONS_LDFLAGS) bin_gearadmin_LDADD= bin_gearadmin_LDADD+= $(BOOST_PROGRAM_OPTIONS_LIBS) bin_gearadmin_LDADD+= ${BETTER_MALLOC_LIBS} bin_gearman_SOURCES= bin_gearman_SOURCES+= bin/arguments.cc bin_gearman_SOURCES+= bin/function.cc bin_gearman_SOURCES+= bin/gearman.cc bin_gearman_SOURCES+= bin/error.cc bin_gearman_SOURCES+= util/pidfile.cc bin_gearman_LDADD= libgearman/libgearman.la 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 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-1.0.6/bin/arguments.h0000664000076400007640000001025112137441003016476 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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_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 verbose() const { return _verbose; } bool suppress_input() const { return _suppress_input; } const char *argument(size_t arg) { return argv[arg]; } char **argumentv() { return argv; } void reset_arg_error() { if (_arg_error) { free(_arg_error); _arg_error= NULL; } } bool is_error() { if (_functions.empty()) { reset_arg_error(); _arg_error= strdup("No Functions were provided"); return true; } return _is_error; } const char* arg_error() const { return _arg_error; } bool is_valid() const { return _functions.size(); } 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 _verbose; bool _prefix; bool _background; bool _daemon; bool _usage; bool _is_error; char *_arg_error; 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 gearmand-1.0.6/bin/arguments.cc0000664000076400007640000001044412137441466016655 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include #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), _verbose(false), _prefix(false), _background(false), _daemon(false), _usage(false), _is_error(false), _arg_error(NULL), _priority(GEARMAN_JOB_PRIORITY_NORMAL), _timeout(-1), argv(p_argv), _error(0) { init(p_argc); } Args::~Args() { reset_arg_error(); } void Args::init(int argc) { int c; opterr= 0; while ((c = getopt(argc, argv, "bc:f:h:HILnNp:Pst:u:vwi: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': _usage= true; break; case 'v': _verbose= true; break; default: _is_error= true; if (optarg) { size_t length= snprintf(NULL, 0, "-%c %s", char(c), optarg); ++length; // Add in space for null reset_arg_error(); _arg_error= (char*)malloc(length); if (_arg_error) { snprintf(_arg_error, length, "-%c %s", char(c), optarg); } } else { size_t length= snprintf(NULL, 0, "-%c", char(c)); length++; reset_arg_error(); _arg_error= (char*)malloc(length); if (_arg_error) { snprintf(_arg_error, length, "-%c", char(c)); } } break; } } argv+= optind; } } // namespace gearman_client gearmand-1.0.6/bin/error.h0000664000076400007640000000424112120664334015632 0ustar00brianbrian00000000000000/* 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_client { 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_client */ gearmand-1.0.6/bin/gearadmin.cc0000664000076400007640000001442612120670664016577 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2013 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 "gear_config.h" #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 #include using namespace datadifferential; /* This is a very quickly build application, I am just tired of telneting to the port. */ class Finish : public util::Instance::Finish { public: bool call(bool success, const std::string &response) { if (success) { if (response.empty()) { std::cout << "OK" << std::endl; } else { std::cout << response; } } else if (not response.empty()) { std::cerr << "Error: " << response; } else { #if 0 std::cerr << "Error" << std::endl; #endif } return true; } }; 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.") ("getpid", "Get Process ID for 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::cout << argv[0] << " : " << e.what() << std::endl; std::cout << std::endl << desc << std::endl; return EXIT_FAILURE; } util::Instance instance(host, port); instance.set_finish(new Finish); if (vm.count("help")) { std::cout << desc << std::endl; return EXIT_SUCCESS; } if (vm.count("server-version") == 0 and vm.count("server-verbose") == 0 and vm.count("create-function") == 0 and vm.count("drop-function") == 0 and vm.count("getpid") == 0 and vm.count("status") == 0 and vm.count("workers") == 0 and vm.count("shutdown") == 0) { std::cout << "No option execution operation given." << std::endl << std::endl; std::cout << desc << std::endl; return EXIT_FAILURE; } if (vm.count("shutdown")) { instance.push(new util::Operation(util_literal_param("shutdown\r\n"))); } if (vm.count("status")) { instance.push(new util::Operation(util_literal_param("status\r\n"))); } if (vm.count("workers")) { instance.push(new util::Operation(util_literal_param("workers\r\n"))); } if (vm.count("server-version")) { instance.push(new util::Operation(util_literal_param("version\r\n"))); } if (vm.count("server-verbose")) { instance.push(new util::Operation(util_literal_param("verbose\r\n"))); } if (vm.count("drop-function")) { std::string execute(util_literal_param("drop function ")); execute.append(vm["drop-function"].as()); execute.append("\r\n"); instance.push(new util::Operation(execute.c_str(), execute.size())); } if (vm.count("create-function")) { std::string execute(util_literal_param("create function ")); execute.append(vm["create-function"].as()); execute.append("\r\n"); instance.push(new util::Operation(execute.c_str(), execute.size())); } if (vm.count("getpid")) { instance.push(new util::Operation(util_literal_param("getpid\r\n"))); } instance.run(); return EXIT_SUCCESS; } gearmand-1.0.6/bin/error.cc0000664000076400007640000000573312120663012015767 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * DataDifferential Utility 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 "gear_config.h" #include #include #include #include #include #include namespace gearman_client { namespace error { void perror(const char *message) { char *errmsg_ptr; char errmsg[BUFSIZ]; errmsg[0]= 0; errmsg_ptr= errmsg; #ifdef STRERROR_R_CHAR_P errmsg_ptr= strerror_r(errno, errmsg, sizeof(errmsg)); #else if (strerror_r(errno, errmsg, sizeof(errmsg)) == 0) { errmsg_ptr= errmsg; } #endif if (errmsg_ptr and errmsg[0] != 0) 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_client */ gearmand-1.0.6/bin/function.h0000664000076400007640000000445112107145705016332 0ustar00brianbrian00000000000000/* 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; } gearmand-1.0.6/bin/gearman.cc0000664000076400007640000004755312120664317016267 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "bin/arguments.h" #include "libgearman/client.hpp" #include "libgearman/worker.hpp" using namespace org::gearmand; #include "util/pidfile.hpp" #include "bin/error.h" using namespace gearman_client; using namespace datadifferential; #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(libgearman::Client& client, Args &args, const void *workload, size_t workload_size); static gearman_return_t _client_created(gearman_task_st *task); /** * 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(Args&, 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(args, argv[0]); return EXIT_SUCCESS; } if (args.is_error()) { usage(args, argv[0]); return EXIT_FAILURE; } signal_setup(); if (args.daemon()) { switch (fork()) { case -1: error::perror("fork"); return EXIT_FAILURE; case 0: break; default: return EXIT_SUCCESS; } if (setsid() == -1) { error::perror("setsid"); 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) { error::perror("dup2"); return EXIT_FAILURE; } if (dup2(fd, STDOUT_FILENO) == -1) { error::perror("dup2"); return EXIT_FAILURE; } if (dup2(fd, STDERR_FILENO) == -1) { error::perror("dup2"); return EXIT_FAILURE; } close(fd); } } util::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) { libgearman::Client client; Bytes workload; if (args.timeout() >= 0) { gearman_client_set_timeout(&client, args.timeout()); } if (getenv("GEARMAN_SERVER")) { if (gearman_failed(gearman_client_add_servers(&client, getenv("GEARMAN_SERVER")))) { error::message("Error occurred while parsing GEARMAN_SERVER", &client); return; } } else if (gearman_failed(gearman_client_add_server(&client, args.host(), args.port()))) { error::message("gearman_client_add_server", &client); return; } gearman_client_set_created_fn(&client, _client_created); 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(libgearman::Client& 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_created(gearman_task_st *task) { const Args *args= static_cast(gearman_task_context(task)); if (args->verbose()) { fprintf(stdout, "Task created: %s\n", gearman_task_job_handle(task)); } return GEARMAN_SUCCESS; } 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) { libgearman::Worker worker; if (args.timeout() >= 0) { gearman_worker_set_timeout(&worker, args.timeout()); } if (getenv("GEARMAN_SERVER")) { if (gearman_failed(gearman_worker_add_servers(&worker, getenv("GEARMAN_SERVER")))) { error::message("Error occurred while parsing GEARMAN_SERVER", &worker); return; } } else 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); 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 { int in_fds[2]; int out_fds[2]; if (pipe(in_fds) == -1 or 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(); } int status; 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(Args& args, char *name) { FILE *stream; if (args.is_error()) { stream= stderr; fprintf(stream, "\n%s\tError in usage(%s).\n\n", name, args.arg_error()); } else { stream= stdout; fprintf(stream, "\n%s\tError in usage(%s).\n\n", name, args.arg_error()); } fprintf(stream, "Client mode: %s [options] []\n", name); fprintf(stream, "Worker mode: %s -w [options] [ [ ...]]\n", name); fprintf(stream, "\nCommon options to both client and worker modes.\n"); fprintf(stream, "\t-f - Function name to use for jobs (can give many)\n"); fprintf(stream, "\t-h - Job server host\n"); fprintf(stream, "\t-H - Print this help menu\n"); fprintf(stream, "\t-v - Print diagnostic information to stdout(%s)\n", args.verbose() ? "true" : "false"); fprintf(stream, "\t-p - Job server port\n"); fprintf(stream, "\t-t - Timeout in milliseconds\n"); fprintf(stream, "\t-i - Create a pidfile for the process\n"); fprintf(stream, "\nClient options:\n"); fprintf(stream, "\t-b - Run jobs in the background(%s)\n", args.background() ? "true" : "false"); fprintf(stream, "\t-I - Run jobs as high priority\n"); fprintf(stream, "\t-L - Run jobs as low priority\n"); fprintf(stream, "\t-n - Run one job per line(%s)\n", args.job_per_newline() ? "true" : "false"); fprintf(stream, "\t-N - Same as -n, but strip off the newline(%s)\n", args.strip_newline() ? "true" : "false"); fprintf(stream, "\t-P - Prefix all output lines with functions names\n"); fprintf(stream, "\t-s - Send job without reading from standard input\n"); fprintf(stream, "\t-u - Unique key to use for job\n"); fprintf(stream, "\nWorker options:\n"); fprintf(stream, "\t-c - Number of jobs for worker to run before exiting\n"); fprintf(stream, "\t-n - Send data packet for each line(%s)\n", args.job_per_newline() ? "true" : "false"); fprintf(stream, "\t-N - Same as -n, but strip off the newline(%s)\n", args.strip_newline() ? "true" : "false"); fprintf(stream, "\t-w - Run in worker mode(%s)\n", args.worker() ? "true" : "false"); } gearmand-1.0.6/bin/function.cc0000664000076400007640000000406112107145705016465 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011-2012 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 "gear_config.h" #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 gearmand-1.0.6/NEWS0000664000076400007640000000000012107145705014245 0ustar00brianbrian00000000000000gearmand-1.0.6/examples/0000775000076400007640000000000012142673676015412 5ustar00brianbrian00000000000000gearmand-1.0.6/examples/include.am0000664000076400007640000000503712107145705017345 0ustar00brianbrian00000000000000# 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 # 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 EXAMPLES_LDADD= \ $(BOOST_PROGRAM_OPTIONS_LIBS) \ libgearman/libgearman.la EXAMPLES_LD_FLAGS= EXAMPLES_LD_FLAGS+= $(BOOST_PROGRAM_OPTIONS_LDFLAGS) noinst_PROGRAMS+= \ 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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_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_CXXFLAGS= $(BOOST_CPPFLAGS) examples_wc_worker_LDFLAGS= $(EXAMPLES_LD_FLAGS) gearmand-1.0.6/examples/wc_worker.cc0000664000076400007640000001237512107145705017717 0ustar00brianbrian00000000000000/* 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 "gear_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()); } gearmand-1.0.6/examples/reverse_client_epoch.cc0000664000076400007640000001326212107145705022100 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include #include "util/string.hpp" #include "util/string.hpp" #include "gearmand/error.hpp" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif int main(int args, char *argv[]) { gearmand::error::init(argv[0]); 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.") ("verbose", "Send status to stdout") ("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 (vm.count("verbose") == 0) { close(STDOUT_FILENO); } 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()) { gearmand::error::message("No text was provided for --text or via stdin"); return EXIT_FAILURE; } } gearman_client_st client; if (gearman_client_create(&client) == NULL) { gearmand::error::message("Memory allocation failure on client creation"); return EXIT_FAILURE; } gearman_return_t ret= gearman_client_add_server(&client, host.c_str(), port); if (ret != GEARMAN_SUCCESS) { gearmand::error::message(gearman_client_error(&client)); 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 ((task= gearman_execute(&client, util_literal_param("reverse"), NULL, 0, &workload, &value, 0)) == 0) { gearmand::error::message(gearman_client_error(&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)) { gearmand::error::message(gearman_client_error(&client)); 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; } gearmand-1.0.6/examples/echo_client.cc0000664000076400007640000001021212107145705020155 0ustar00brianbrian00000000000000/* 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 "gear_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; } gearmand-1.0.6/examples/reverse_client.cc0000664000076400007640000001357212107145705020726 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include #include "util/string.hpp" #include "gearmand/error.hpp" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif int main(int args, char *argv[]) { gearmand::error::init(argv[0]); in_port_t port; std::string text_to_echo; std::string host; std::string identifier; int timeout; int count; boost::program_options::options_description desc("Options"); desc.add_options() ("help", "Options related to the program.") ("verbose", "Send status to stdout") ("host,h", boost::program_options::value(&host)->default_value("localhost"),"Connect to the host") ("identifier", boost::program_options::value(&identifier),"Assign identifier") ("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") ("count", boost::program_options::value(&count)->default_value(1), "Number of times to send the job") ("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 (vm.count("verbose") == 0) { close(STDOUT_FILENO); } 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= gearman_client_add_server(&client, host.c_str(), port); if (ret != GEARMAN_SUCCESS) { gearmand::error::message(gearman_client_error(&client)); return EXIT_FAILURE; } if (identifier.empty() == false) { if (gearman_failed(gearman_client_set_identifier(&client, identifier.c_str(), identifier.size()))) { gearmand::error::message(gearman_client_error(&client)); return EXIT_FAILURE; } } int exit_code= EXIT_SUCCESS; do { 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) { gearmand::error::message("Work failed"); exit_code= EXIT_FAILURE; break; } else { gearmand::error::message(gearman_client_error(&client)); exit_code= EXIT_FAILURE; break; } --count; } while (count); gearman_client_free(&client); return exit_code; } gearmand-1.0.6/examples/reverse_worker.cc0000664000076400007640000001723712107145705020763 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include #include #include struct reverse_worker_options_t { bool chunk; bool status; bool unique; bool verbose; reverse_worker_options_t(): chunk(false), status(false), unique(false), verbose(true) { } }; #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif static gearman_return_t reverse_worker(gearman_job_st *job, void *context) { reverse_worker_options_t options= *((reverse_worker_options_t *)context); const char *workload= (const char *)gearman_job_workload(job); const size_t workload_size= gearman_job_workload_size(job); if (options.verbose) { std::cout << "Recieved " << workload_size << " bytes" << std::endl; } std::vector result; result.resize(workload_size); // Copy workload for (size_t y= 0, x= workload_size; x; x--, y++) { result[y]= ((uint8_t *)workload)[x - 1]; } if (options.chunk) // Chunk the result set { for (size_t y= 0, x= workload_size; x; x--, y++) { if (gearman_failed(gearman_job_send_data(job, &result[y], 1))) { return GEARMAN_ERROR; } if (options.status) { // Notice that we send based on y divided by zero. if (gearman_failed(gearman_job_send_status(job, (uint32_t)y, (uint32_t)workload_size))) { return GEARMAN_ERROR; } } } } else { if (options.status) { // Notice that we send based on y divided by zero. if (gearman_failed(gearman_job_send_status(job, (uint32_t)0, (uint32_t)workload_size))) { return GEARMAN_ERROR; } } if (gearman_failed(gearman_job_send_data(job, &result[0], workload_size))) { return GEARMAN_ERROR; } if (options.status) { // Notice that we send based on y divided by zero. if (gearman_failed(gearman_job_send_status(job, (uint32_t)workload_size, (uint32_t)workload_size))) { return GEARMAN_ERROR; } } } if (options.verbose) { std::cout << "Job=" << gearman_job_handle(job); } if (options.unique and options.verbose) { std::cout << "Unique=" << gearman_job_unique(job); } if (options.verbose) { std::cout << " Reversed="; std::cout.write(workload, workload_size); std::cout << std::endl; } return GEARMAN_SUCCESS; } int main(int args, char *argv[]) { uint64_t limit; reverse_worker_options_t options; int timeout; in_port_t port; std::string host; std::string identifier; 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") ("identifier", boost::program_options::value(&identifier),"Assign identifier") ("port,p", boost::program_options::value(&port)->default_value(GEARMAN_DEFAULT_TCP_PORT), "Port number use for connection") ("count,c", boost::program_options::value(&limit)->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") ("verbose", boost::program_options::bool_switch(&options.verbose)->default_value(true), "Print to stdout information as job is processed.") ; 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 ((worker= gearman_worker_create(NULL)) == 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); } if (gearman_failed(gearman_worker_add_server(worker, host.c_str(), port))) { std::cerr << gearman_worker_error(worker) << std::endl; return EXIT_FAILURE; } if (identifier.empty() == false) { if (gearman_failed(gearman_worker_set_identifier(worker, identifier.c_str(), identifier.size()))) { std::cerr << gearman_worker_error(worker) << std::endl; return EXIT_FAILURE; } } gearman_function_t worker_fn= gearman_function_create(reverse_worker); if (gearman_failed(gearman_worker_define_function(worker, gearman_literal_param("reverse"), worker_fn, 0, &options))) { std::cerr << gearman_worker_error(worker) << std::endl; return EXIT_FAILURE; } // Add one if count is not zero if (limit != 0) { limit++; } while (--limit) { if (gearman_failed(gearman_worker_work(worker))) { std::cerr << gearman_worker_error(worker) << std::endl; break; } } gearman_worker_free(worker); return EXIT_SUCCESS; } gearmand-1.0.6/examples/reverse_client_cb.cc0000664000076400007640000001423512107145705021367 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include #include "util/string.hpp" #include "gearmand/error.hpp" #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[]) { gearmand::error::init(argv[0]); 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.") ("verbose", "Send status to stdout") ("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 (vm.count("verbose") == 0) { close(STDOUT_FILENO); } gearman_client_st client; if (gearman_client_create(&client) == NULL) { gearmand::error::message("Memory allocation failure on client creation"); return EXIT_FAILURE; } gearman_return_t ret; ret= gearman_client_add_server(&client, host.c_str(), port); if (ret != GEARMAN_SUCCESS) { gearmand::error::message(gearman_client_error(&client)); 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) { gearmand::error::message(gearman_client_error(&client)); 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) { gearmand::error::message(gearman_client_error(&client)); 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; } gearmand-1.0.6/examples/echo_worker.cc0000664000076400007640000001020212107145705020207 0ustar00brianbrian00000000000000/* 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 "gear_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; } gearmand-1.0.6/examples/reverse_client_bg.cc0000664000076400007640000001362512107145705021375 0ustar00brianbrian00000000000000/* 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 "gear_config.h" #include #include #include #include #include #include #include "util/string.hpp" #include "gearmand/error.hpp" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif int main(int args, char *argv[]) { gearmand::error::init(argv[0]); bool wait_for_result= false; 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.") ("verbose", "Send status to stdout") ("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") ("wait", "Submit status job and wait for results.") ("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 (vm.count("verbose") == 0) { close(STDOUT_FILENO); } if (vm.count("wait_for_result")) { wait_for_result= true; } 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()) { gearmand::error::message("No text was provided for --text or via stdin"); return EXIT_FAILURE; } } gearman_client_st client; if (gearman_client_create(&client) == NULL) { gearmand::error::message("Memory allocation failure on client creation"); return EXIT_FAILURE; } gearman_return_t ret; ret= gearman_client_add_server(&client, host.c_str(), port); if (ret != GEARMAN_SUCCESS) { gearmand::error::message(gearman_client_error(&client)); return EXIT_FAILURE; } if (timeout >= 0) { gearman_client_set_timeout(&client, timeout); } gearman_task_attr_t workload= gearman_task_attr_init_background(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 ((task= gearman_execute(&client, util_literal_param("reverse"), NULL, 0, &workload, values, 0)) == NULL) { gearmand::error::message("Failed to process job", gearman_client_error(&client)); gearman_client_free(&client); return EXIT_FAILURE; } int exit_code= EXIT_SUCCESS; if (wait_for_result) { std::cout << "Background Job Handle=" << gearman_task_job_handle(task) << std::endl; 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)) { gearmand::error::message(gearman_client_error(&client)); 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; } gearmand-1.0.6/ChangeLog0000664000076400007640000003276512141651102015336 0ustar00brianbrian000000000000001.0.6 Mon May 6 02:48:30 EDT 2013 * strlen() of zero on name passed for instance did not result in a connection to localhost (which the php driver thought would happen). * Fix regression in log not updating time on all platforms. * Fix issue where pecl php wasn't passing a null string to get default host. 1.0.5 Mon Apr 15 06:36:05 EDT 2013 * Fix for log_fn 1.0.4 Never Released * Added --coredump flag to gearmand * Removed result type enum, since the structure is never exposed to the user this was of limited use. * Assorted bug fixes. 1.0.3 Sun Feb 3 21:05:52 EST 2013 * Allow for a longer set of retries if port is in use when the server starts up. * Added checking for valgrind sgcheck * Fedora 18 fixes. 1.0.2 Mon Dec 17 07:24:42 EST 2012 * Add --expceptions to Gearmand to enable exceptions by default * Backtraces on some types of crashes. * Add GEARMAN_CLIENT_GENERATE_UNIQUE. * If the unique value passed to any client function is "#" then the unique value will be derived by hashing the workload that is being supplied to the function. * Optimize status requests so that they exit as soon as request is received. * Fix test case results for FreeBSD. 1.0.1 Tue Nov 6 01:07:07 EST 2012 * Stable branch labeled as 1.0 * Update all build related files. * Add a few additional platforms to the supported list. 0.41 Fri Oct 12 05:34:29 EDT 2012 * Switched from --having-debug to --enable-debug * Fix for SQLITE, it wasn't replaying its queue on startup. * More testing done now on durable queues. 0.39 Wed Sep 19 03:36:06 EDT 2012 * Added gearman_job_error() interface. * gearman_client_errno() and gearman_worker_errno() now return EINVAL if client or worker is invalid. 0.38 Fri Sep 14 02:16:01 EDT 2012 * Updates for compiling on different platforms. * UUID portability fixes. 0.37 Sun Sep 2 22:51:08 EDT 2012 * Fix compiler issues around older compilers. Bug 1039629. 0.36 Sat Aug 18 16:57:13 EDT 2012 * Fix issue where sqlite was not correctly being shutdown. * Check for more warnings (and cleanup found from). * Fix thread safety issue for uuid_generate(). 0.35 Sun Aug 5 16:03:21 EDT 2012 * Critical bug fix for rare case in which initialization of pipe for a worker fails. * Add support for MySQL specific driver to specify port. * Fix library issue with OSX Mountain Lion. 0.34 Tue Jul 10 21:19:10 EDT 2012 * Alpha support for direct MySQL queue. * XML option for testing under valgrind. * gearmand now allows for a user to specify the format for the server key * First pass support for checking status via unique value. 0.33 Thu May 3 22:09:29 PDT 2012 * Add --config-file option * Additional testing for Drizzle * Fix for OSX 10.6.8 compile issue. 0.32 Wed Apr 11 02:25:38 PDT 2012 * Fix for shutdown bug. 0.31 Sat Apr 7 11:56:58 PDT 2012 * Fixes for bugs 975591, 974712, 970828, 967859, 967463, * Valgrind fix around epoch retry. * Numerous issues cleaned up around bouncing server during testing. 0.29 Tue Mar 13 22:58:16 PDT 2012 * Additional Fixes for Postgres * Additional debug calls in server via tuneable logging. * Documentation update. * Fixes for Ubuntu 11.10 0.28 Thu Jan 26 22:43:46 PST 2012 * -v has been deprecated because of parsing issues. Please use --verbose instead * --log-file=stderr will set output to stderr. * Fix for gearman.spec file for rpm build. 0.27 Mon Jan 9 20:02:16 PST 2012 * Fix for TokyoCabinet * Build updates for building on Ubuntu 0.26 Wed Nov 30 09:25:49 PST 2011 * Completed support for syslog for gearmand * Fix libdrizzle issues * Add API for killing a worker. 0.25 Thu Nov 3 09:18:46 PDT 2011 * 1.0 libgearman API extracted. * Fix for long function names. * Fix for Worker consuming CPU by hanging. * TokyoCabinet build fix. * Fix for 32bit fix. 0.24 Sun Jul 24 20:57:02 PDT 2011 * Minor bug fixes. * Updated test framework. * make fixes for Fedora. 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 * Increased testting. 0.13 Sun Apr 4 14:45:08 PDT 2010 * Fix for bug #518512. * 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. * Check to make sure worker job results match assigned worker. 0.12 Thu Feb 18 11:28:49 PST 2010 * Fixed bug where memory loss occured if data was too large. * Added gearman_strerror(). * Fixed bug where setting an option off in mass would not trip any triggers on the option (for both worker and client). * Options that are internal can no longer be set by external callers. * Deprecated gearman_client_set_event_watch_fn() and gearman_worker_set_event_watch_fn. * gearman_job_handle() and gearman_job_function_name() now return const char* pointers * gearman_worker_unregister now returns GEARMAN_NO_REGISTERED_FUNCTION if the function does not exist (or is being removed) * Added gearman_worker_function_exist() * Trying to send too large of a piece of data will result in GEARMAN_ARGUMENT_TOO_LARGE. * Added support for gearmand command client to daemonize and create a pid file. * Fixed job handle comparison bug with WORK_FAIL responses. * Fixed disable assert configure option. * Build system updates. 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 #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. * Removed packet varargs function. 0.10 - 2009-09-28 * Added timeout option. * Separated libgearman client/worker library from the server/gearmand code. * 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. * 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. * API cleanup to make the code more consistent and object-oriented. * Added more documentation for base classes, client, and worker. * Build system updates. 0.9 - 2009-07-20 * Added libsqlite3 persistent queue support (Cory Bennett). * Added libpq (PostgreSQL) persistent queue support. * Updated autoconf build system. * Doxygen documentation cleanup. * Bug fix in HTTP protocol module. 0.8 - 2009-06-30 * Added pluggable protocol support. * Added basic HTTP protocol support. * Updated autoconf build system. * Renamed modconf to gearman_conf. * Improved logging messages for gearmand. * Removed all struct memsets and packed structs for better memory usage. * Fixed client connect bug with multiple job servers. * 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. * 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. * 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. 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 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 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). * 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). * Minor cleanup and fixes. 0.5 - 2009-04-22 * Threaded Gearman job server (gearmand). * More options to gearmand. * OSX bug fixes related to poll(). * Fix for bug #357881. * Man page rework. 0.4 - 2009-03-30 * New protocol additions such as UNIQ grab and assign for workers. * Support for high priority background jobs (Brian Moon). * Support for low priority jobs. * 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. * Build fixes (Monty Taylor). * Basic init script added. * Fixed getopt bugs with variable type and EOF. 0.3 - 2009-02-05 * Fixed I/O wait bug in packet parse. * Switched to different autoconf library detection method. * Added detach option to gearmand, can now run in background. * Reworked much of the client code for better concurrency and efficiency. * Added benchmark utilities. * Added man pages. * Changed port to new IANA assigned port, 4730. 0.2 - 2009-01-16 * Improved gearmand efficiency by tracking events and reducing syscalls. * Reworked most of the worker code, it now reconnects to the job server. * Added version/bugreport options to gearmand (Brian Moon). * Fixed bug #315652, libevent usage. 0.1 - 2009-01-08 * First release. gearmand-1.0.6/HACKING0000664000076400007640000000321312107145705014546 0ustar00brianbrian00000000000000Hi! You can obtain the latest source tree for Gearman by issuing the following command: bzr clone lp:gearmand You will need to have bzr installed in order for this to work (http://bazaar.canonical.com/en/). If you are building from source control (i.e. bzr) you should setup your environment via: ./bootstrap.sh autoreconf This will build the files you will need in order to run "./configure". 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 gearmand-1.0.6/libtest/0000775000076400007640000000000012142673676015242 5ustar00brianbrian00000000000000gearmand-1.0.6/libtest/result.cc0000664000076400007640000000514612140642007017053 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012-2013 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 "libtest/yatlcon.h" #include #include namespace libtest { __test_result::__test_result(const char *file_arg, int line_arg, const char *func_arg): libtest::exception(file_arg, line_arg, func_arg) { } __success::__success(const char *file_arg, int line_arg, const char *func_arg): __test_result(file_arg, line_arg, func_arg) { } __skipped::__skipped(const char *file_arg, int line_arg, const char *func_arg, ...): __test_result(file_arg, line_arg, func_arg) { va_list args; va_start(args, func_arg); init(args); va_end(args); } __skipped::__skipped(const __skipped& other) : __test_result(other) { } __failure::__failure(const char *file_arg, int line_arg, const char *func_arg, ...) : __test_result(file_arg, line_arg, func_arg) { va_list args; va_start(args, func_arg); init(args); va_end(args); } __failure::__failure(const __failure& other) : __test_result(other) { } } // namespace libtest gearmand-1.0.6/libtest/test.hpp0000664000076400007640000000652312140642105016715 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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. * */ /* Structures for generic tests. */ #pragma once #ifndef YATL_FULL # define YATL_FULL 1 #endif #ifndef __PRETTY_FUNCTION__ # define __PRETTY_FUNCTION__ __func__ #endif #define YATL_STRINGIFY(x) #x #define YATL_TOSTRING(x) YATL_STRINGIFY(x) #define YATL_AT __FILE__ ":" YATL_TOSTRING(__LINE__) #define YATL_AT_PARAM __func__, AT #define YATL_UNIQUE __FILE__ ":" YATL_TOSTRING(__LINE__) "_unique" #define YATL_UNIQUE_FUNC_NAME __FILE__ ":" YATL_TOSTRING(__LINE__) "_unique_func" #define LIBYATL_DEFAULT_PARAM __FILE__, __LINE__, __PRETTY_FUNCTION__ #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 gearmand-1.0.6/libtest/common.h0000664000076400007640000000601612133165126016670 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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. * */ /* Common include file for libtest */ #pragma once #include #include #include #include #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_TIME_H # include #endif #ifdef HAVE_SYS_WAIT_H # include #endif #ifdef HAVE_SYS_RESOURCE_H # include #endif #ifdef HAVE_FNMATCH_H # include #endif #ifdef HAVE_ARPA_INET_H # include #endif #if defined(WIN32) # include "win32/wrappers.h" # define get_socket_errno() WSAGetLastError() #else # ifdef HAVE_UNISTD_H # include # endif # define INVALID_SOCKET -1 # define SOCKET_ERROR -1 # define closesocket(a) close(a) # define get_socket_errno() errno #endif #include #include #include #include #include #include #include #include #include #include #include struct FreeFromVector { template void operator() ( T* ptr) const { if (ptr) { free(ptr); ptr= NULL; } } }; struct DeleteFromVector { template void operator() ( T* ptr) const { delete ptr; ptr= NULL; } }; gearmand-1.0.6/libtest/dns.cc0000664000076400007640000000573312140517574016335 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #include namespace libtest { bool lookup(const char* host) { bool success= false; assert(host and host[0]); if (host and host[0]) { struct addrinfo *addrinfo= NULL; struct addrinfo hints; memset(&hints, 0, sizeof(hints)); hints.ai_socktype= SOCK_STREAM; hints.ai_protocol= IPPROTO_TCP; int limit= 5; while (--limit and success == false) { if (addrinfo) { freeaddrinfo(addrinfo); addrinfo= NULL; } int ret; if ((ret= getaddrinfo(host, "echo", &hints, &addrinfo)) == 0) { success= true; break; } switch (ret) { case EAI_AGAIN: continue; case EAI_NONAME: default: break; } break; } if (addrinfo) { freeaddrinfo(addrinfo); } } return success; } bool check_dns() { if (valgrind_is_caller()) { return false; } if (lookup("exist.gearman.info") == false) { return false; } if (lookup("does_not_exist.gearman.info")) // This should fail, if it passes,... { fatal_assert("Your service provider sucks and is providing bogus DNS. You might be in an airport."); } return true; } } // namespace libtest gearmand-1.0.6/libtest/timer.cc0000664000076400007640000000733712107145705016667 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #ifdef __MACH__ # include # include #else # include #endif namespace libtest { Timer::Timer() { _begin.tv_sec= 0; _begin.tv_nsec= 0; _end.tv_sec= 0; _end.tv_nsec= 0; } void Timer::reset() { _end.tv_sec= 0; _end.tv_nsec= 0; _time(_begin); } void Timer::sample() { _time(_end); } void Timer::offset(int64_t minutes_arg, int64_t seconds_arg, int64_t nanoseconds) { reset(); _end= _begin; _end.tv_sec+= (minutes_arg * 60) +seconds_arg; _end.tv_nsec+= nanoseconds; } int64_t Timer::minutes() { struct timespec result; difference(result); return int64_t(result.tv_sec / 60); } uint64_t Timer::elapsed_milliseconds() const { struct timespec temp; difference(temp); return temp.tv_sec*1000 +temp.tv_nsec/1000000; } void Timer::difference(struct timespec& arg) const { if ((_end.tv_nsec -_begin.tv_nsec) < 0) { arg.tv_sec= _end.tv_sec -_begin.tv_sec -1; arg.tv_nsec= 1000000000 +_end.tv_nsec -_begin.tv_nsec; } else { arg.tv_sec= _end.tv_sec -_begin.tv_sec; arg.tv_nsec= _end.tv_nsec -_begin.tv_nsec; } } void Timer::_time(struct timespec& ts) { #ifdef __MACH__ // OSX lacks clock_gettime() clock_serv_t _clock_serv; mach_timespec_t _mach_timespec; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &_clock_serv); clock_get_time(_clock_serv, &_mach_timespec); mach_port_deallocate(mach_task_self(), _clock_serv); ts.tv_sec= _mach_timespec.tv_sec; ts.tv_nsec= _mach_timespec.tv_nsec; #elif defined(_WIN32) ts.tv_sec= time(NULL); ts.tv_nsec= 0; #else clock_gettime(CLOCK_REALTIME, &ts); #endif } std::ostream& operator<<(std::ostream& output, const libtest::Timer& arg) { struct timespec temp; arg.difference(temp); if (temp.tv_sec > 60) { output << temp.tv_sec / 60; output << "." << temp.tv_sec % 60; } else { output << temp.tv_sec; } output << ":"; output << std::setfill('0') << std::setw(9) << temp.tv_nsec; return output; } } // namespace libtest gearmand-1.0.6/libtest/cpu.cc0000664000076400007640000000521212107145705016324 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #pragma GCC diagnostic ignored "-Wundef" #if defined(HAVE_SYS_SYSCTL_H) && HAVE_SYS_SYSCTL_H #include #endif namespace libtest { size_t number_of_cpus() { size_t number_of_cpu= 1; #if defined(TARGET_OS_LINUX) && TARGET_OS_LINUX number_of_cpu= sysconf(_SC_NPROCESSORS_ONLN); #elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && defined(HW_NCPU) && defined(HW_AVAILCPU) && defined(HW_NCPU) int mib[4]; size_t len= sizeof(number_of_cpu); /* set the mib for hw.ncpu */ mib[0] = CTL_HW; mib[1] = HW_AVAILCPU; // alternatively, try HW_NCPU; /* get the number of CPUs from the system */ sysctl(mib, 2, &number_of_cpu, &len, NULL, 0); if (number_of_cpu < 1) { mib[1]= HW_NCPU; sysctl(mib, 2, &number_of_cpu, &len, NULL, 0 ); if (number_of_cpu < 1 ) { number_of_cpu = 1; } } #else // Guessing number of CPU #endif return number_of_cpu; } } // namespace libtest gearmand-1.0.6/libtest/formatter.cc0000664000076400007640000001160112107145705017537 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #include namespace libtest { class TestCase { public: TestCase(const std::string& arg): _name(arg), _result(TEST_FAILURE) { } const std::string& name() const { return _name; } test_return_t result() const { return _result; } void result(test_return_t arg) { _result= arg; } void result(test_return_t arg, const libtest::Timer& timer_) { _result= arg; _timer= timer_; } const libtest::Timer& timer() const { return _timer; } void timer(libtest::Timer& arg) { _timer= arg; } private: std::string _name; test_return_t _result; libtest::Timer _timer; }; Formatter::Formatter(const std::string& frame_name, const std::string& arg) { _suite_name= frame_name; _suite_name+= "."; _suite_name+= arg; } Formatter::~Formatter() { std::for_each(_testcases.begin(), _testcases.end(), DeleteFromVector()); _testcases.clear(); } TestCase* Formatter::current() { return _testcases.back(); } void Formatter::skipped() { current()->result(TEST_SKIPPED); Out << name() << "." << current()->name() << "\t\t\t\t\t" << "[ " << test_strerror(current()->result()) << " ]"; reset(); } void Formatter::failed() { assert(current()); current()->result(TEST_FAILURE); Out << name() << "." << current()->name() << "\t\t\t\t\t" << "[ " << test_strerror(current()->result()) << " ]"; reset(); } void Formatter::success(const libtest::Timer& timer_) { assert(current()); current()->result(TEST_SUCCESS, timer_); Out << name() << "." << current()->name() << "\t\t\t\t\t" << current()->timer() << " [ " << test_strerror(current()->result()) << " ]"; reset(); } void Formatter::xml(libtest::Framework& framework_, std::ofstream& output) { output << "" << std::endl; for (Suites::iterator framework_iter= framework_.suites().begin(); framework_iter != framework_.suites().end(); ++framework_iter) { output << "\tname() << "\" classname=\"\" package=\"\">" << std::endl; for (TestCases::iterator case_iter= (*framework_iter)->formatter()->testcases().begin(); case_iter != (*framework_iter)->formatter()->testcases().end(); ++case_iter) { output << "\t\tname() << "\" time=\"" << (*case_iter)->timer().elapsed_milliseconds() << "\">" << std::endl; switch ((*case_iter)->result()) { case TEST_SKIPPED: output << "\t\t " << std::endl; break; case TEST_FAILURE: output << "\t\t "<< std::endl; break; case TEST_SUCCESS: break; } output << "\t\t" << std::endl; } output << "\t" << std::endl; } output << "" << std::endl; } void Formatter::push_testcase(const std::string& arg) { assert(_suite_name.empty() == false); TestCase* _current_testcase= new TestCase(arg); _testcases.push_back(_current_testcase); } void Formatter::reset() { } } // namespace libtest gearmand-1.0.6/libtest/formatter.hpp0000664000076400007640000000453612107145705017752 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include namespace libtest { class Framework; } namespace libtest { class TestCase; typedef std::vector TestCases; class Formatter { public: Formatter(const std::string& frame_name, const std::string& arg); ~Formatter(); void skipped(); void failed(); void success(const libtest::Timer&); void push_testcase(const std::string&); const std::string& name() const { return _suite_name; } TestCases& testcases() { return _testcases; } static void xml(libtest::Framework&, std::ofstream&); private: void reset(); TestCase* current(); private: std::string _suite_name; TestCases _testcases; }; } // namespace libtest gearmand-1.0.6/libtest/dream.h0000664000076400007640000000335012107145705016470 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { void dream(time_t tv_sec, long tv_nsec= 0); } gearmand-1.0.6/libtest/include.am0000664000076400007640000002075312140641401017166 0ustar00brianbrian00000000000000# vim:ft=automake # # included from Top Level Makefile.am # All paths should be given relative to the root # LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=memcheck --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE SGCHECK_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-sgcheck --error-exitcode=1 VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND) HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd --free-is-write=yes --error-exitcode=1 SGCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-sgcheck --error-exitcode=1 MASSIF_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=massif GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1 PAHOLE_COMMAND= $(LIBTOOL_COMMAND) --mode=execute pahole VALGRIND_SUPRESSION= $(LIBTOOL_COMMAND) valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all --log-file=minimalraw.log export LIBTOOL_COMMAND export VALGRIND_COMMAND export HELGRIND_COMMAND export DRD_COMMAND export SGCHECK_COMMAND export GDB_COMMAND valgrind: @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_EXEC_COMMAND)\"" sgcheck: @echo make check TESTS_ENVIRONMENT="\"$(SGCHECK_EXEC_COMMAND)\"" valgrind-supressions: @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_SUPRESSION)\"" gdb: @echo make check TESTS_ENVIRONMENT="\"$(GDB_COMMAND)\"" helgrind: @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\"" drd: @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\"" EXTRA_DIST+= libtest/run.gdb EXTRA_DIST+= libtest/version.h BUILT_SOURCES+= libtest/version.h .PHONY: clean-libtest-check clean-libtest-check: -rm -rf tmp_chroot noinst_HEADERS+= libtest/client.hpp noinst_HEADERS+= libtest/formatter.hpp noinst_HEADERS+= libtest/timer.hpp noinst_HEADERS+= libtest/alarm.h noinst_HEADERS+= libtest/binaries.h noinst_HEADERS+= libtest/cpu.hpp noinst_HEADERS+= libtest/blobslap_worker.h noinst_HEADERS+= libtest/callbacks.h noinst_HEADERS+= libtest/dns.hpp noinst_HEADERS+= libtest/cmdline.h noinst_HEADERS+= libtest/collection.h noinst_HEADERS+= libtest/common.h noinst_HEADERS+= libtest/comparison.hpp noinst_HEADERS+= libtest/core.h noinst_HEADERS+= libtest/dream.h noinst_HEADERS+= libtest/error.h noinst_HEADERS+= libtest/exception.hpp noinst_HEADERS+= libtest/exception/disconnected.hpp noinst_HEADERS+= libtest/exception/fatal.hpp noinst_HEADERS+= libtest/framework.h noinst_HEADERS+= libtest/gearmand.h noinst_HEADERS+= libtest/drizzled.h noinst_HEADERS+= libtest/get.h noinst_HEADERS+= libtest/has.hpp noinst_HEADERS+= libtest/http.hpp noinst_HEADERS+= libtest/is_pid.hpp noinst_HEADERS+= libtest/is_local.hpp noinst_HEADERS+= libtest/killpid.h noinst_HEADERS+= libtest/libtool.hpp noinst_HEADERS+= libtest/memcached.h noinst_HEADERS+= libtest/memcached.hpp noinst_HEADERS+= libtest/poll_error.hpp noinst_HEADERS+= libtest/port.h noinst_HEADERS+= libtest/result.hpp noinst_HEADERS+= libtest/result/base.hpp noinst_HEADERS+= libtest/result/fail.hpp noinst_HEADERS+= libtest/result/skip.hpp noinst_HEADERS+= libtest/result/success.hpp noinst_HEADERS+= libtest/runner.h noinst_HEADERS+= libtest/server.h noinst_HEADERS+= libtest/server_container.h noinst_HEADERS+= libtest/signal.h noinst_HEADERS+= libtest/socket.hpp noinst_HEADERS+= libtest/stream.h noinst_HEADERS+= libtest/strerror.h noinst_HEADERS+= libtest/string.hpp noinst_HEADERS+= libtest/test.h noinst_HEADERS+= libtest/test.hpp noinst_HEADERS+= libtest/thread.hpp noinst_HEADERS+= libtest/tmpfile.hpp noinst_HEADERS+= libtest/lite.h noinst_HEADERS+= libtest/valgrind.h noinst_HEADERS+= libtest/vchar.hpp noinst_HEADERS+= libtest/version.h noinst_HEADERS+= libtest/visibility.h noinst_HEADERS+= libtest/wait.h noinst_HEADERS+= libtest/yatl.h check_LTLIBRARIES+= libtest/libtest.la libtest_libtest_la_CXXFLAGS= EXTRA_libtest_libtest_la_DEPENDENCIES= libtest_libtest_la_LIBADD= libtest_libtest_la_SOURCES= libtest_libtest_la_CXXFLAGS+= @LIBMEMCACHED_CFLAGS@ libtest_libtest_la_LIBADD+= @LIBMEMCACHED_LIB@ libtest_libtest_la_SOURCES+= libtest/alarm.cc libtest_libtest_la_SOURCES+= libtest/binaries.cc libtest_libtest_la_SOURCES+= libtest/cmdline.cc libtest_libtest_la_SOURCES+= libtest/collection.cc libtest_libtest_la_SOURCES+= libtest/comparison.cc libtest_libtest_la_SOURCES+= libtest/core.cc libtest_libtest_la_SOURCES+= libtest/cpu.cc libtest_libtest_la_SOURCES+= libtest/dns.cc libtest_libtest_la_SOURCES+= libtest/dream.cc libtest_libtest_la_SOURCES+= libtest/drizzled.cc libtest_libtest_la_SOURCES+= libtest/exception.cc libtest_libtest_la_SOURCES+= libtest/exception/fatal.cc libtest_libtest_la_SOURCES+= libtest/formatter.cc libtest_libtest_la_SOURCES+= libtest/client.cc libtest_libtest_la_SOURCES+= libtest/framework.cc libtest_libtest_la_SOURCES+= libtest/has.cc libtest_libtest_la_SOURCES+= libtest/http.cc libtest_libtest_la_SOURCES+= libtest/is_local.cc libtest_libtest_la_SOURCES+= libtest/killpid.cc libtest_libtest_la_SOURCES+= libtest/libtool.cc libtest_libtest_la_SOURCES+= libtest/main.cc libtest_libtest_la_SOURCES+= libtest/port.cc libtest_libtest_la_SOURCES+= libtest/result.cc libtest_libtest_la_SOURCES+= libtest/runner.cc libtest_libtest_la_SOURCES+= libtest/server.cc libtest_libtest_la_SOURCES+= libtest/server_container.cc libtest_libtest_la_SOURCES+= libtest/signal.cc libtest_libtest_la_SOURCES+= libtest/socket.cc libtest_libtest_la_SOURCES+= libtest/strerror.cc libtest_libtest_la_SOURCES+= libtest/timer.cc libtest_libtest_la_SOURCES+= libtest/tmpfile.cc libtest_libtest_la_SOURCES+= libtest/vchar.cc libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST libtest_libtest_la_CXXFLAGS+= @PTHREAD_CFLAGS@ libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\"" libtest_libtest_la_CXXFLAGS+= $(CURL_CFLAGS) libtest_libtest_la_LIBADD+= @PTHREAD_LIBS@ libtest_libtest_la_LIBADD+= $(CURL_LIBS) libtest_libtest_la_LIBADD+= @RT_LIB@ EXTRA_libtest_libtest_la_DEPENDENCIES+= libtest_tmp_dir EXTRA_libtest_libtest_la_DEPENDENCIES+= libtest/abort EXTRA_libtest_libtest_la_DEPENDENCIES+= libtest/wait # Declare unittest so that we can append to it libtest_unittest_CXXFLAGS= libtest_unittest_LDADD= libtest_libtest_la_LDFLAGS= # We are either building in tree, or with libtest_libtest_la_SOURCES+= libtest/memcached.cc libtest_libtest_la_LDFLAGS+= @LIBDRIZZLE_LDFLAGS@ libtest_libtest_la_LIBADD+= @LIBDRIZZLE_LIB@ libtest_libtest_la_SOURCES+= libtest/gearmand.cc if BUILDING_GEARMAN libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc endif TMP_DIR := tmp_chroot/etc tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run tmp_chroot/var/drizzle .PHONY: libtest_tmp_dir libtest_tmp_dir: | $(TMP_DIR) $(TMP_DIR): @$(mkdir_p) $(TMP_DIR) libtest_unittest_LDADD+= libtest/libtest.la libtest_unittest_SOURCES= libtest/unittest.cc check_PROGRAMS+= libtest/unittest noinst_PROGRAMS+= libtest/unittest test-unittest: libtest/unittest @libtest/unittest valgrind-unittest: libtest/unittest @$(VALGRIND_COMMAND) libtest/unittest gdb-unittest: libtest/unittest @$(GDB_COMMAND) libtest/unittest helgrind-unittest: libtest/unittest @$(HELGRIND_COMMAND) libtest/unittest drd-unittest: libtest/unittest @$(DRD_COMMAND) libtest/unittest sgcheck-unittest: libtest/unittest echo $(SGCHECK_COMMAND) @$(SGCHECK_COMMAND) libtest/unittest libtest_skiptest_LDADD= libtest/libtest.la libtest_skiptest_SOURCES= libtest/skiptest.cc check_PROGRAMS+= libtest/skiptest noinst_PROGRAMS+= libtest/skiptest test-skiptest: libtest/skiptest @libtest/skiptest valgrind-skiptest: libtest/skiptest @$(VALGRIND_COMMAND) libtest/skiptest helgrind-skiptest: libtest/skiptest @$(HELGRIND_COMMAND) libtest/skiptest drd-skiptest: libtest/skiptest @$(DRD_COMMAND) libtest/skiptest libtest_wait_SOURCES= libtest_wait_SOURCES+= libtest/wait.cc libtest_wait_SOURCES+= libtest/dream.cc noinst_PROGRAMS+= libtest/wait libtest_core_count_SOURCES= libtest_core_count_SOURCES+= libtest/cpu.cc libtest_core_count_SOURCES+= libtest/core_count.cc noinst_PROGRAMS+= libtest/core-count libtest_abort_SOURCES= libtest/abort.cc noinst_PROGRAMS+= libtest/abort libtest_backtrace_SOURCES= libtest_backtrace_LDADD= libtest_backtrace_SOURCES+= libtest/backtrace_test.cc libtest_backtrace_SOURCES+= libgearman/backtrace.cc libtest_backtrace_LDADD+= @DL_LIB@ noinst_PROGRAMS+= libtest/backtrace test-backtrace: libtest/backtrace @libtest/backtrace gdb-backtrace: libtest/backtrace @$(GDB_COMMAND) libtest/backtrace gearmand-1.0.6/libtest/comparison.hpp0000664000076400007640000001117612131732625020117 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED #include #include #include #endif #if defined(HAVE_LIBGEARMAN) && HAVE_LIBGEARMAN #include #endif namespace libtest { LIBTEST_API bool jenkins_is_caller(void); LIBTEST_API bool gdb_is_caller(void); LIBTEST_API bool _in_valgrind(const char *file, int line, const char *func); LIBTEST_API bool helgrind_is_caller(void); template bool _compare_truth(const char *file, int line, const char *func, T_comparable __expected, const char *assertation_label) { if (__expected == false) { libtest::stream::make_cerr(file, line, func) << "Assertation \"" << assertation_label << "\""; return false; } return true; } template bool _compare(const char *file, int line, const char *func, const T1_comparable& __expected, const T2_comparable& __actual, bool use_io) { if (__expected != __actual) { if (use_io) { libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\""; } return false; } return true; } template bool _compare_strcmp(const char *file, int line, const char *func, const T1_comparable& __expected, const T2_comparable& __actual) { if (__expected == NULL) { FATAL("Expected value was NULL, programmer error"); } if (__actual == NULL) { libtest::stream::make_cerr(file, line, func) << "Expected " << __expected << " but got NULL"; return false; } if (strncmp(__expected, __actual, strlen(__expected))) { libtest::stream::make_cerr(file, line, func) << "Expected " << __expected << " passed \"" << __actual << "\""; return false; } return true; } template bool _compare_zero(const char *file, int line, const char *func, T_comparable __actual) { if (T_comparable(0) != __actual) { libtest::stream::make_cerr(file, line, func) << "Expected 0 got \"" << __actual << "\""; return false; } return true; } template bool _ne_compare(const char *file, int line, const char *func, T1_comparable __expected, T2_comparable __actual, bool io_error= true) { if (__expected == __actual) { if (io_error) { libtest::stream::make_cerr(file, line, func) << "Expected \"" << __expected << "\" got \"" << __actual << "\""; } return false; } return true; } template bool _assert_truth(const char *file, int line, const char *func, T_comparable __truth, T_expression_string __expression, const char* __explain= NULL) { if (__truth) { return true; } if (__explain) { libtest::stream::make_cerr(file, line, func) << "Assertion \"" << __expression << "\" warning:" << __explain; } return false; } } // namespace libtest gearmand-1.0.6/libtest/wait.h0000664000076400007640000000561712107145705016354 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #include #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; if (filename.empty()) { _successful= false; return; } for (waited= 0, retry= 1; ; retry++, waited+= this_wait) { if (access(filename.c_str(), R_OK) == 0) { _successful= true; break; } else if (waited >= timeout) { break; } this_wait= retry * retry / 3 + 1; libtest::dream(this_wait, 0); } } Wait(const pid_t &_pid_arg, 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 (kill(_pid_arg, 0) == 0) { _successful= true; break; } else if (waited >= timeout) { break; } this_wait= retry * retry / 3 + 1; libtest::dream(this_wait, 0); } } bool successful() const { return _successful; } private: bool _successful; }; } // namespace libtest gearmand-1.0.6/libtest/cmdline.cc0000664000076400007640000004553412140640701017154 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012-2013 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 "libtest/yatlcon.h" #include "libtest/common.h" using namespace libtest; #include #include #include #include #include #include #ifdef HAVE_POLL_H # include #endif #ifdef HAVE_SPAWN_H # include #endif #include #include #include #include #include #include #include #ifndef __USE_GNU static char **environ= NULL; #endif #ifndef FD_CLOEXEC # define FD_CLOEXEC 0 #endif namespace { std::string print_argv(libtest::vchar_ptr_t& built_argv) { std::stringstream arg_buffer; for (vchar_ptr_t::iterator iter= built_argv.begin(); iter != built_argv.end(); ++iter) { arg_buffer << *iter << " "; } return arg_buffer.str(); } #if 0 std::string print_argv(char** argv) { std::stringstream arg_buffer; for (char** ptr= argv; *ptr; ++ptr) { arg_buffer << *ptr << " "; } return arg_buffer.str(); } #endif static Application::error_t int_to_error_t(int arg) { switch (arg) { case 127: return Application::INVALID_POSIX_SPAWN; case 0: return Application::SUCCESS; case 1: return Application::FAILURE; default: return Application::UNKNOWN; } } } namespace libtest { Application::Application(const std::string& arg, const bool _use_libtool_arg) : _use_libtool(_use_libtool_arg), _use_valgrind(false), _use_gdb(false), _use_ptrcheck(false), _will_fail(false), _argc(0), _exectuble(arg), stdin_fd(STDIN_FILENO), stdout_fd(STDOUT_FILENO), stderr_fd(STDERR_FILENO), _pid(-1), _status(0), _app_exit_state(UNINITIALIZED) { if (_use_libtool) { if (libtool() == NULL) { FATAL("libtool requested, but know libtool was found"); } } // Find just the name of the application with no path { size_t found= arg.find_last_of("/\\"); if (found) { _exectuble_name= arg.substr(found +1); } else { _exectuble_name= arg; } } if (_use_libtool and getenv("PWD")) { _exectuble_with_path+= getenv("PWD"); _exectuble_with_path+= "/"; } _exectuble_with_path+= _exectuble; } Application::~Application() { murder(); delete_argv(); } Application::error_t Application::run(const char *args[]) { stdin_fd.reset(); stdout_fd.reset(); stderr_fd.reset(); _stdout_buffer.clear(); _stderr_buffer.clear(); posix_spawn_file_actions_t file_actions; posix_spawn_file_actions_init(&file_actions); stdin_fd.dup_for_spawn(file_actions); stdout_fd.dup_for_spawn(file_actions); stderr_fd.dup_for_spawn(file_actions); posix_spawnattr_t spawnattr; posix_spawnattr_init(&spawnattr); short flags= 0; // Child should not block signals flags |= POSIX_SPAWN_SETSIGMASK; sigset_t mask; sigemptyset(&mask); fatal_assert(posix_spawnattr_setsigmask(&spawnattr, &mask) == 0); #if defined(POSIX_SPAWN_USEVFORK) || defined(__linux__) // Use USEVFORK on linux flags |= POSIX_SPAWN_USEVFORK; #endif flags |= POSIX_SPAWN_SETPGROUP; fatal_assert(posix_spawnattr_setpgroup(&spawnattr, 0) == 0); fatal_assert(posix_spawnattr_setflags(&spawnattr, flags) == 0); create_argv(args); int spawn_ret; if (_use_gdb) { std::string gdb_run_file= create_tmpfile(_exectuble_name); std::fstream file_stream; file_stream.open(gdb_run_file.c_str(), std::fstream::out | std::fstream::trunc); _gdb_filename= create_tmpfile(_exectuble_name); file_stream << "set logging redirect on" << std::endl << "set logging file " << _gdb_filename << std::endl << "set logging overwrite on" << std::endl << "set logging on" << std::endl << "set environment LIBTEST_IN_GDB=1" << std::endl << "run " << arguments() << std::endl << "thread apply all bt" << std::endl << "quit" << std::endl; fatal_assert(file_stream.good()); file_stream.close(); if (_use_libtool) { // libtool --mode=execute gdb -f -x binary char *argv[]= { const_cast(libtool()), const_cast("--mode=execute"), const_cast("gdb"), const_cast("-batch"), const_cast("-f"), const_cast("-x"), const_cast(gdb_run_file.c_str()), const_cast(_exectuble_with_path.c_str()), 0}; spawn_ret= posix_spawnp(&_pid, libtool(), &file_actions, &spawnattr, argv, environ); } else { // gdb binary char *argv[]= { const_cast("gdb"), const_cast("-batch"), const_cast("-f"), const_cast("-x"), const_cast(gdb_run_file.c_str()), const_cast(_exectuble_with_path.c_str()), 0}; spawn_ret= posix_spawnp(&_pid, "gdb", &file_actions, &spawnattr, argv, environ); } } else { spawn_ret= posix_spawn(&_pid, built_argv[0], &file_actions, &spawnattr, &built_argv[0], NULL); } posix_spawn_file_actions_destroy(&file_actions); posix_spawnattr_destroy(&spawnattr); stdin_fd.close(Application::Pipe::READ); stdout_fd.close(Application::Pipe::WRITE); stderr_fd.close(Application::Pipe::WRITE); if (spawn_ret != 0) { if (_will_fail == false) { Error << strerror(spawn_ret) << "(" << spawn_ret << ")"; } _pid= -1; return Application::INVALID_POSIX_SPAWN; } assert(_pid != -1); if (_pid == -1) { return Application::INVALID_POSIX_SPAWN; } #if 0 app_thread_st* _app_thread= new app_thread_st(_pid, _status, built_argv[0], _app_exit_state); int error; if ((error= pthread_create(&_thread, NULL, &app_thread, _app_thread)) != 0) { Error << "pthread_create() died during pthread_create(" << strerror(error) << ")"; return Application::FAILURE; } #endif return Application::SUCCESS; } bool Application::check() const { if (_pid > 1 and kill(_pid, 0) == 0) { return true; } return false; } void Application::murder() { if (check()) { int count= 5; while ((count--) > 0 and check()) { if (kill(_pid, SIGTERM) == 0) { join(); } else { Error << "kill(pid, SIGTERM) failed after kill with error of " << strerror(errno); continue; } break; } // If for whatever reason it lives, kill it hard if (check()) { Error << "using SIGKILL, things will likely go poorly from this point"; (void)kill(_pid, SIGKILL); } } slurp(); } // false means that no data was returned bool Application::slurp() { struct pollfd fds[2]; fds[0].fd= stdout_fd.fd(); fds[0].events= POLLRDNORM; fds[0].revents= 0; fds[1].fd= stderr_fd.fd(); fds[1].events= POLLRDNORM; fds[1].revents= 0; int active_fd; if ((active_fd= poll(fds, 2, 0)) == -1) { int error; switch ((error= errno)) { #ifdef TARGET_OS_LINUX case ERESTART: #endif case EINTR: break; case EFAULT: case ENOMEM: FATAL(strerror(error)); break; case EINVAL: FATAL("RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid"); break; default: FATAL(strerror(error)); break; } return false; } if (active_fd == 0) { return false; } bool data_was_read= false; if (fds[0].revents & POLLRDNORM) { if (stdout_fd.read(_stdout_buffer) == true) { data_was_read= true; } } if (fds[1].revents & POLLRDNORM) { if (stderr_fd.read(_stderr_buffer) == true) { data_was_read= true; } } return data_was_read; } Application::error_t Application::join() { pid_t waited_pid= waitpid(_pid, &_status, 0); slurp(); if (waited_pid == _pid and WIFEXITED(_status) == false) { /* What we are looking for here is how the exit status happened. - 127 means that posix_spawn() itself had an error. - If WEXITSTATUS is positive we need to see if it is a signal that we sent to kill the process. If not something bad happened in the process itself. - Finally something has happened that we don't currently understand. */ if (WEXITSTATUS(_status) == 127) { _app_exit_state= Application::INVALID_POSIX_SPAWN; std::string error_string("posix_spawn() failed pid:"); error_string+= _pid; error_string+= " name:"; error_string+= print_argv(built_argv); if (stderr_result_length()) { error_string+= " stderr: "; error_string+= stderr_c_str(); } throw std::logic_error(error_string); } else if (WIFSIGNALED(_status)) { if (WTERMSIG(_status) != SIGTERM and WTERMSIG(_status) != SIGHUP) { slurp(); _app_exit_state= Application::INVALID_POSIX_SPAWN; std::string error_string(print_argv(built_argv)); error_string+= " was killed by signal "; error_string+= strsignal(WTERMSIG(_status)); if (stdout_result_length()) { error_string+= " stdout: "; error_string+= stdout_c_str(); } if (stderr_result_length()) { error_string+= " stderr: "; error_string+= stderr_c_str(); } throw std::runtime_error(error_string); } // If we terminted it on purpose then it counts as a success. #if defined(DEBUG) if (DEBUG) { Out << "waitpid() application terminated at request" << " pid:" << _pid << " name:" << built_argv[0]; } #endif } else { _app_exit_state= Application::UNKNOWN; Error << "Unknown logic state at exit:" << WEXITSTATUS(_status) << " pid:" << _pid << " name:" << built_argv[0]; } } else if (waited_pid == _pid and WIFEXITED(_status)) { _app_exit_state= int_to_error_t(WEXITSTATUS(_status)); } else if (waited_pid == -1) { std::string error_string; if (stdout_result_length()) { error_string+= " stdout: "; error_string+= stdout_c_str(); } if (stderr_result_length()) { error_string+= " stderr: "; error_string+= stderr_c_str(); } Error << "waitpid() returned errno:" << strerror(errno) << " " << error_string; _app_exit_state= Application::UNKNOWN; } else { _app_exit_state= Application::UNKNOWN; throw std::logic_error("waitpid() returned an unknown value"); } return _app_exit_state; } void Application::add_long_option(const std::string& name, const std::string& option_value) { std::string arg(name); arg+= option_value; _options.push_back(std::make_pair(arg, std::string())); } void Application::add_option(const std::string& arg) { _options.push_back(std::make_pair(arg, std::string())); } void Application::add_option(const std::string& name, const std::string& value) { _options.push_back(std::make_pair(name, value)); } Application::Pipe::Pipe(int arg) : _std_fd(arg) { _pipe_fd[READ]= -1; _pipe_fd[WRITE]= -1; _open[READ]= false; _open[WRITE]= false; } int Application::Pipe::Pipe::fd() { if (_std_fd == STDOUT_FILENO) { return _pipe_fd[READ]; } else if (_std_fd == STDERR_FILENO) { return _pipe_fd[READ]; } return _pipe_fd[WRITE]; // STDIN_FILENO } bool Application::Pipe::read(libtest::vchar_t& arg) { fatal_assert(_std_fd == STDOUT_FILENO or _std_fd == STDERR_FILENO); bool data_was_read= false; libtest::vchar_t buffer; buffer.resize(1024); ssize_t read_length; while ((read_length= ::read(_pipe_fd[READ], &buffer[0], buffer.size()))) { if (read_length == -1) { switch(errno) { case EAGAIN: break; default: Error << strerror(errno); break; } break; } data_was_read= true; arg.reserve(read_length +1); for (size_t x= 0; x < size_t(read_length); ++x) { arg.push_back(buffer[x]); } // @todo Suck up all errput code here } return data_was_read; } void Application::Pipe::nonblock() { int flags; do { flags= fcntl(_pipe_fd[READ], F_GETFL, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags == -1) { Error << "fcntl(F_GETFL) " << strerror(errno); throw strerror(errno); } int rval; do { rval= fcntl(_pipe_fd[READ], F_SETFL, flags | O_NONBLOCK); } while (rval == -1 and (errno == EINTR or errno == EAGAIN)); if (rval == -1) { Error << "fcntl(F_SETFL) " << strerror(errno); throw strerror(errno); } } void Application::Pipe::reset() { close(READ); close(WRITE); #ifdef HAVE_PIPE2 if (pipe2(_pipe_fd, O_NONBLOCK|O_CLOEXEC) == -1) #endif { if (pipe(_pipe_fd) == -1) { FATAL(strerror(errno)); } // Since either pipe2() was not found/called we set the pipe directly nonblock(); cloexec(); } _open[0]= true; _open[1]= true; } void Application::Pipe::cloexec() { //if (SOCK_CLOEXEC == 0) { if (FD_CLOEXEC) { int flags; do { flags= fcntl(_pipe_fd[WRITE], F_GETFD, 0); } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); if (flags == -1) { Error << "fcntl(F_GETFD) " << strerror(errno); throw strerror(errno); } int rval; do { rval= fcntl(_pipe_fd[WRITE], F_SETFD, flags | FD_CLOEXEC); } while (rval == -1 && (errno == EINTR or errno == EAGAIN)); if (rval == -1) { Error << "fcntl(F_SETFD) " << strerror(errno); throw strerror(errno); } } } } Application::Pipe::~Pipe() { if (_pipe_fd[0] != -1) { ::close(_pipe_fd[0]); } if (_pipe_fd[1] != -1) { ::close(_pipe_fd[1]); } } void Application::Pipe::dup_for_spawn(posix_spawn_file_actions_t& file_actions) { int type= STDIN_FILENO == _std_fd ? 0 : 1; int ret; if ((ret= posix_spawn_file_actions_adddup2(&file_actions, _pipe_fd[type], _std_fd )) < 0) { FATAL("posix_spawn_file_actions_adddup2(%s)", strerror(ret)); } if ((ret= posix_spawn_file_actions_addclose(&file_actions, _pipe_fd[type])) < 0) { FATAL("posix_spawn_file_actions_addclose(%s)", strerror(ret)); } } void Application::Pipe::close(const close_t& arg) { int type= int(arg); if (_open[type]) { if (::close(_pipe_fd[type]) == -1) { Error << "close(" << strerror(errno) << ")"; } _open[type]= false; _pipe_fd[type]= -1; } } void Application::create_argv(const char *args[]) { delete_argv(); if (_use_libtool) { assert(libtool()); vchar::append(built_argv, libtool()); vchar::append(built_argv, "--mode=execute"); } if (_use_valgrind) { /* valgrind --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE */ vchar::append(built_argv, "valgrind"); vchar::append(built_argv, "--error-exitcode=1"); vchar::append(built_argv, "--leak-check=yes"); #if 0 vchar::append(built_argv, "--show-reachable=yes")); #endif vchar::append(built_argv, "--track-fds=yes"); #if 0 built_argv[x++]= strdup("--track-origin=yes"); #endif vchar::append(built_argv, "--malloc-fill=A5"); vchar::append(built_argv, "--free-fill=DE"); std::string log_file= create_tmpfile("valgrind"); libtest::vchar_t buffer; buffer.resize(1024); int length= snprintf(&buffer[0], buffer.size(), "--log-file=%s", log_file.c_str()); fatal_assert(length > 0 and size_t(length) < buffer.size()); vchar::append(built_argv, &buffer[0]); } else if (_use_ptrcheck) { /* valgrind --error-exitcode=1 --tool=exp-ptrcheck --log-file= */ vchar::append(built_argv, "valgrind"); vchar::append(built_argv, "--error-exitcode=1"); vchar::append(built_argv, "--tool=exp-ptrcheck"); std::string log_file= create_tmpfile("ptrcheck"); libtest::vchar_t buffer; buffer.resize(1024); int length= snprintf(&buffer[0], buffer.size(), "--log-file=%s", log_file.c_str()); fatal_assert(length > 0 and size_t(length) < buffer.size()); vchar::append(built_argv, &buffer[0]); } else if (_use_gdb) { vchar::append(built_argv, "gdb"); } vchar::append(built_argv, _exectuble_with_path.c_str()); for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter) { vchar::append(built_argv, (*iter).first.c_str()); if ((*iter).second.empty() == false) { vchar::append(built_argv, (*iter).second.c_str()); } } if (args) { for (const char **ptr= args; *ptr; ++ptr) { vchar::append(built_argv, *ptr); } } built_argv.push_back(NULL); } std::string Application::print() { return print_argv(built_argv); } std::string Application::arguments() { std::stringstream arg_buffer; // Skip printing out the libtool reference for (size_t x= _use_libtool ? 2 : 0; x < _argc; ++x) { if (built_argv[x]) { arg_buffer << built_argv[x] << " "; } } return arg_buffer.str(); } void Application::delete_argv() { std::for_each(built_argv.begin(), built_argv.end(), FreeFromVector()); built_argv.clear(); _argc= 0; } int exec_cmdline(const std::string& command, const char *args[], bool use_libtool) { Application app(command, use_libtool); Application::error_t ret= app.run(args); if (ret != Application::SUCCESS) { return int(ret); } return int(app.join()); } } // namespace exec_cmdline gearmand-1.0.6/libtest/core_count.cc0000664000076400007640000000735212107145705017704 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #include #include #include #include #include static void version_command(const char *command_name, int major_version, int minor_version) { std::cout << command_name << " " << major_version << "." << minor_version << std::endl; } static void help_command(const char *command_name, int major_version, int minor_version, const struct option *long_options) { std::cout << command_name << " " << major_version << "." << minor_version << std::endl; std::cout << "Prints the number of cores found on the local host." << std::endl << std::endl; for (uint32_t x= 0; long_options[x].name; x++) { std::cout << "\t --" << long_options[x].name << char(long_options[x].has_arg ? '=' : ' ') << std::endl; } std::cout << std::endl; } enum { OPT_HELP, OPT_VERSION }; static void options_parse(int argc, char *argv[]) { static struct option long_options[]= { { "version", no_argument, NULL, OPT_VERSION}, { "help", no_argument, NULL, OPT_HELP}, {0, 0, 0, 0}, }; bool opt_version= false; bool opt_help= false; int option_index= 0; while (1) { int option_rv= getopt_long(argc, argv, "", long_options, &option_index); if (option_rv == -1) { break; } switch (option_rv) { case OPT_HELP: /* --help or -h */ opt_help= true; break; case OPT_VERSION: /* --version or -v */ opt_version= true; break; case '?': /* getopt_long already printed an error message. */ exit(EXIT_FAILURE); default: help_command(argv[0], 1, 0, long_options); exit(EXIT_FAILURE); } } if (opt_version) { version_command(argv[0], 1, 0); exit(EXIT_SUCCESS); } if (opt_help) { help_command(argv[0], 1, 0, long_options); exit(EXIT_SUCCESS); } } int main(int argc, char *argv[]) { options_parse(argc, argv); std::cout << libtest::number_of_cpus() << std::endl; return EXIT_SUCCESS; } gearmand-1.0.6/libtest/client.cc0000664000076400007640000002045612107145705017022 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #include #include #ifdef HAVE_POLL_H # include #endif #ifndef HAVE_MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif namespace libtest { SimpleClient::SimpleClient(const std::string& hostname_, in_port_t port_) : _is_connected(false), _hostname(hostname_), _port(port_), sock_fd(INVALID_SOCKET), requested_message(1) { } bool SimpleClient::ready(int event_) { struct pollfd fds[1]; fds[0].fd= sock_fd; fds[0].events= event_; fds[0].revents= 0; int timeout= 5000; if (_is_connected == false) { timeout= timeout * 30; } int ready_fds= poll(fds, 1, timeout); if (ready_fds == -1) { _error= strerror(errno); return false; } else if (ready_fds == 1) { if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { int err; socklen_t len= sizeof (err); // We replace errno with err if getsockopt() passes, but err has been // set. if (getsockopt(fds[0].fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0) { // We check the value to see what happened wth the socket. if (err == 0) { _error= "getsockopt() returned no error but poll() indicated one existed"; return false; } errno= err; } _error= strerror(errno); return false; } _is_connected= true; if (fds[0].revents & event_) { return true; } } fatal_assert(ready_fds == 0); _error= "TIMEOUT"; return false; } struct addrinfo* SimpleClient::lookup() { struct addrinfo *ai= NULL; struct addrinfo hints; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_socktype= SOCK_STREAM; hints.ai_protocol= IPPROTO_TCP; libtest::vchar_t service; service.resize(NI_MAXSERV); (void)snprintf(&service[0], service.size(), "%d", _port); int getaddrinfo_error; if ((getaddrinfo_error= getaddrinfo(_hostname.c_str(), &service[0], &hints, &ai)) != 0) { if (getaddrinfo_error != EAI_SYSTEM) { _error= gai_strerror(getaddrinfo_error); return NULL; } else { _error= strerror(getaddrinfo_error); return NULL; } } return ai; } SimpleClient::~SimpleClient() { close_socket(); } void SimpleClient::close_socket() { if (sock_fd != INVALID_SOCKET) { close(sock_fd); sock_fd= INVALID_SOCKET; } } bool SimpleClient::instance_connect() { _is_connected= false; struct addrinfo *ai; if ((ai= lookup())) { { struct addrinfo* address_info_next= ai; while (address_info_next and sock_fd == INVALID_SOCKET) { if ((sock_fd= socket(address_info_next->ai_family, address_info_next->ai_socktype, address_info_next->ai_protocol)) != SOCKET_ERROR) { if (connect(sock_fd, address_info_next->ai_addr, address_info_next->ai_addrlen) == SOCKET_ERROR) { switch (errno) { case EINTR: close_socket(); continue; case EINPROGRESS: // nonblocking mode - first return case EALREADY: // nonblocking mode - subsequent returns continue; // Jump to while() and continue on case ECONNREFUSED: default: break; } close_socket(); _error= strerror(errno); } } else { FATAL(strerror(errno)); } address_info_next= address_info_next->ai_next; } freeaddrinfo(ai); } if (sock_fd == INVALID_SOCKET) { fatal_assert(_error.size()); } return bool(sock_fd != INVALID_SOCKET); } return false; } bool SimpleClient::is_valid() { _error.clear(); if (sock_fd == INVALID_SOCKET) { return instance_connect(); } return true; } bool SimpleClient::message(const char* ptr, const size_t len) { if (is_valid()) { if (ready(POLLOUT)) { off_t offset= 0; do { ssize_t nw= send(sock_fd, ptr + offset, len - offset, MSG_NOSIGNAL); if (nw == -1) { if (errno != EINTR) { _error= strerror(errno); return false; } } else { offset += nw; } } while (offset < ssize_t(len)); return true; } } fatal_assert(_error.size()); return false; } bool SimpleClient::send_message(const std::string& arg) { if (message(arg.c_str(), arg.size()) == true) { return message("\r\n", 2); } return false; } bool SimpleClient::send_data(const libtest::vchar_t& message_, libtest::vchar_t& response_) { requested_message++; if (message(&message_[0], message_.size())) { return response(response_); } return false; } bool SimpleClient::send_message(const std::string& message_, std::string& response_) { requested_message++; if (send_message(message_)) { return response(response_); } return false; } bool SimpleClient::response(libtest::vchar_t& response_) { response_.clear(); if (is_valid()) { if (ready(POLLIN)) { bool more= true; char buffer[2]; buffer[1]= 0; do { ssize_t nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL); if (nr == -1) { if (errno != EINTR) { _error= strerror(errno); return false; } } else if (nr == 0) { close_socket(); more= false; } else { response_.reserve(response_.size() + nr +1); fatal_assert(nr == 1); if (buffer[0] == '\n') { more= false; } response_.insert(response_.end(), buffer, buffer +nr); } } while (more); return response_.size(); } } fatal_assert(_error.size()); return false; } bool SimpleClient::response(std::string& response_) { response_.clear(); if (is_valid()) { if (ready(POLLIN)) { bool more= true; char buffer[2]; buffer[1]= 0; do { ssize_t nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL); if (nr == -1) { if (errno != EINTR) { _error= strerror(errno); return false; } } else if (nr == 0) { close_socket(); more= false; } else { fatal_assert(nr == 1); if (buffer[0] == '\n') { more= false; } response_.append(buffer); } } while (more); return response_.size(); } } fatal_assert(_error.size()); return false; } } // namespace libtest gearmand-1.0.6/libtest/drizzled.cc0000664000076400007640000001137412117600257017371 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include "util/instance.hpp" #include "util/operation.hpp" using namespace datadifferential; using namespace libtest; #include #include #include #include #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE # include #endif using namespace libtest; namespace libtest { bool ping_drizzled(const in_port_t _port) { (void)(_port); #if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE if (HAVE_LIBDRIZZLE) { drizzle_st *drizzle= drizzle_create(getenv("MYSQL_SERVER"), getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT, getenv("MYSQL_USER"), getenv("MYSQL_PASSWORD"), getenv("MYSQL_SCHEMA"), 0); if (drizzle == NULL) { return false; } bool success= false; drizzle_return_t rc; if ((rc= drizzle_connect(drizzle)) == DRIZZLE_RETURN_OK) { drizzle_result_st *result= drizzle_ping(drizzle, &rc); success= bool(result); drizzle_result_free(result); } if (success == true) { } else if (rc != DRIZZLE_RETURN_OK) { Error << drizzle_error(drizzle) << " localhost:" << _port; } drizzle_quit(drizzle); return success; } #endif return false; } } // namespace libtest class Drizzle : public libtest::Server { private: public: Drizzle(const std::string& host_arg, in_port_t port_arg) : libtest::Server(host_arg, port_arg, DRIZZLED_BINARY, false) { set_pid_file(); } bool ping() { size_t limit= 5; while (_app.check() and --limit) { if (ping_drizzled(_port)) { return true; } libtest::dream(1, 0); } return false; } const char *name() { return "drizzled"; }; void log_file_option(Application&, const std::string&) { } bool has_log_file_option() const { return true; } bool broken_pid_file() { return true; } bool is_libtool() { return false; } bool has_syslog() const { return true; } bool has_port_option() const { return true; } void port_option(Application& app, in_port_t arg) { if (arg > 0) { libtest::vchar_t buffer; buffer.resize(1024); snprintf(&buffer[1024], buffer.size(), "--drizzle-protocol.port=%d", int(arg)); app.add_option(&buffer[1024]); } } bool build(); }; bool Drizzle::build() { if (getuid() == 0 or geteuid() == 0) { add_option("--user=root"); } add_option("--verbose=INSPECT"); #if 0 add_option("--datadir=var/drizzle"); #endif return true; } namespace libtest { libtest::Server *build_drizzled(const char *hostname, in_port_t try_port) { return new Drizzle(hostname, try_port); } } gearmand-1.0.6/libtest/result.hpp0000664000076400007640000000411412140642133017247 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #include #include #include #define _SUCCESS throw libtest::__success(LIBYATL_DEFAULT_PARAM) #define SKIP(...) \ do \ { \ throw libtest::__skipped(LIBYATL_DEFAULT_PARAM, __VA_ARGS__); \ } while (0) #define FAIL(...) \ do \ { \ throw libtest::__failure(LIBYATL_DEFAULT_PARAM, __VA_ARGS__); \ } while (0) gearmand-1.0.6/libtest/server_container.h0000664000076400007640000000730612107145705020755 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #include #include #include #include #include #include #include namespace libtest { class server_startup_st { private: uint64_t _magic; std::string server_list; bool _socket; bool _sasl; std::string _username; std::string _password; public: uint8_t udp; std::vector servers; server_startup_st(); ~server_startup_st(); bool validate(); bool start_socket_server(const std::string& server_type, const in_port_t try_port, const char *argv[]); bool start_server(const std::string& server_type, const in_port_t try_port, const char *argv[]); uint32_t count() const { return uint32_t(servers.size()); } void restart(); std::string option_string() const; const std::string& password() const { return _password; } const std::string& username() const { return _username; } bool socket() { return _socket; } bool sasl() { return _sasl; } void set_socket() { _socket= true; } void set_sasl(const std::string& username_arg, const std::string& password_arg) { _sasl= true; _username= username_arg; _password= password_arg; } // Just remove everything after shutdown void clear(); bool shutdown(); bool shutdown(uint32_t number_of_host); bool check() const; void push_server(Server *); Server* last(); Server *pop_server(); Server* create(const std::string& server_type, in_port_t try_port, const bool is_socket); unsigned long int servers_to_run() const { return _servers_to_run; } void set_servers_to_run(unsigned long int arg) { _servers_to_run= arg; } private: bool _start_server(const bool is_socket, const std::string& server_type, const in_port_t try_port, const char *argv[]); private: unsigned long int _servers_to_run; }; bool server_startup(server_startup_st&, const std::string&, in_port_t try_port, const char *argv[]); } // namespace libtest gearmand-1.0.6/libtest/blobslap_worker.h0000664000076400007640000000335612107145705020575 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { Server *build_blobslap_worker(in_port_t try_port); } gearmand-1.0.6/libtest/is_local.cc0000664000076400007640000000367312107145705017333 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include namespace libtest { bool test_is_local() { return (getenv("LIBTEST_LOCAL")); } static bool _is_massive= false; void is_massive(bool arg) { _is_massive= arg; } bool is_massive() { return _is_massive; } } // namespace libtest gearmand-1.0.6/libtest/binaries.h0000664000076400007640000000331712107145705017177 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { } // namespace libtest gearmand-1.0.6/libtest/string.hpp0000664000076400007640000000401512107145705017245 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include "util/string.hpp" #define test_literal_param util_literal_param #define test_literal_compare_param util_literal_compare_param #define test_literal_param_size util_literal_param_size #define test_string_make_from_cstr util_string_make_from_cstr #define test_string_make_from_array util_string_make_from_array #define test_array_length util_array_length gearmand-1.0.6/libtest/m4/0000775000076400007640000000000012142673670015554 5ustar00brianbrian00000000000000gearmand-1.0.6/libtest/m4/mysql.m40000664000076400007640000000171112107145705017155 0ustar00brianbrian00000000000000m4_include([libtest/m4/ax_lib_mysql.m4]) m4_include([libtest/m4/ax_prog_mysqld.m4]) #serial 1 AC_DEFUN([YATL_MYSQL], [ AC_REQUIRE([AX_PROG_MYSQLD]) AX_LIB_MYSQL([5.0]) AM_CONDITIONAL(HAVE_LIBMYSQL, test "x${found_mysql}" = "xyes") AS_IF([test "x${found_mysql}" = "xyes"],[ AC_DEFINE([HAVE_LIBMYSQL_BUILD], [1], [Define to 1 if MySQL libraries are available]) ],[ AC_DEFINE([HAVE_LIBMYSQL_BUILD], [0], [Define to 1 if MySQL libraries are available]) ]) AS_IF([test -f "$ac_cv_path_MYSQLD"],[ AC_DEFINE([HAVE_MYSQLD_BUILD], [1], [Define to 1 if MySQLD binary is available]) AC_DEFINE_UNQUOTED([MYSQLD_BINARY], "$ac_cv_path_MYSQLD", [Name of the mysqld binary used in make test]) ],[ AC_DEFINE([HAVE_MYSQLD_BUILD], [0], [Define to 1 if MySQLD binary is available]) AC_DEFINE([MYSQLD_BINARY], [0], [Name of the mysqld binary used in make test]) ]) ]) gearmand-1.0.6/libtest/m4/ax_prog_mysqld.m40000664000076400007640000000440612107145705021044 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_prog_mysqld.html # =========================================================================== # # SYNOPSIS # # AX_PROG_MYSQLD # # DESCRIPTION # # Check for the program 'mysqld' let script continue if exists & works # pops up error message if not. # # Besides checking existence, this macro also set these environment # variables upon completion: # # MYSQLD = which mysqld # # LICENSE # # Copyright (c) 2008 Gleen Salmon # # 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 2 of the License, or (at your # option) any later version. # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 6 AU_ALIAS([AC_PROG_MYSQLD], [AX_PROG_MYSQLD]) AC_DEFUN([AX_PROG_MYSQLD],[ AC_REQUIRE([AC_EXEEXT])dnl AC_PATH_PROG(MYSQLD, mysqld$EXEEXT, nocommand) if test "$MYSQLD" = nocommand; then AC_MSG_WARN([mysqld not found in $PATH]) fi;dnl ]) gearmand-1.0.6/libtest/m4/ax_lib_mysql.m40000664000076400007640000001114312107145705020473 0ustar00brianbrian00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_mysql.html # =========================================================================== # # SYNOPSIS # # AX_LIB_MYSQL([MINIMUM-VERSION]) # # DESCRIPTION # # This macro provides tests of availability of MySQL client library of # particular version or newer. # # AX_LIB_MYSQL macro takes only one argument which is optional. If there # is no required version passed, then macro does not run version test. # # The --with-mysql option takes one of three possible values: # # no - do not check for MySQL client library # # yes - do check for MySQL library in standard locations (mysql_config # should be in the PATH) # # path - complete path to mysql_config utility, use this option if # mysql_config can't be found in the PATH # # This macro calls: # # AC_SUBST(MYSQL_INCLUDE) # AC_SUBST(MYSQL_CFLAGS) # AC_SUBST(MYSQL_LDFLAGS) # AC_SUBST(MYSQL_VERSION) # # And sets: # # HAVE_MYSQL # # LICENSE # # Copyright (c) 2008 Mateusz Loskot # # 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. This file is offered as-is, without any # warranty. #serial 13 AC_DEFUN([AX_LIB_MYSQL], [ AC_ARG_WITH([mysql], AS_HELP_STRING([--with-mysql=@<:@ARG@:>@], [use MySQL client library @<:@default=yes@:>@, optionally specify path to mysql_config] ), [ if test "$withval" = "no"; then want_mysql="no" elif test "$withval" = "yes"; then want_mysql="yes" else want_mysql="yes" MYSQL_CONFIG="$withval" fi ], [want_mysql="yes"] ) AC_ARG_VAR([MYSQL_CONFIG], [Full path to mysql_config program]) MYSQL_INCLUDE="" MYSQL_CFLAGS="" MYSQL_LDFLAGS="" MYSQL_VERSION="" dnl dnl Check MySQL libraries dnl if test "$want_mysql" = "yes"; then if test -z "$MYSQL_CONFIG" ; then AC_PATH_PROGS([MYSQL_CONFIG], [mysql_config mysql_config5], [no]) fi if test "$MYSQL_CONFIG" != "no"; then MYSQL_INCLUDE="`$MYSQL_CONFIG --include`" MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`" MYSQL_VERSION=`$MYSQL_CONFIG --version` found_mysql="yes" else found_mysql="no" fi fi dnl dnl Check if required version of MySQL is available dnl mysql_version_req=ifelse([$1], [], [], [$1]) if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then AC_MSG_CHECKING([if MySQL version is >= $mysql_version_req]) dnl Decompose required version string of MySQL dnl and calculate its number representation mysql_version_req_major=`expr $mysql_version_req : '\([[0-9]]*\)'` mysql_version_req_minor=`expr $mysql_version_req : '[[0-9]]*\.\([[0-9]]*\)'` mysql_version_req_micro=`expr $mysql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$mysql_version_req_micro" = "x"; then mysql_version_req_micro="0" fi mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \ \+ $mysql_version_req_minor \* 1000 \ \+ $mysql_version_req_micro` dnl Decompose version string of installed MySQL dnl and calculate its number representation mysql_version_major=`expr $MYSQL_VERSION : '\([[0-9]]*\)'` mysql_version_minor=`expr $MYSQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'` mysql_version_micro=`expr $MYSQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$mysql_version_micro" = "x"; then mysql_version_micro="0" fi mysql_version_number=`expr $mysql_version_major \* 1000000 \ \+ $mysql_version_minor \* 1000 \ \+ $mysql_version_micro` mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number` if test "$mysql_version_check" = "1"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi fi if test "$found_mysql" = "yes" ; then AC_DEFINE([HAVE_MYSQL], [1], [Define to 1 if MySQL libraries are available]) fi AC_SUBST([MYSQL_VERSION]) AC_SUBST([MYSQL_INCLUDE]) AC_SUBST([MYSQL_CFLAGS]) AC_SUBST([MYSQL_LDFLAGS]) ]) gearmand-1.0.6/libtest/framework.h0000664000076400007640000001070512140641603017372 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include /** 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. */ #include namespace { class Collection; } typedef std::vector Suites; namespace libtest { class Framework { public: public: test_return_t create(); const std::string& name() const { return _name; } void create(test_callback_create_fn* arg) { _create= arg; } void destroy(test_callback_destroy_fn* arg) { _destroy= arg; } void collections(collection_st arg[]); void set_on_error(test_callback_error_fn *arg) { _on_error= arg; } test_return_t on_error(const enum test_return_t, void *); void set_socket() { _servers.set_socket(); } void set_sasl(const std::string& username_arg, const std::string& password_arg) { _servers.set_sasl(username_arg, password_arg); } libtest::server_startup_st& servers() { return _servers; } void set_runner(libtest::Runner *arg) { _runner= arg; } libtest::Runner *runner(); void exec(); libtest::Collection& collection(); virtual ~Framework(); Framework(libtest::SignalThread&, const std::string&, const std::string&, const std::string&); bool match(const char* arg); void *creators_ptr() { return _creators_ptr; } libtest::SignalThread& signal() { return _signal; } uint32_t sum_total(); uint32_t sum_success(); uint32_t sum_skipped(); uint32_t sum_failed(); size_t size() { return _collection.size(); } uint32_t total() const { return _total; } uint32_t success() const { return _success; } uint32_t skipped() const { return _skipped; } uint32_t failed() const { return _failed; } Suites& suites() { return _collection; } private: uint32_t _total; uint32_t _success; uint32_t _skipped; uint32_t _failed; /* These methods are called outside of any collection call. */ test_callback_create_fn *_create; test_callback_destroy_fn *_destroy; /** 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. */ libtest::Runner *_runner; libtest::server_startup_st _servers; bool _socket; void *_creators_ptr; unsigned long int _servers_to_run; Suites _collection; libtest::SignalThread& _signal; std::string _only_run; std::string _wildcard; std::string _name; private: Framework( const Framework& ); const Framework& operator=( const Framework& ); }; } // namespace libtest gearmand-1.0.6/libtest/tmpfile.hpp0000664000076400007640000000343612107145705017405 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include namespace libtest { std::string create_tmpfile(const std::string&); } // namespace libtest gearmand-1.0.6/libtest/exception.cc0000664000076400007640000000616712140635746017553 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012-2013 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 "libtest/yatlcon.h" #include #include namespace libtest { exception::exception(const char *file_arg, int line_arg, const char *func_arg): std::exception(), _line(line_arg), _file(file_arg), _func(func_arg), _error_message(NULL), _error_message_size(0) { } #ifndef __INTEL_COMPILER # pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif void exception::init(va_list args_) { const char *format= va_arg(args_, const char *); int error_message_length= vasprintf(&_error_message, format, args_); assert(error_message_length != -1); if (error_message_length > 0) { _error_message_size= error_message_length +1; } } exception::~exception() throw() { if (_error_message) { free(_error_message); } } void exception::what(size_t length_, const char* message_) { if (length_ > 0 and message_) { char *ptr= (char*) realloc(_error_message, length_ +1); if (ptr) { _error_message= ptr; memcpy(_error_message, message_, length_); _error_message[length_]= 0; } } } exception::exception(const exception& other) : std::exception(), _line(other._line), _file(other._file), _func(other._func), _error_message_size(0) { if (other.length() > 0) { _error_message= (char*) malloc(other.length() +1); if (_error_message) { memcpy(_error_message, other._error_message, other.length()); _error_message_size= other.length(); } } } } // namespace libtest gearmand-1.0.6/libtest/yatl.h0000664000076400007640000000335612107145705016357 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #ifndef YATL_FULL # define YATL_FULL 1 #endif #include gearmand-1.0.6/libtest/runner.h0000664000076400007640000000475212107145705016720 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { /** Structure which houses the actual callers for the test cases contained in the collections. */ class Runner { public: test_return_t main(test_callback_fn* func, void *object); test_return_t setup(test_callback_fn* func, void *object); test_return_t teardown(test_callback_fn* func, void *object); Runner(); void set_servers(libtest::server_startup_st& arg); bool check(); virtual ~Runner() { } virtual test_return_t flush(void*); virtual test_return_t run(test_callback_fn* func, void *object); virtual test_return_t pre(test_callback_fn* func, void *object); virtual test_return_t post(test_callback_fn* func, void *object); private: libtest::server_startup_st* _servers; private: Runner( const Runner& ); const Runner& operator=( const Runner& ); }; } // namespace Runner gearmand-1.0.6/libtest/alarm.cc0000664000076400007640000000575312133165126016641 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include namespace libtest { static const struct timeval default_it_value= { 600, 0 }; static const struct timeval default_it_interval= { 0, 0 }; static const struct itimerval defualt_timer= { default_it_interval, default_it_value }; static const struct itimerval cancel_timer= { default_it_interval, default_it_interval }; void set_alarm() { if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1) { Error << "setitimer() failed"; } } void set_alarm(long tv_sec, long tv_usec) { // For the moment use any value to YATL_ALARM to cancel alarming. if (getenv("YATL_ALARM")) { errno= 0; tv_sec= strtol(getenv("YATL_ALARM"), (char **) NULL, 10); if (errno != 0) { FATAL("Bad value for YATL_ALARM"); } else if (tv_sec == 0) { cancel_alarm(); } } #ifdef __APPLE__ struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) }; #else struct timeval it_value= { tv_sec, tv_usec }; #endif struct itimerval timer= { default_it_interval, it_value }; if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1) { Error << "setitimer() failed"; } } void cancel_alarm() { if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1) { Error << "setitimer() failed"; } } } // namespace libtest gearmand-1.0.6/libtest/alarm.h0000664000076400007640000000344312131717620016475 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { void set_alarm(long tv_sec, long tv_usec); void set_alarm(); void cancel_alarm(); } // namespace libtest gearmand-1.0.6/libtest/vchar.hpp0000664000076400007640000000475612122444522017052 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #include #include #include #include namespace libtest { int random_alpha_num(void); typedef std::vector vchar_ptr_t; typedef std::vector vchar_t; void make_vector(libtest::vchar_t& arg, const char *str, size_t length); namespace vchar { int compare(libtest::vchar_t& arg, const char *str, size_t length); void chomp(libtest::vchar_t& arg); void make(libtest::vchar_t& arg); void make(libtest::vchar_t& arg, size_t length); void append(libtest::vchar_ptr_t& arg, const char*); void append(libtest::vchar_t& arg, const char*); } // namespace vchar #define vchar_param(__arg) (&__arg[0]), (__arg.size()) #define vchar_printf(__arg) int(__arg.size()), (&__arg[0]) std::ostream& operator<<(std::ostream& output, const libtest::vchar_t& arg); } // namespace libtest gearmand-1.0.6/libtest/skiptest.cc0000664000076400007640000000371212107145705017406 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include using namespace libtest; static void *world_create(server_startup_st&, test_return_t& rc) { rc= TEST_SKIPPED; return NULL; } void get_world(libtest::Framework *world) { world->create(world_create); } gearmand-1.0.6/libtest/port.h0000664000076400007640000000362212107145705016366 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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. * */ /* Structures for generic tests. */ #pragma once #define LIBTEST_FAIL_PORT 23 namespace libtest { LIBTEST_API in_port_t default_port(); LIBTEST_API in_port_t get_free_port(); LIBTEST_API void release_port(in_port_t arg); } // namespace libtest gearmand-1.0.6/libtest/killpid.cc0000664000076400007640000001240112107145705017163 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #include #include #include #include #include #include #include #include using namespace libtest; bool kill_pid(pid_t pid_arg) { assert(pid_arg > 0); if (pid_arg < 1) { Error << "Invalid pid:" << pid_arg; return false; } if ((::kill(pid_arg, SIGTERM) == -1)) { switch (errno) { case EPERM: Error << "Does someone else have a process running locally for " << int(pid_arg) << "?"; return false; case ESRCH: Error << "Process " << int(pid_arg) << " not found."; return false; default: case EINVAL: Error << "kill() " << strerror(errno); return false; } } { uint32_t this_wait= 0; uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow) uint32_t waited; uint32_t retry; for (waited= 0, retry= 1; ; retry++, waited+= this_wait) { int status= 0; if (waitpid(pid_arg, &status, WNOHANG) == 0) { break; } else if (errno == ECHILD) { // Server has already gone away break; } else if (waited >= timeout) { // Timeout failed kill(pid_arg, SIGKILL); break; } this_wait= retry * retry / 3 + 1; libtest::dream(this_wait, 0); } } return true; } bool check_pid(const std::string &filename) { if (filename.empty()) { return false; } FILE *fp; if ((fp= fopen(filename.c_str(), "r"))) { libtest::vchar_t pid_buffer; pid_buffer.resize(1024); char *ptr= fgets(&pid_buffer[0], int(pid_buffer.size()), fp); fclose(fp); if (ptr) { pid_t pid= (pid_t)atoi(&pid_buffer[0]); if (pid > 0) { return (::kill(pid, 0) == 0); } } } return false; } bool kill_file(const std::string &filename) { if (filename.empty()) { return true; } FILE *fp; if ((fp= fopen(filename.c_str(), "r"))) { libtest::vchar_t pid_buffer; pid_buffer.resize(1024); char *ptr= fgets(&pid_buffer[0], int(pid_buffer.size()), fp); fclose(fp); if (ptr) { pid_t pid= (pid_t)atoi(&pid_buffer[0]); if (pid != 0) { bool ret= kill_pid(pid); unlink(filename.c_str()); // If this happens we may be dealing with a dead server that left its pid file. return ret; } } } return false; } #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) #define LIBTEST_AT __FILE__ ":" TOSTRING(__LINE__) pid_t get_pid_from_file(const std::string &filename, std::stringstream& error_message) { pid_t ret= -1; if (filename.empty()) { error_message << LIBTEST_AT << " empty pid file"; return ret; } FILE *fp; if ((fp= fopen(filename.c_str(), "r"))) { libtest::vchar_t pid_buffer; pid_buffer.resize(1024); char *ptr= fgets(&pid_buffer[0], int(pid_buffer.size()), fp); if (ptr) { ret= (pid_t)atoi(&pid_buffer[0]); if (ret < 1) { error_message << LIBTEST_AT << " Invalid pid was read from file " << filename; } } else { error_message << LIBTEST_AT << " File " << filename << " was empty "; } fclose(fp); return ret; } else { libtest::vchar_t buffer; buffer.resize(1024); char *current_directory= getcwd(&buffer[0], buffer.size()); error_message << "Error while opening " << current_directory << "/" << filename << " " << strerror(errno); } return ret; } gearmand-1.0.6/libtest/error.h0000664000076400007640000000362612107145705016537 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 enum test_return_t { TEST_SUCCESS, TEST_FAILURE, TEST_SKIPPED }; static inline bool test_success(test_return_t rc) { return (rc == TEST_SUCCESS); } static inline bool test_failed(test_return_t rc) { return (rc != TEST_SUCCESS); } gearmand-1.0.6/libtest/exception.hpp0000664000076400007640000000464612140635754017754 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012-2013 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 namespace libtest { class exception : public std::exception { public: exception(const char *file, int line, const char *func); exception( const exception& ); virtual ~exception() throw(); virtual const char* what() const throw() { if (_error_message) { return _error_message; } return ""; } void what(size_t, const char*); size_t length() const { return _error_message_size; } int line() const { return _line; } const char* file() const { return _file; } const char* func() const { return _func; } protected: void init(va_list); private: int _line; const char* _file; const char* _func; char* _error_message; size_t _error_message_size; }; } // namespace libtest gearmand-1.0.6/libtest/backtrace_test.cc0000664000076400007640000000574512107145705020526 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #include "libgearman/backtrace.hpp" class Test { public: Test() { } void call_backtrace() { std::cerr << __func__ << std::endl; custom_backtrace(); } }; void SIGSEGV_handler(int sig_num, siginfo_t* info, void* ucontext) { std::cerr << __func__ << std::endl; (void)sig_num; (void)info; (void)ucontext; custom_backtrace(); } int raise_SIGSEGV() { std::cerr << std::endl << "Calling backtrace()" << std::endl; custom_backtrace(); std::cerr << std::endl << "Calling raise()" << std::endl; return raise(SIGSEGV); } int layer4() { return raise_SIGSEGV(); } int layer3() { return layer4(); } int layer2() { return layer3(); } int layer1() { return layer2(); } int main(int, char **) { Test t; t.call_backtrace(); struct sigaction sigact; sigact.sa_sigaction= SIGSEGV_handler; sigact.sa_flags= SA_RESTART | SA_SIGINFO; if (sigaction(SIGSEGV, &sigact, (struct sigaction *)NULL) != 0) { std::cerr << "error setting signal handler for " << strsignal(SIGSEGV) << "(" << SIGSEGV << ")" << std::endl; exit(EXIT_FAILURE); } int ret= layer1(); if (ret) { std::cerr << "raise() " << strerror(errno) << std::endl; exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } gearmand-1.0.6/libtest/client.hpp0000664000076400007640000000477412131717610017226 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { class SimpleClient { public: SimpleClient(const std::string& hostname_, in_port_t port_); ~SimpleClient(); bool send_data(const libtest::vchar_t&, libtest::vchar_t&); bool send_message(const std::string&); bool send_message(const std::string&, std::string&); bool response(std::string&); bool response(libtest::vchar_t&); bool is_valid(); const std::string& error() const { return _error; } bool is_error() const { return _error.size() ? true : false; } private: // Methods void close_socket(); bool instance_connect(); struct addrinfo* lookup(); bool message(const char* ptr, const size_t len); bool ready(int event_); private: bool _is_connected; std::string _hostname; in_port_t _port; int sock_fd; std::string _error; int requested_message; }; } // namespace libtest gearmand-1.0.6/libtest/socket.hpp0000664000076400007640000000343612107145705017235 0ustar00brianbrian00000000000000 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { const char *default_socket(); void set_default_socket(const char *socket); } // namespace libtest gearmand-1.0.6/libtest/dream.cc0000664000076400007640000000375712133165126016637 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include namespace libtest { void dream(time_t tv_sec, long tv_nsec) { #if defined(WIN32) if (tv_sec == 0 and tv_nsec) { tv_sec++; } sleep(tv_sec); #else struct timespec requested; requested.tv_sec= tv_sec; requested.tv_nsec= tv_nsec; nanosleep(&requested, NULL); #endif } } gearmand-1.0.6/libtest/callbacks.h0000664000076400007640000000411012131732625017312 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #ifdef __cplusplus extern "C" { #endif typedef void* (test_callback_create_fn)(libtest::server_startup_st&, test_return_t&); typedef bool test_callback_destroy_fn(void *); 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 test_return_t, void *); #ifdef __cplusplus } #endif gearmand-1.0.6/libtest/gearmand.cc0000664000076400007640000000770312107145705017322 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include using namespace libtest; #include #include #include #include #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif using namespace libtest; class Gearmand : public libtest::Server { private: public: Gearmand(const std::string& host_arg, in_port_t port_arg, bool libtool_, const char* binary); bool ping() { reset_error(); if (out_of_ban_killed()) { return false; } SimpleClient client(_hostname, _port); std::string response; bool ret= client.send_message("version", response); if (client.is_error()) { error(client.error()); } return ret; } const char *name() { return "gearmand"; }; void log_file_option(Application& app, const std::string& arg) { if (arg.empty() == false) { std::string buffer("--log-file="); buffer+= arg; app.add_option("--verbose=DEBUG"); app.add_option(buffer); } } bool has_log_file_option() const { return true; } bool is_libtool() { return true; } bool has_syslog() const { return false; // --syslog.errmsg-enable } bool has_port_option() const { return true; } bool build(); }; Gearmand::Gearmand(const std::string& host_arg, in_port_t port_arg, bool libtool_, const char* binary_arg) : libtest::Server(host_arg, port_arg, binary_arg, libtool_) { set_pid_file(); } bool Gearmand::build() { if (getuid() == 0 or geteuid() == 0) { add_option("-u", "root"); } add_option("--listen=localhost"); return true; } namespace libtest { libtest::Server *build_gearmand(const char *hostname, in_port_t try_port, const char* binary) { if (binary == NULL) { #if defined(HAVE_GEARMAND_BINARY) # if defined(GEARMAND_BINARY) if (HAVE_GEARMAND_BINARY) { binary= GEARMAND_BINARY; } # endif #endif } if (binary == NULL) { return NULL; } bool is_libtool_script= true; if (binary[0] == '/') { is_libtool_script= false; } return new Gearmand(hostname, try_port, is_libtool_script, binary); } } gearmand-1.0.6/libtest/blobslap_worker.cc0000664000076400007640000000741312107145705020731 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif namespace libtest { class BlobslapWorker : public Server { private: public: BlobslapWorker(in_port_t port_arg) : Server("localhost", port_arg, "benchmark/blobslap_worker", true) { set_pid_file(); } pid_t get_pid(bool error_is_ok) { if (pid_file().empty()) { Error << "pid_file was empty"; return -1; } Wait wait(pid_file(), 0); if (error_is_ok and not wait.successful()) { Error << "Pidfile was not found:" << pid_file(); return -1; } std::stringstream error_message; pid_t ret= get_pid_from_file(pid_file(), error_message); if (error_is_ok and is_pid_valid(ret) == false) { Error << error_message.str(); } return ret; } bool ping() { if (pid_file().empty()) { Error << "No pid file available"; return false; } Wait wait(pid_file(), 0); if (not wait.successful()) { Error << "Pidfile was not found:" << pid_file(); return false; } std::stringstream error_message; pid_t local_pid= get_pid_from_file(pid_file(), error_message); if (is_pid_valid(local_pid) == false) { Error << error_message.str(); return false; } // Use kill to determine is the process exist if (::kill(local_pid, 0) == 0) { return true; } return false; } const char *name() { return "blobslap_worker"; }; bool has_port_option() const { return true; } bool has_log_file_option() const { return true; } bool is_libtool() { return true; } bool build(); }; #include bool BlobslapWorker::build() { return true; } Server *build_blobslap_worker(in_port_t try_port) { return new BlobslapWorker(try_port); } } // namespace libtest gearmand-1.0.6/libtest/libtool.cc0000664000076400007640000000453412107145705017207 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include #include char _libtool[1024]= { 0 }; namespace libtest { const char *libtool(void) { if (_libtool[0] == 0) { std::string libtool_buffer; if (getenv("PWD")) { libtool_buffer+= getenv("PWD"); libtool_buffer+= "/"; } else { libtool_buffer+= "./"; } libtool_buffer+= "libtool"; if (access(libtool_buffer.c_str(), R_OK | W_OK | X_OK)) { Error << "Could not find libtool via access(" << libtool_buffer << ") :" << strerror(errno); return NULL; } snprintf(_libtool, sizeof(_libtool), "%s", libtool_buffer.c_str()); } return _libtool; } } // namespace libtest gearmand-1.0.6/libtest/memcached.h0000664000076400007640000000357112107145705017313 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port); libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port); } gearmand-1.0.6/libtest/gearmand.h0000664000076400007640000000350612107145705017161 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 namespace libtest { struct Server; } namespace libtest { libtest::Server *build_gearmand(const char *hostname, in_port_t try_port, const char* binary= NULL); } gearmand-1.0.6/libtest/server_container.cc0000664000076400007640000002152012140642073021102 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 "libtest/yatlcon.h" #include "libtest/common.h" #include #include #include #include #include #include // trim from end static inline std::string &rtrim(std::string &s) { s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); return s; } namespace libtest { Server* server_startup_st::last() { return servers.back(); } void server_startup_st::push_server(Server *arg) { servers.push_back(arg); std::string server_config_string; if (arg->has_socket()) { server_config_string+= "--socket="; server_config_string+= '"'; server_config_string+= arg->socket(); server_config_string+= '"'; server_config_string+= " "; } else { libtest::vchar_t port_str; port_str.resize(NI_MAXSERV); snprintf(&port_str[0], port_str.size(), "%u", int(arg->port())); server_config_string+= "--server="; server_config_string+= arg->hostname(); server_config_string+= ":"; server_config_string+= &port_str[0]; server_config_string+= " "; } server_list+= server_config_string; } Server* server_startup_st::pop_server() { Server *tmp= servers.back(); servers.pop_back(); return tmp; } // host_to_shutdown => host number to shutdown in array bool server_startup_st::shutdown(uint32_t host_to_shutdown) { if (servers.size() > host_to_shutdown) { Server* tmp= servers[host_to_shutdown]; if (tmp and tmp->kill() == false) { } else { return true; } } return false; } void server_startup_st::clear() { std::for_each(servers.begin(), servers.end(), DeleteFromVector()); servers.clear(); } bool server_startup_st::check() const { bool success= true; for (std::vector::const_iterator iter= servers.begin(); iter != servers.end(); ++iter) { if ((*iter)->check() == false) { success= false; } } return success; } bool server_startup_st::shutdown() { bool success= true; for (std::vector::iterator iter= servers.begin(); iter != servers.end(); ++iter) { if ((*iter)->has_pid() and (*iter)->kill() == false) { Error << "Unable to kill:" << *(*iter); success= false; } } return success; } void server_startup_st::restart() { for (std::vector::iterator iter= servers.begin(); iter != servers.end(); ++iter) { (*iter)->start(); } } #define MAGIC_MEMORY 123575 server_startup_st::server_startup_st() : _magic(MAGIC_MEMORY), _socket(false), _sasl(false), udp(0), _servers_to_run(5) { } server_startup_st::~server_startup_st() { clear(); } bool server_startup_st::validate() { return _magic == MAGIC_MEMORY; } bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, const char *argv[]) { return construct.start_server(server_type, try_port, argv); } libtest::Server* server_startup_st::create(const std::string& server_type, in_port_t try_port, const bool is_socket) { libtest::Server *server= NULL; if (is_socket == false) { if (try_port <= 0) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "was passed the invalid port number %d", int(try_port)); } } if (is_socket) { if (server_type.compare("memcached") == 0) { server= build_memcached_socket("localhost", try_port); } else { Error << "Socket is not support for server: " << server_type; return NULL; } } else if (server_type.compare("gearmand") == 0) { server= build_gearmand("localhost", try_port); } else if (server_type.compare("hostile-gearmand") == 0) { server= build_gearmand("localhost", try_port, "gearmand/hostile_gearmand"); } else if (server_type.compare("drizzled") == 0) { if (has_drizzled()) { if (has_libdrizzle()) { server= build_drizzled("localhost", try_port); } } } else if (server_type.compare("blobslap_worker") == 0) { if (has_gearmand()) { #ifdef GEARMAND_BLOBSLAP_WORKER if (GEARMAND_BLOBSLAP_WORKER) { if (HAVE_LIBGEARMAN) { server= build_blobslap_worker(try_port); } } #endif // GEARMAND_BLOBSLAP_WORKER } } else if (server_type.compare("memcached") == 0) { if (has_memcached()) { server= build_memcached("localhost", try_port); } } return server; } class ServerPtr { public: ServerPtr(libtest::Server* server_): _server(server_) { } ~ServerPtr() { delete _server; } void reset() { delete _server; _server= NULL; } libtest::Server* release(libtest::Server* server_= NULL) { libtest::Server* tmp= _server; _server= server_; return tmp; } libtest::Server* operator->() const { return _server; } libtest::Server* operator&() const { return _server; } private: libtest::Server* _server; }; bool server_startup_st::_start_server(const bool is_socket, const std::string& server_type, in_port_t try_port, const char *argv[]) { try { ServerPtr server(create(server_type, try_port, is_socket)); if (&server == NULL) { Error << "Could not allocate server: " << server_type; return false; } /* We will now cycle the server we have created. */ if (server->cycle() == false) { Error << "Could not start up server " << &server; return false; } server->init(argv); #if 0 if (false) { Out << "Pausing for startup, hit return when ready."; std::string gdb_command= server->base_command(); getchar(); } else #endif if (server->start() == false) { return false; } else { { #ifdef DEBUG if (DEBUG) { Outn(); Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running(); Outn(); } #endif } } push_server(server.release()); if (is_socket and &server) { set_default_socket(server->socket().c_str()); } } catch (const libtest::disconnected& err) { if (fatal::is_disabled() == false and try_port != LIBTEST_FAIL_PORT) { stream::cerr(err.file(), err.line(), err.func()) << err.what(); return false; } } catch (const libtest::__test_result& err) { stream::cerr(err.file(), err.line(), err.func()) << err.what(); return false; } catch (const std::exception& err) { Error << err.what(); return false; } catch (...) { Error << "error occured while creating server: " << server_type; return false; } return true; } bool server_startup_st::start_server(const std::string& server_type, in_port_t try_port, const char *argv[]) { return _start_server(false, server_type, try_port, argv); } bool server_startup_st::start_socket_server(const std::string& server_type, const in_port_t try_port, const char *argv[]) { return _start_server(true, server_type, try_port, argv); } std::string server_startup_st::option_string() const { std::string temp= server_list; rtrim(temp); return temp; } } // namespace libtest gearmand-1.0.6/libtest/killpid.h0000664000076400007640000000370012107145705017027 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 bool kill_pid(pid_t pid_arg); bool kill_file(const std::string &filename); bool check_pid(const std::string &filename); pid_t get_pid_from_file(const std::string &filename, std::stringstream& error_message); static inline bool check_pid(pid_t pid_arg) { return (pid_arg > 1); } gearmand-1.0.6/libtest/drizzled.h0000664000076400007640000000355312107145705017234 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include namespace libtest { struct Server; } namespace libtest { libtest::Server *build_drizzled(const char *hostname, in_port_t try_port); bool ping_drizzled(const in_port_t); } gearmand-1.0.6/libtest/poll_error.hpp0000664000076400007640000000510212107145705020114 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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. * */ /* Structures for generic tests. */ #include #include void print_poll(pollfd& fds) { if (fds.revents & POLLERR) { fprintf(stderr, "\tPOLLERR\n"); } if (fds.revents & POLLHUP) { fprintf(stderr, "\tPOLLHUP\n"); } if (fds.revents & POLLIN) { fprintf(stderr, "\tPOLLIN\n"); } if (fds.revents & POLLIN) { fprintf(stderr, "\tPOLLIN\n"); } if (fds.revents & POLLNVAL) { fprintf(stderr, "\tPOLLNVAL\n"); } if (fds.revents & POLLOUT) { fprintf(stderr, "\tPOLLOUT\n"); } if (fds.revents & POLLPRI) { fprintf(stderr, "\tPOLLPRI\n"); } if (fds.revents & POLLRDBAND) { fprintf(stderr, "\tPOLLPRI\n"); } if (fds.revents & POLLRDNORM) { fprintf(stderr, "\tPOLLRDNORM\n"); } if (fds.revents & POLLWRBAND) { fprintf(stderr, "\tPOLLWRBAND\n"); } if (fds.revents & POLLWRNORM) { fprintf(stderr, "\tPOLLWRNORM\n"); } } gearmand-1.0.6/libtest/thread.hpp0000664000076400007640000001461012107145705017210 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include namespace libtest { namespace thread { class Mutex { public: Mutex() : _err(0) { _err= pthread_mutex_init(&_mutex, NULL); } ~Mutex() { if ((_err= pthread_mutex_destroy(&_mutex))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_cond_destroy: %s", strerror(_err)); } } pthread_mutex_t* handle() { if (_err != 0) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_mutex_init: %s", strerror(_err)); } return &_mutex; } private: int _err; pthread_mutex_t _mutex; }; class ScopedLock { public: ScopedLock(Mutex& mutex_) : _mutex(mutex_) { init(); } ~ScopedLock() { int err; if ((err= pthread_mutex_unlock(_mutex.handle()))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_mutex_unlock: %s", strerror(err)); } } Mutex* handle() { return &_mutex; } private: void init() { int err; if ((err= pthread_mutex_lock(_mutex.handle()))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_mutex_lock: %s", strerror(err)); } } private: Mutex& _mutex; }; class Condition { public: Condition() { int err; if ((err= pthread_cond_init(&_cond, NULL))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_mutex_init: %s", strerror(err)); } } ~Condition() { int err; if ((err= pthread_cond_destroy(&_cond))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_cond_destroy: %s", strerror(err)); } } void broadcast() { int err; if ((err= pthread_cond_broadcast(&_cond))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_cond_broadcast: %s", strerror(err)); } } void signal() { int err; if ((err= pthread_cond_signal(&_cond))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_cond_broadcast: %s", strerror(err)); } } void wait(ScopedLock& lock_) { int err; if ((err= pthread_cond_wait(&_cond, lock_.handle()->handle()))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_cond_wait: %s", strerror(err)); } } private: pthread_cond_t _cond; }; class Barrier { public: explicit Barrier(uint32_t count): _threshold(count), _count(count), _generation(0) { if (_count == 0) { fatal_assert("Zero is an invalid value"); } } ~Barrier() { } bool wait() { ScopedLock l(_mutex); uint32_t gen = _generation; if (--_count == 0) { _generation++; _count = _threshold; _cond.broadcast(); return true; } while (gen == _generation) { _cond.wait(l); } return false; } private: Mutex _mutex; Condition _cond; uint32_t _threshold; uint32_t _count; uint32_t _generation; }; class Thread { private: typedef void *(*start_routine_fn) (void *); public: template Thread(Function func, Arg1 arg): _joined(false), _func((start_routine_fn)func), _context(arg) { int err; if ((err= pthread_create(&_thread, NULL, entry_func, (void*)this))) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_create: %s", strerror(err)); } _owner= pthread_self(); } bool running() const { return (pthread_kill(_thread, 0) == 0); } bool detached() { if (EDEADLK == pthread_join(_thread, NULL)) { return true; } /* Result of pthread_join was EINVAL == detached thread */ return false; } bool join() { if (_thread == pthread_self()) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Thread cannot join on itself"); } if (_owner != pthread_self()) { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Attempt made by a non-owner thead to join on thread"); } bool ret= false; { ScopedLock l(_join_mutex); if (_joined == false) { int err; if ((err= pthread_join(_thread, NULL))) { switch(err) { case EINVAL: break; case ESRCH: ret= true; break; case EDEADLK: default: throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "pthread_join: %s", strerror(err)); } } else { ret= true; } _joined= true; } } return ret; } ~Thread() { join(); } protected: void run() { _func(_context); } private: static void * entry_func(void* This) { ((Thread *)This)->run(); return NULL; } private: bool _joined; pthread_t _thread; pthread_t _owner; start_routine_fn _func; void* _context; Mutex _join_mutex; }; } // namespace thread } // namespace libtest gearmand-1.0.6/libtest/stream.h0000664000076400007640000001332412107145705016675 0ustar00brianbrian00000000000000/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Data Differential YATL (i.e. libtest) library * * Copyright (C) 2012 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 #include #include #include #include #include namespace libtest { namespace stream { namespace detail { template class channel { private: public: typedef std::basic_ostringstream stream_buffer; public: void operator()(const stream_buffer& s, std::ostream& _out, const char* filename, int line_number, const char* func) { if (filename) { _out << filename << ":" << line_number << ": in " << func << "() " << s.str() << std::endl; } else { _out << s.str() << std::endl; } } }; template class channelln { private: public: typedef std::basic_ostringstream stream_buffer; public: void operator()(const stream_buffer& s, std::ostream& _out, const char* filename, int line_number, const char* func) { if (filename) { _out << std::endl << filename << ":" << line_number << ": in " << func << "() " << s.str() << std::endl; } else { _out << std::endl << s.str() << std::endl; } } }; template