<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,13 +2,13 @@ bin_PROGRAMS = memcached memcached-debug
 
 BUILT_SOURCES= @DTRACE_HEADER@
 
-memcached_SOURCES = memcached.c slabs.c slabs.h items.c items.h assoc.c assoc.h memcached.h thread.c stats.c stats.h
+memcached_SOURCES = memcached.c slabs.c slabs.h items.c items.h assoc.c assoc.h memcached.h thread.c stats.c stats.h daemon.c
 memcached_debug_SOURCES = $(memcached_SOURCES)
 memcached_CPPFLAGS = -DNDEBUG
-memcached_LDADD = @DTRACE_OBJ@ @DAEMON_OBJ@ 
-memcached_debug_LDADD = @DTRACE_DEBUG_OBJ@ @DAEMON_OBJ@
-memcached_DEPENDENCIES = @DTRACE_OBJ@ @DAEMON_OBJ@
-memcached_debug_DEPENDENCIES = @DTRACE_DEBUG_OBJ@ @DAEMON_OBJ@
+memcached_LDADD = @DTRACE_OBJ@
+memcached_debug_LDADD = @DTRACE_DEBUG_OBJ@
+memcached_DEPENDENCIES = @DTRACE_OBJ@
+memcached_debug_DEPENDENCIES = @DTRACE_DEBUG_OBJ@
 
 memcached_dtrace.h: memcached_dtrace.d
 	${DTRACE} -h -s memcached_dtrace.d 
@@ -24,7 +24,7 @@ memcached_debug_dtrace.o: $(memcached_debug_OBJECTS)
 
 SUBDIRS = doc
 DIST_DIRS = scripts
-EXTRA_DIST = doc scripts TODO t memcached.spec daemon.c memcached_dtrace.d
+EXTRA_DIST = doc scripts TODO t memcached.spec memcached_dtrace.d
 
 test:	memcached-debug
 	prove $(srcdir)/t</diff>
      <filename>Makefile.am</filename>
    </modified>
    <modified>
      <diff>@@ -141,9 +141,6 @@ AC_SEARCH_LIBS(socket, socket)
 AC_SEARCH_LIBS(gethostbyname, nsl)
 AC_SEARCH_LIBS(mallinfo, malloc)
 
-AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[DAEMON_OBJ=daemon.o])
-AC_SUBST(DAEMON_OBJ)
-
 AC_HEADER_STDBOOL
 AC_C_CONST
 AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))</diff>
      <filename>configure.ac</filename>
    </modified>
    <modified>
      <diff>@@ -40,7 +40,7 @@
 
 #include &quot;memcached.h&quot;
 
-int daemon(int nochdir, int noclose)
+int daemonize(int nochdir, int noclose)
 {
     int fd;
 </diff>
      <filename>daemon.c</filename>
    </modified>
    <modified>
      <diff>@@ -1935,8 +1935,8 @@ static char *server_stats(bool binprot, int *buflen) {
     pos += sprintf(pos, &quot;STAT version &quot; VERSION &quot;\r\n&quot;);
     pos += sprintf(pos, &quot;STAT pointer_size %d\r\n&quot;, (int)(8 * sizeof(void *)));
 #ifndef WIN32
-    pos += sprintf(pos, &quot;STAT rusage_user %ld.%06ld\r\n&quot;, usage.ru_utime.tv_sec, usage.ru_utime.tv_usec);
-    pos += sprintf(pos, &quot;STAT rusage_system %ld.%06ld\r\n&quot;, usage.ru_stime.tv_sec, usage.ru_stime.tv_usec);
+    pos += sprintf(pos, &quot;STAT rusage_user %ld.%06ld\r\n&quot;, (long)usage.ru_utime.tv_sec, (long)usage.ru_utime.tv_usec);
+    pos += sprintf(pos, &quot;STAT rusage_system %ld.%06ld\r\n&quot;, (long)usage.ru_stime.tv_sec, (long)usage.ru_stime.tv_usec);
 #endif /* !WIN32 */
     pos += sprintf(pos, &quot;STAT curr_connections %u\r\n&quot;, stats.curr_conns - 1); /* ignore listening conn */
     pos += sprintf(pos, &quot;STAT total_connections %u\r\n&quot;, stats.total_conns);
@@ -3780,7 +3780,7 @@ static int enable_large_pages(void) {
 int main (int argc, char **argv) {
     int c;
     bool lock_memory = false;
-    bool daemonize = false;
+    bool do_daemonize = false;
     bool preallocate = false;
     int maxcore = 0;
     char *username = NULL;
@@ -3845,7 +3845,7 @@ int main (int argc, char **argv) {
             settings.inter= strdup(optarg);
             break;
         case 'd':
-            daemonize = true;
+            do_daemonize = true;
             break;
         case 'r':
             maxcore = 1;
@@ -3953,9 +3953,9 @@ int main (int argc, char **argv) {
 
     /* daemonize if requested */
     /* if we want to ensure our ability to dump core, don't chdir to / */
-    if (daemonize) {
+    if (do_daemonize) {
         int res;
-        res = daemon(maxcore, settings.verbose);
+        res = daemonize(maxcore, settings.verbose);
         if (res == -1) {
             fprintf(stderr, &quot;failed to daemon() in order to daemonize\n&quot;);
             return 1;
@@ -4018,7 +4018,7 @@ int main (int argc, char **argv) {
     thread_init(settings.num_threads, main_base);
     /* save the PID in if we're a daemon, do this after thread_init due to
        a file descriptor handling bug somewhere in libevent */
-    if (daemonize)
+    if (do_daemonize)
         save_pid(getpid(), pid_file);
     /* initialise clock event */
     clock_handler(0, 0, 0);
@@ -4067,7 +4067,7 @@ int main (int argc, char **argv) {
     /* enter the event loop */
     event_base_loop(main_base, 0);
     /* remove the PID file if we're a daemon */
-    if (daemonize)
+    if (do_daemonize)
         remove_pidfile(pid_file);
     /* Clean up strdup() call for bind() address */
     if (settings.inter)</diff>
      <filename>memcached.c</filename>
    </modified>
    <modified>
      <diff>@@ -284,10 +284,8 @@ uint32_t append_bin_stats(char *buf, const char *key, const uint16_t klen,
                           const char *val, const uint32_t vlen);
 uint32_t append_ascii_stats(char *buf, const char *key, const uint16_t klen,
                             const char *val, const uint32_t vlen);
+extern int daemonize(int nochdir, int noclose);
 
-#ifndef HAVE_DAEMON
-extern int daemon(int nochdir, int noclose);
-#endif
 
 #include &quot;stats.h&quot;
 #include &quot;slabs.h&quot;</diff>
      <filename>memcached.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fa2a8acfc4d2f4e083986456b1770750f2a6e027</id>
    </parent>
  </parents>
  <author>
    <name>Trond Norbye</name>
    <email>trond.norbye@sun.com</email>
  </author>
  <url>http://github.com/tmaesaka/memcached/commit/67e63aaf5ee33823aa123bf65755854767fc873d</url>
  <id>67e63aaf5ee33823aa123bf65755854767fc873d</id>
  <committed-date>2008-10-06T05:24:27-07:00</committed-date>
  <authored-date>2008-10-06T05:24:27-07:00</authored-date>
  <message>Always use bundled daemonize function, fixed warnings on MacOSX</message>
  <tree>c9fc2f0e77548b1f16319e1e135631e4bd323c6c</tree>
  <committer>
    <name>Trond Norbye</name>
    <email>trond.norbye@sun.com</email>
  </committer>
</commit>
