Browse Source

Cleanup header files.

Brian Aker 14 years ago
parent
commit
cc5d52da16

+ 2 - 1
benchmark/benchmark.c

@@ -11,7 +11,8 @@
  * @brief Common benchmark functions
  */
 
-#include "benchmark.h"
+#include <benchmark/benchmark.h>
+#include <stdio.h>
 
 /*
  * Public definitions

+ 2 - 1
benchmark/blobslap_client.c

@@ -11,7 +11,8 @@
  * @brief Blob slap client utility
  */
 
-#include "benchmark.h"
+#include <benchmark/benchmark.h>
+#include <stdio.h>
 
 #define BLOBSLAP_DEFAULT_NUM_TASKS 10
 #define BLOBSLAP_DEFAULT_BLOB_MIN_SIZE 0

+ 3 - 1
benchmark/blobslap_worker.c

@@ -11,7 +11,9 @@
  * @brief Blob slap worker utility
  */
 
-#include "benchmark.h"
+#include <benchmark/benchmark.h>
+#include <errno.h>
+#include <stdio.h>
 
 static void *worker_fn(gearman_job_st *job, void *context,
                        size_t *result_size, gearman_return_t *ret_ptr);

+ 46 - 4
configure.ac

@@ -10,6 +10,7 @@ AC_PREREQ(2.59)
 AC_INIT([gearmand],[0.19],[https://launchpad.net/gearmand])
 AC_CONFIG_SRCDIR(libgearman/gearman.c)
 AC_CONFIG_AUX_DIR(config)
+AC_CONFIG_MACRO_DIR(m4)
 
 PANDORA_CANONICAL_TARGET(require-cxx)
 
@@ -27,7 +28,7 @@ GEARMAN_LIBRARY_VERSION=5:1:1
 #                +- increment if interfaces have been added, removed or changed
 AC_SUBST(GEARMAN_LIBRARY_VERSION)
 
-BOOST_REQUIRE
+BOOST_REQUIRE(1.37.0)
 BOOST_PROGRAM_OPTIONS(mt-)
 
 
@@ -45,11 +46,52 @@ PANDORA_HAVE_LIBTOKYOCABINET
 AC_FUNC_STRERROR_R
 SOCKET_SEND_FLAGS
 
-AC_CHECK_HEADERS(errno.h fcntl.h getopt.h netinet/tcp.h pwd.h signal.h)
-AC_CHECK_HEADERS(stdarg.h stddef.h stdio.h stdlib.h string.h)
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_AWK
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_RANLIB
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h netinet/tcp.h)
+AC_CHECK_HEADERS(errno.h getopt.h pwd.h signal.h)
+AC_CHECK_HEADERS(stdarg.h stddef.h stdio.h)
 AC_CHECK_HEADERS(sys/resource.h sys/stat.h)
-AC_CHECK_HEADERS(sys/socket.h sys/types.h sys/utsname.h unistd.h strings.h)
+AC_CHECK_HEADERS(sys/socket.h sys/types.h sys/utsname.h strings.h)
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_INT32_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_HEADER_TIME
+AC_TYPE_UID_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_UINT8_T
+AC_C_VOLATILE
+AC_CHECK_TYPES([ptrdiff_t])
 
+# Checks for library functions.
+AC_FUNC_ERROR_AT_LINE
+AC_REPLACE_FNMATCH
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_REALLOC
+AC_TYPE_SIGNAL
+AC_FUNC_STRERROR_R
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([dup2 gettimeofday memchr memmove memset socket strcasecmp strdup strerror strncasecmp uname])
 
 AC_CONFIG_FILES(Makefile
                 libgearman/configure.h

+ 4 - 28
gearmand/gearmand.cc

@@ -6,43 +6,20 @@
  * the COPYING file in the parent directory for full text.
  */
 
-#include "config.h"
+#include <config.h>
 
-#include <stdint.h>
-
-#ifdef HAVE_ERRNO_H
 #include <errno.h>
-#endif
-#ifdef HAVE_FCNTL_H
 #include <fcntl.h>
-#endif
-#ifdef HAVE_PWD_H
 #include <pwd.h>
-#endif
-#ifdef HAVE_SIGNAL_H
 #include <signal.h>
-#endif
-#ifdef HAVE_STDIO_H
+#include <stdint.h>
 #include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifdef TIME_WITH_SYS_TIME
 # include <sys/time.h>
@@ -60,7 +37,6 @@
 #include <libgearman-server/queue.h>
 
 #define GEARMAND_LOG_REOPEN_TIME 60
-#define GEARMAND_LISTEN_BACKLOG 32
 
 #include "util/daemon.h"
 #include "util/pidfile.h"
@@ -128,7 +104,7 @@ static void _log(const char *line, gearmand_verbose_t verbose, void *context);
 
 int main(int argc, char *argv[])
 {
-  int backlog= GEARMAND_LISTEN_BACKLOG;
+  int backlog;
   rlim_t fds= 0;
   uint32_t job_retries;
   uint32_t worker_wakeup;
@@ -150,7 +126,7 @@ int main(int argc, char *argv[])
   boost::program_options::options_description general("General options");
 
   general.add_options()
-  ("backlog,b", boost::program_options::value(&backlog)->default_value(GEARMAND_LISTEN_BACKLOG),
+  ("backlog,b", boost::program_options::value(&backlog)->default_value(32),
    "Number of backlog connections for listen.")
   ("check-args", boost::program_options::bool_switch(&opt_check_args)->default_value(false),
    "Check command line and configuration file argments and then exit.")

+ 2 - 1
libgearman-server/byteorder.cc

@@ -13,7 +13,8 @@
  *
  */
 
-#include "common.h"
+#include <config.h>
+#include <libgearman-server/byteorder.h>
 
 #ifndef swap64
 /* Byte swap a 64-bit number. */

+ 34 - 14
libgearman-server/byteorder.h

@@ -1,20 +1,42 @@
-/*
-  Taken from libmemcached.
- */
-
-/* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker
- * All rights reserved.
+/*  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:
  *
- * Use and distribution licensed under the BSD license.  See
- * the COPYING file in the parent directory for full text.
+ *      * Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
  *
- * Summary:
+ *      * Redistributions in binary form must reproduce the above
+ *  copyright notice, this list of conditions and the following disclaimer
+ *  in the documentation and/or other materials provided with the
+ *  distribution.
+ *
+ *      * The names of its contributors may not be used to endorse or
+ *  promote products derived from this software without specific prior
+ *  written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
 
-#ifndef GEARMAN_BYTEORDER_H
-#define GEARMAN_BYTEORDER_H
+#pragma once
 
 #ifndef HAVE_HTONLL
 
@@ -35,5 +57,3 @@ uint64_t htonll(uint64_t);
 #undef htons
 #undef htonl
 #endif
-
-#endif /* GEARMAN_BYTEORDER_H */

+ 2 - 1
libgearman-server/client.cc

@@ -11,7 +11,8 @@
  * @brief Server client definitions
  */
 
-#include "common.h"
+#include <libgearman-server/common.h>
+#include <assert.h>
 
 /*
  * Public definitions

+ 2 - 21
libgearman-server/common.h

@@ -14,23 +14,13 @@
 #ifndef __GEARMAN_SERVER_COMMON_H__
 #define __GEARMAN_SERVER_COMMON_H__
 
-#include "config.h"
+#include <config.h>
 
-#define GEARMAN_CORE
-#include "gearmand.h"
+#include "libgearman-server/gearmand.h"
 
-#ifdef HAVE_ASSERT_H
-#include <assert.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
 #ifdef HAVE_PTHREAD
 #include <pthread.h>
 #endif
@@ -40,15 +30,6 @@
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif

+ 4 - 1
libgearman-server/connection.c

@@ -11,7 +11,10 @@
  * @brief Server connection definitions
  */
 
-#include "common.h"
+#include <libgearman-server/common.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
 
 static gearman_server_con_st * _server_con_create(gearman_server_thread_st *thread, gearmand_con_st *dcon,
                                                   gearmand_error_t *ret);

Some files were not shown because too many files changed in this diff