Simplified the build instructions now that we have "prepare-source".
[rsync/rsync-patches.git] / threaded-receiver.diff
index 78d15ae..a5949b5 100644 (file)
@@ -18,9 +18,13 @@ NOTE: we still need to duplicate the partial_fname static in util.c!
 If you try this out, please send some email to wayned@samba.org or the rsync
 mailing list with your results, build changes, bug reports, etc.  Thanks!
 
-Be sure to run "make proto" before running "make".
+After applying this patch, run these commands for a successful build:
 
---- orig/Makefile.in   2006-01-14 08:14:29
+    ./prepare-source
+    ./configure                      (optional if already run)
+    make
+
+--- orig/Makefile.in   2006-02-06 05:03:50
 +++ Makefile.in        2005-12-10 18:35:39
 @@ -6,7 +6,7 @@ exec_prefix=@exec_prefix@
  bindir=@bindir@
@@ -31,19 +35,30 @@ Be sure to run "make proto" before running "make".
  CC=@CC@
  CFLAGS=@CFLAGS@
  CPPFLAGS=@CPPFLAGS@
---- orig/cleanup.c     2006-02-01 19:37:05
-+++ cleanup.c  2005-12-08 23:17:08
-@@ -94,9 +94,6 @@ void _exit_cleanup(int code, const char 
+--- orig/cleanup.c     2006-02-03 20:00:35
++++ cleanup.c  2006-02-03 20:07:44
+@@ -26,10 +26,6 @@ extern int keep_partial;
+ extern int log_got_error;
+ extern char *partial_dir;
+-#ifdef HAVE_SIGACTION
+-static struct sigaction sigact;
+-#endif
+-
+ /**
+  * Close all open sockets and files, allowing a (somewhat) graceful
+  * shutdown() of socket connections.  This eliminates the abortive
+@@ -98,9 +94,6 @@ void _exit_cleanup(int code, const char 
        }
        inside_cleanup++;
  
--      signal(SIGUSR1, SIG_IGN);
--      signal(SIGUSR2, SIG_IGN);
+-      SIGACTION(SIGUSR1, SIG_IGN);
+-      SIGACTION(SIGUSR2, SIG_IGN);
 -
        if (verbose > 3) {
                rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
                        code, file, line);
-@@ -128,8 +125,6 @@ void _exit_cleanup(int code, const char 
+@@ -132,8 +125,6 @@ void _exit_cleanup(int code, const char 
        io_flush(FULL_FLUSH);
        if (cleanup_fname)
                do_unlink(cleanup_fname);
@@ -62,9 +77,9 @@ Be sure to run "make proto" before running "make".
  #define RERR_SIGNAL     20      /* status returned when sent SIGINT, SIGTERM, SIGHUP */
  #define RERR_WAITCHILD  21      /* some error returned by waitpid() */
  #define RERR_MALLOC     22      /* error allocating core memory buffers */
---- orig/generator.c   2006-01-31 18:59:39
+--- orig/generator.c   2006-02-05 06:40:40
 +++ generator.c        2005-12-08 23:17:08
-@@ -68,7 +68,6 @@ extern OFF_T min_size;
+@@ -67,7 +67,6 @@ extern OFF_T min_size;
  extern int io_error;
  extern int allowed_lull;
  extern int sock_f_out;
@@ -72,7 +87,7 @@ Be sure to run "make proto" before running "make".
  extern int protocol_version;
  extern int fuzzy_basis;
  extern int always_checksum;
-@@ -99,6 +98,11 @@ static int deletion_count = 0; /* used t
+@@ -98,6 +97,11 @@ static int deletion_count = 0; /* used t
  static int can_link_symlinks = 1; /* start out optimistic */
  static int can_link_devices = 1;
  
@@ -84,7 +99,7 @@ Be sure to run "make proto" before running "make".
  /* For calling delete_file() */
  #define DEL_FORCE_RECURSE     (1<<1) /* recurse even w/o --force */
  #define DEL_TERSE             (1<<3)
-@@ -448,8 +452,8 @@ static void sum_sizes_sqroot(struct sum_
+@@ -446,8 +450,8 @@ static void sum_sizes_sqroot(struct sum_
        }
  
        if (protocol_version < 27) {
@@ -95,7 +110,7 @@ Be sure to run "make proto" before running "make".
                s2length = SUM_LENGTH;
        } else {
                int32 c;
-@@ -459,7 +463,7 @@ static void sum_sizes_sqroot(struct sum_
+@@ -457,7 +461,7 @@ static void sum_sizes_sqroot(struct sum_
                for (c = blength; c >>= 1 && b; b--) {}
                /* add a bit, subtract rollsum, round up. */
                s2length = (b + 1 - 32 + 7) / 8; /* --optimize in compiler-- */
@@ -104,7 +119,7 @@ Be sure to run "make proto" before running "make".
                s2length = MIN(s2length, SUM_LENGTH);
        }
  
-@@ -493,7 +497,7 @@ static void generate_and_send_sums(int f
+@@ -491,7 +495,7 @@ static void generate_and_send_sums(int f
        sum_sizes_sqroot(&sum, len);
        write_sum_head(f_out, &sum);
  
@@ -113,7 +128,7 @@ Be sure to run "make proto" before running "make".
                return;
  
        if (len > 0)
-@@ -512,7 +516,7 @@ static void generate_and_send_sums(int f
+@@ -510,7 +514,7 @@ static void generate_and_send_sums(int f
  
                if (f_copy >= 0) {
                        full_write(f_copy, map, n1);
@@ -122,7 +137,7 @@ Be sure to run "make proto" before running "make".
                                continue;
                }
  
-@@ -1142,7 +1146,7 @@ static void recv_generator(char *fname, 
+@@ -1140,7 +1144,7 @@ static void recv_generator(char *fname, 
                return;
        }
  
@@ -131,7 +146,7 @@ Be sure to run "make proto" before running "make".
                return;
  
        if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
-@@ -1197,7 +1201,7 @@ static void recv_generator(char *fname, 
+@@ -1195,7 +1199,7 @@ static void recv_generator(char *fname, 
                goto notify_others;
        }
  
@@ -140,7 +155,7 @@ Be sure to run "make proto" before running "make".
                if (!(backupptr = get_backup_name(fname))) {
                        close(fd);
                        return;
-@@ -1286,7 +1290,10 @@ void generate_files(int f_out, struct fi
+@@ -1284,7 +1288,10 @@ void generate_files(int f_out, struct fi
        int save_ignore_existing = ignore_existing;
        int save_ignore_non_existing = ignore_non_existing;
        int save_do_progress = do_progress;
@@ -152,7 +167,7 @@ Be sure to run "make proto" before running "make".
  
        if (protocol_version >= 29) {
                itemizing = 1;
-@@ -1315,7 +1322,7 @@ void generate_files(int f_out, struct fi
+@@ -1313,7 +1320,7 @@ void generate_files(int f_out, struct fi
                do_delete_pass(flist);
        do_progress = 0;
  
@@ -161,7 +176,7 @@ Be sure to run "make proto" before running "make".
                whole_file = 0;
        if (verbose >= 2) {
                rprintf(FINFO, "delta-transmission %s\n",
-@@ -1324,12 +1331,6 @@ void generate_files(int f_out, struct fi
+@@ -1322,12 +1329,6 @@ void generate_files(int f_out, struct fi
                        : "enabled");
        }
  
@@ -174,7 +189,7 @@ Be sure to run "make proto" before running "make".
        for (i = 0; i < flist->count; i++) {
                struct file_struct *file = flist->files[i];
  
-@@ -1373,23 +1374,34 @@ void generate_files(int f_out, struct fi
+@@ -1371,23 +1372,34 @@ void generate_files(int f_out, struct fi
                delete_in_dir(NULL, NULL, NULL, NULL);
  
        phase++;
@@ -215,7 +230,7 @@ Be sure to run "make proto" before running "make".
                if (local_name)
                        strlcpy(fbuf, local_name, sizeof fbuf);
                else
-@@ -1401,27 +1413,43 @@ void generate_files(int f_out, struct fi
+@@ -1399,27 +1411,43 @@ void generate_files(int f_out, struct fi
        phase++;
        ignore_non_existing = save_ignore_non_existing;
        ignore_existing = save_ignore_existing;
@@ -266,7 +281,7 @@ Be sure to run "make proto" before running "make".
        }
  
        do_progress = save_do_progress;
---- orig/io.c  2006-02-01 19:37:05
+--- orig/io.c  2006-02-04 21:53:39
 +++ io.c       2006-02-01 19:50:09
 @@ -47,7 +47,6 @@ extern int allowed_lull;
  extern int am_server;
@@ -626,7 +641,7 @@ Be sure to run "make proto" before running "make".
                if (io_filesfrom_f_out >= 0) {
                        if (io_filesfrom_buflen) {
                                if (FD_ISSET(io_filesfrom_f_out, &w_fds)) {
-@@ -831,6 +787,8 @@ static void readfd(int fd, char *buffer,
+@@ -832,6 +788,8 @@ static void readfd(int fd, char *buffer,
        }
  
        if (fd == write_batch_monitor_in) {
@@ -635,7 +650,7 @@ Be sure to run "make proto" before running "make".
                if ((size_t)write(batch_fd, buffer, total) != total)
                        exit_cleanup(RERR_FILEIO);
        }
-@@ -1086,7 +1044,6 @@ static void writefd_unbuffered(int fd,ch
+@@ -1087,7 +1045,6 @@ static void writefd_unbuffered(int fd,ch
                         * to grab any messages they sent before they died. */
                        while (fd == sock_f_out && io_multiplexing_in) {
                                set_io_timeout(30);
@@ -643,7 +658,7 @@ Be sure to run "make proto" before running "make".
                                readfd_unbuffered(sock_f_in, io_filesfrom_buf,
                                                  sizeof io_filesfrom_buf);
                        }
-@@ -1096,7 +1053,7 @@ static void writefd_unbuffered(int fd,ch
+@@ -1097,7 +1054,7 @@ static void writefd_unbuffered(int fd,ch
                total += cnt;
  
                if (fd == sock_f_out) {
@@ -652,7 +667,7 @@ Be sure to run "make proto" before running "make".
                                last_io_out = time(NULL);
                        sleep_for_bwlimit(cnt);
                }
-@@ -1120,7 +1077,7 @@ static void mplex_write(enum msgcode cod
+@@ -1121,7 +1078,7 @@ static void mplex_write(enum msgcode cod
         * cause output to occur down the socket.  Setting contiguous_write_len
         * prevents the reading of msg_fd_in once we actually start to write
         * this sequence of data (though we might read it before the start). */
@@ -661,7 +676,7 @@ Be sure to run "make proto" before running "make".
                contiguous_write_len = len + 4;
  
        if (n > sizeof buffer - 4)
-@@ -1135,31 +1092,29 @@ static void mplex_write(enum msgcode cod
+@@ -1137,31 +1094,29 @@ static void mplex_write(enum msgcode cod
        if (len)
                writefd_unbuffered(sock_f_out, buf, len);
  
@@ -705,7 +720,7 @@ Be sure to run "make proto" before running "make".
        if (fd == sock_f_out)
                stats.total_written += len;
  
-@@ -1372,9 +1327,3 @@ void start_write_batch(int fd)
+@@ -1374,9 +1329,3 @@ void start_write_batch(int fd)
        else
                write_batch_monitor_in = fd;
  }
@@ -715,9 +730,9 @@ Be sure to run "make proto" before running "make".
 -      write_batch_monitor_out = -1;
 -      write_batch_monitor_in = -1;
 -}
---- orig/log.c 2006-02-01 19:37:05
+--- orig/log.c 2006-02-05 04:53:34
 +++ log.c      2005-12-16 23:49:57
-@@ -35,7 +35,6 @@ extern int am_sender;
+@@ -38,7 +38,6 @@ extern int am_sender;
  extern int local_server;
  extern int quiet;
  extern int module_id;
@@ -725,7 +740,7 @@ Be sure to run "make proto" before running "make".
  extern int protocol_version;
  extern int preserve_times;
  extern int log_format_has_i;
-@@ -68,7 +67,6 @@ struct {
+@@ -74,7 +73,6 @@ struct {
        { RERR_IPC        , "error in IPC code" },
        { RERR_CRASHED    , "sibling process crashed" },
        { RERR_TERMINATED , "sibling process terminated abnormally" },
@@ -733,7 +748,7 @@ Be sure to run "make proto" before running "make".
        { RERR_SIGNAL     , "received SIGINT, SIGTERM, or SIGHUP" },
        { RERR_WAITCHILD  , "waitpid() failed" },
        { RERR_MALLOC     , "error allocating core memory buffers" },
-@@ -224,8 +222,8 @@ void rwrite(enum logcode code, char *buf
+@@ -234,8 +232,8 @@ void rwrite(enum logcode code, char *buf
        if (quiet && code == FINFO)
                return;
  
@@ -744,8 +759,8 @@ Be sure to run "make proto" before running "make".
                send_msg((enum msgcode)code, buf, len);
                return;
        }
---- orig/main.c        2006-01-15 14:46:15
-+++ main.c     2005-12-16 23:50:33
+--- orig/main.c        2006-02-05 04:53:34
++++ main.c     2006-02-02 02:43:44
 @@ -30,7 +30,6 @@ extern int list_only;
  extern int am_root;
  extern int am_server;
@@ -754,7 +769,7 @@ Be sure to run "make proto" before running "make".
  extern int am_daemon;
  extern int blocking_io;
  extern int remove_sent_files;
-@@ -75,9 +74,20 @@ struct pid_status {
+@@ -84,9 +83,20 @@ struct pid_status {
  
  static time_t starttime, endtime;
  static int64 total_read, total_written;
@@ -775,7 +790,7 @@ Be sure to run "make proto" before running "make".
  /* Works like waitpid(), but if we already harvested the child pid in our
   * sigchld_handler(), we succeed instead of returning an error. */
  pid_t wait_process(pid_t pid, int *status_ptr, int flags)
-@@ -154,7 +164,7 @@ static void handle_stats(int f)
+@@ -163,7 +173,7 @@ static void handle_stats(int f)
                show_flist_stats();
        }
  
@@ -784,7 +799,7 @@ Be sure to run "make proto" before running "make".
                return;
  
        if (am_daemon) {
-@@ -609,12 +619,30 @@ static void do_server_sender(int f_in, i
+@@ -618,12 +628,30 @@ static void do_server_sender(int f_in, i
        exit_cleanup(0);
  }
  
@@ -818,7 +833,7 @@ Be sure to run "make proto" before running "make".
  
        /* The receiving side mustn't obey this, or an existing symlink that
         * points to an identical file won't be replaced by the referent. */
-@@ -623,70 +651,16 @@ static int do_recv(int f_in,int f_out,st
+@@ -632,70 +660,16 @@ static int do_recv(int f_in,int f_out,st
        if (preserve_hard_links)
                init_hard_links();
  
@@ -894,7 +909,7 @@ Be sure to run "make proto" before running "make".
        generate_files(f_out, flist, local_name);
  
        handle_stats(-1);
-@@ -697,10 +671,13 @@ static int do_recv(int f_in,int f_out,st
+@@ -706,10 +680,13 @@ static int do_recv(int f_in,int f_out,st
        }
        io_flush(FULL_FLUSH);
  
@@ -912,7 +927,7 @@ Be sure to run "make proto" before running "make".
  }
  
  
-@@ -1062,22 +1039,6 @@ static int start_client(int argc, char *
+@@ -1077,22 +1054,6 @@ static int start_client(int argc, char *
        return ret;
  }
  
@@ -935,15 +950,15 @@ Be sure to run "make proto" before running "make".
  static RETSIGTYPE sigchld_handler(UNUSED(int val))
  {
  #ifdef WNOHANG
-@@ -1160,8 +1121,6 @@ int main(int argc,char *argv[])
-       int orig_argc = argc;
-       char **orig_argv = argv;
--      signal(SIGUSR1, sigusr1_handler);
--      signal(SIGUSR2, sigusr2_handler);
-       signal(SIGCHLD, sigchld_handler);
+@@ -1184,8 +1145,6 @@ int main(int argc,char *argv[])
+ # endif
+       sigact.sa_flags = SA_NOCLDSTOP;
+ #endif
+-      SIGACTMASK(SIGUSR1, sigusr1_handler);
+-      SIGACTMASK(SIGUSR2, sigusr2_handler);
+       SIGACTMASK(SIGCHLD, sigchld_handler);
  #ifdef MAINTAINER_MODE
-       signal(SIGSEGV, rsync_panic_handler);
+       SIGACTMASK(SIGSEGV, rsync_panic_handler);
 --- orig/match.c       2005-11-10 16:58:36
 +++ match.c    2005-12-08 23:17:09
 @@ -21,7 +21,7 @@
@@ -982,7 +997,7 @@ Be sure to run "make proto" before running "make".
                                show_progress(last_match, buf->file_size);
                        sum_update(map_ptr(buf, last_match, len), len);
                        last_match = s->flength;
---- orig/options.c     2006-01-31 03:11:30
+--- orig/options.c     2006-02-03 23:51:57
 +++ options.c  2005-12-08 23:17:09
 @@ -73,7 +73,6 @@ int def_compress_level = Z_DEFAULT_COMPR
  int am_root = 0;
@@ -1149,9 +1164,9 @@ Be sure to run "make proto" before running "make".
                }
        }
        make_backups = save_make_backups;
---- orig/rsync.c       2006-01-31 02:30:18
+--- orig/rsync.c       2006-02-05 15:31:49
 +++ rsync.c    2005-12-08 23:17:10
-@@ -32,7 +32,6 @@ extern int orig_umask;
+@@ -41,7 +41,6 @@ extern int orig_umask;
  extern int am_root;
  extern int am_server;
  extern int am_sender;
@@ -1159,14 +1174,14 @@ Be sure to run "make proto" before running "make".
  extern int am_starting_up;
  extern int preserve_uid;
  extern int preserve_gid;
-@@ -247,5 +246,5 @@ const char *who_am_i(void)
+@@ -291,5 +290,5 @@ const char *who_am_i(void)
  {
        if (am_starting_up)
                return am_server ? "server" : "client";
 -      return am_sender ? "sender" : am_generator ? "generator" : "receiver";
 +      return am_sender ? "sender" : am_generator() ? "generator" : "receiver";
  }
---- orig/rsync.h       2006-02-01 19:37:05
+--- orig/rsync.h       2006-02-03 20:00:36
 +++ rsync.h    2006-01-17 02:46:03
 @@ -166,10 +166,8 @@ enum msgcode {
        MSG_DATA=0,     /* raw data on the multiplexed stream */
@@ -1187,7 +1202,7 @@ Be sure to run "make proto" before running "make".
  
  #include "lib/pool_alloc.h"
  
---- orig/util.c        2006-01-30 07:18:28
+--- orig/util.c        2006-02-03 20:00:36
 +++ util.c     2005-12-08 23:17:10
 @@ -413,51 +413,6 @@ int robust_rename(char *from, char *to, 
        return -1;