aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mikeioannina@gmail.com>2015-08-19 00:33:07 +0300
committerMichael Bestas <mikeioannina@gmail.com>2015-09-25 23:20:25 +0300
commita36d905455cc35d7092e8429f468df1f8d922b4e (patch)
treee45555cd7be78b07c7e2790777a97c0f39ee598e
parent58be9a73db704a8ce2b6e7e09532416c2309b8ef (diff)
downloadandroid_external_rsync-cm-14.0.tar.gz
android_external_rsync-cm-14.0.tar.bz2
android_external_rsync-cm-14.0.zip
Change-Id: Ic8c134020beb98e1e52c4d527cbdbfe591d67262
-rw-r--r--Android.mk5
-rw-r--r--authenticate.c30
-rw-r--r--config.h102
-rw-r--r--proto.h134
4 files changed, 167 insertions, 104 deletions
diff --git a/Android.mk b/Android.mk
index ca740826..f42421ac 100644
--- a/Android.mk
+++ b/Android.mk
@@ -11,12 +11,14 @@ LOCAL_SRC_FILES := \
sender.c \
exclude.c \
util.c \
+ util2.c \
main.c \
checksum.c \
match.c \
syscall.c \
log.c \
backup.c \
+ delete.c \
options.c \
io.c \
compat.c \
@@ -41,6 +43,7 @@ LOCAL_SRC_FILES := \
authenticate.c \
lib/wildmatch.c \
lib/compat.c \
+ lib/getpass.c \
lib/snprintf.c \
lib/mdfour.c \
lib/md5.c \
@@ -66,7 +69,7 @@ LOCAL_SRC_FILES := \
popt/popthelp.c \
popt/poptparse.c
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/popt
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/popt $(LOCAL_PATH)/zlib
LOCAL_CFLAGS := -DHAVE_CONFIG_H
diff --git a/authenticate.c b/authenticate.c
index f363e72e..c92746c6 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -343,36 +343,6 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
return strdup(line);
}
-#ifdef __BIONIC__
-#include <termios.h>
-static const char *getpass(char *prompt)
-{
- struct termios old, new;
- static char res[256];
- char *p;
-
- /* Turn echoing off and fail if we can't. */
- if (tcgetattr (0, &old) != 0)
- return NULL;
- new = old;
- new.c_lflag &= ~ECHO;
- if (tcsetattr (0, TCSAFLUSH, &new) != 0)
- return NULL;
-
- fprintf(stderr, "%s", prompt);
- fflush(stderr);
- fgets(res, 256, stdin);
- if ((p = strchr(res, '\n')))
- *p = 0;
-
- /* Restore terminal. */
- tcsetattr (0, TCSAFLUSH, &old);
-
- return res;
-}
-
-#endif
-
void auth_client(int fd, const char *user, const char *challenge)
{
const char *pass;
diff --git a/config.h b/config.h
index a88f4467..5308ff07 100644
--- a/config.h
+++ b/config.h
@@ -13,8 +13,8 @@
/* Define to 1 if chown modifies symlinks. */
/* #undef CHOWN_MODIFIES_SYMLINK */
-/* Undefine if you don't want locale features. By default this is defined. */
-/* #undef CONFIG_LOCALE */
+/* Undefine if you do not want locale features. By default this is defined. */
+#define CONFIG_LOCALE 1
/* 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.
@@ -24,6 +24,9 @@
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
+/* Define to 1 if using external zlib */
+/* #undef EXTERNAL_ZLIB */
+
/* Used to make "checker" understand that FD_ZERO() clears memory. */
/* #undef FORCE_FD_ZERO_MEMSET */
@@ -62,6 +65,9 @@
/* Define to 1 if you have the `asprintf' function. */
#define HAVE_ASPRINTF 1
+/* Define to 1 if you have the `attropen' function. */
+/* #undef HAVE_ATTROPEN */
+
/* Define to 1 if you have the <attr/xattr.h> header file. */
/* #undef HAVE_ATTR_XATTR_H */
@@ -90,12 +96,19 @@
*/
#define HAVE_DIRENT_H 1
+/* Define if posix_fallocate is efficient (Cygwin) */
+/* #undef HAVE_EFFICIENT_POSIX_FALLOCATE */
+
/* Define to 1 if errno is declared in errno.h */
#define HAVE_ERRNO_DECL 1
/* Define to 1 if you have the `extattr_get_link' function. */
/* #undef HAVE_EXTATTR_GET_LINK */
+/* Define to 1 if you have the fallocate function and it compiles and links
+ without error */
+#define HAVE_FALLOCATE 1
+
/* Define to 1 if you have the `fchmod' function. */
#define HAVE_FCHMOD 1
@@ -126,9 +139,15 @@
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
+/* Define to 1 if you have the `getgrouplist' function. */
+#define HAVE_GETGROUPLIST 1
+
/* Define to 1 if you have the `getgroups' function. */
#define HAVE_GETGROUPS 1
+/* Define to 1 if you have the `getpass' function. */
+/* #undef HAVE_GETPASS */
+
/* Define to 1 if you have the `getpgrp' function. */
#define HAVE_GETPGRP 1
@@ -136,7 +155,7 @@
#define HAVE_GETTIMEOFDAY_TZ 1
/* Define to 1 if you have the `getxattr' function. */
-/* #undef HAVE_GETXATTR */
+#define HAVE_GETXATTR 1
/* Define to 1 if you have the <grp.h> header file. */
#define HAVE_GRP_H 1
@@ -159,6 +178,9 @@
/* Define to 1 if you have the `inet_pton' function. */
#define HAVE_INET_PTON 1
+/* Define to 1 if you have the `initgroups' function. */
+#define HAVE_INITGROUPS 1
+
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -177,6 +199,9 @@
/* Define to 1 if you have the `acl' library (-lacl). */
/* #undef HAVE_LIBACL */
+/* Define to 1 if you have the `attr' library (-lattr). */
+/* #undef HAVE_LIBATTR */
+
/* Define to 1 if you have the <libcharset.h> header file. */
/* #undef HAVE_LIBCHARSET_H */
@@ -201,14 +226,20 @@
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
+/* Define to 1 if you have the `z' library (-lz). */
+/* #undef HAVE_LIBZ */
+
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the `link' function. */
#define HAVE_LINK 1
+/* Define to 1 if you have the <linux/falloc.h> header file. */
+#define HAVE_LINUX_FALLOC_H 1
+
/* True if you have Linux xattrs */
-/* #undef HAVE_LINUX_XATTRS */
+#define HAVE_LINUX_XATTRS 1
/* Define to 1 if you have the `locale_charset' function. */
/* #undef HAVE_LOCALE_CHARSET */
@@ -247,13 +278,13 @@
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkfifo' function. */
-/* #undef HAVE_MKFIFO */
+#define HAVE_MKFIFO 1
/* Define to 1 if you have the `mknod' function. */
#define HAVE_MKNOD 1
/* Define to 1 if you have the `mkstemp64' function. */
-/* #undef HAVE_MKSTEMP64 */
+#define HAVE_MKSTEMP64 1
/* Define to 1 if the system has the type `mode_t'. */
#define HAVE_MODE_T 1
@@ -267,6 +298,12 @@
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
+/* Define to 1 if you have the <netinet/in_systm.h> header file. */
+#define HAVE_NETINET_IN_SYSTM_H 1
+
+/* Define to 1 if you have the <netinet/ip.h> header file. */
+#define HAVE_NETINET_IP_H 1
+
/* Define to 1 if you have the `nl_langinfo' function. */
/* #undef HAVE_NL_LANGINFO */
@@ -274,7 +311,7 @@
#define HAVE_OFF_T 1
/* Define to 1 if you have the `open64' function. */
-/* #undef HAVE_OPEN64 */
+#define HAVE_OPEN64 1
/* true if you have Mac OS X ACLs */
/* #undef HAVE_OSX_ACLS */
@@ -294,6 +331,9 @@
/* true if you have posix ACLs */
/* #undef HAVE_POSIX_ACLS */
+/* Define to 1 if you have the `posix_fallocate' function. */
+#define HAVE_POSIX_FALLOCATE 1
+
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
@@ -304,7 +344,7 @@
/* #undef HAVE_REMSH */
/* Define to 1 if mkstemp() is available and works right */
-#define HAVE_SECURE_MKSTEMP 1
+/* #undef HAVE_SECURE_MKSTEMP */
/* Define to 1 if you have the `setattrlist' function. */
/* #undef HAVE_SETATTRLIST */
@@ -324,6 +364,9 @@
/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1
+/* Define to 1 if you have the `setvbuf' function. */
+#define HAVE_SETVBUF 1
+
/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
@@ -354,6 +397,9 @@
/* true if you have solaris ACLs */
/* #undef HAVE_SOLARIS_ACLS */
+/* True if you have Solaris xattrs */
+/* #undef HAVE_SOLARIS_XATTRS */
+
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
@@ -402,6 +448,12 @@
/* Define to 1 if the system has the type `struct stat64'. */
#define HAVE_STRUCT_STAT64 1
+/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
+
+/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */
+
/* Define to 1 if `st_rdev' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_RDEV 1
@@ -421,6 +473,9 @@
/* Define to 1 if you have the <sys/extattr.h> header file. */
/* #undef HAVE_SYS_EXTATTR_H */
+/* Define to 1 if you have the SYS_fallocate syscall number */
+#define HAVE_SYS_FALLOCATE 1
+
/* Define to 1 if you have the <sys/fcntl.h> header file. */
/* #undef HAVE_SYS_FCNTL_H */
@@ -465,7 +520,7 @@
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <sys/xattr.h> header file. */
-/* #undef HAVE_SYS_XATTR_H */
+#define HAVE_SYS_XATTR_H 1
/* Define to 1 if you have the `tcgetpgrp' function. */
#define HAVE_TCGETPGRP 1
@@ -483,7 +538,7 @@
#define HAVE_UTIME 1
/* Define to 1 if you have the `utimensat' function. */
-/* #undef HAVE_UTIMENSAT */
+#define HAVE_UTIMENSAT 1
/* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1
@@ -492,7 +547,7 @@
#define HAVE_UTIME_H 1
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
-/* #undef HAVE_UTIME_NULL */
+#define HAVE_UTIME_NULL 1
/* Define to 1 if you have the `vasprintf' function. */
#define HAVE_VASPRINTF 1
@@ -504,11 +559,14 @@
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `wait4' function. */
-/* #undef HAVE_WAIT4 */
+#define HAVE_WAIT4 1
/* Define to 1 if you have the `waitpid' function. */
#define HAVE_WAITPID 1
+/* Define to 1 if you have the <zlib.h> header file. */
+#define HAVE_ZLIB_H 1
+
/* Define to 1 if you have the `_acl' function. */
/* #undef HAVE__ACL */
@@ -552,7 +610,7 @@
/* #undef MKNOD_CREATES_SOCKETS */
/* unprivileged group for unprivileged user */
-#define NOBODY_GROUP "nobody"
+#define NOBODY_GROUP "nogroup"
/* unprivileged user--e.g. nobody */
#define NOBODY_USER "nobody"
@@ -563,6 +621,9 @@
/* True if special files do not support xattrs */
/* #undef NO_SPECIAL_XATTRS */
+/* True if symlinks do not support user xattrs */
+#define NO_SYMLINK_USER_XATTRS 1
+
/* True if symlinks do not support xattrs */
/* #undef NO_SYMLINK_XATTRS */
@@ -596,8 +657,11 @@
/* default -e command */
#define RSYNC_RSH "ssh"
+/* Define to 1 if --protected-args should be the default */
+/* #undef RSYNC_USE_PROTECTED_ARGS */
+
/* rsync release version */
-#define RSYNC_VERSION "3.0.8"
+#define RSYNC_VERSION "3.1.1"
/* Define to 1 if sockets need to be shutdown */
/* #undef SHUTDOWN_ALL_SOCKETS */
@@ -656,7 +720,7 @@
/* #undef SUPPORT_ACLS */
/* Define to 1 to add support for extended attributes */
-/* #undef SUPPORT_XATTRS */
+#define SUPPORT_XATTRS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
@@ -679,6 +743,11 @@
# endif
#endif
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
@@ -697,6 +766,9 @@
/* #undef inline */
#endif
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
/* type to use in place of socklen_t if not defined */
/* #undef socklen_t */
diff --git a/proto.h b/proto.h
index ad72c6df..193224d5 100644
--- a/proto.h
+++ b/proto.h
@@ -1,6 +1,6 @@
/* This file is automatically generated with "make proto". DO NOT EDIT */
-int allow_access(char *addr, char *host, char *allow_list, char *deny_list);
+int allow_access(const char *addr, const char **host_ptr, int i);
void free_acl(stat_x *sxp);
int get_acl(const char *fname, stat_x *sxp);
void send_acl(int f, stat_x *sxp);
@@ -15,15 +15,14 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
const char *addr, const char *leader);
void auth_client(int fd, const char *user, const char *challenge);
char *get_backup_name(const char *fname);
-int make_bak_dir(const char *fullpath);
-int make_backup(const char *fname);
+int make_backup(const char *fname, BOOL prefer_rename);
void write_stream_flags(int fd);
void read_stream_flags(int fd);
void check_batch_flags(void);
void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt);
uint32 get_checksum1(char *buf1, int32 len);
void get_checksum2(char *buf, int32 len, char *sum);
-void file_checksum(char *fname, char *sum, OFF_T size);
+void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum);
void sum_init(int seed);
void sum_update(const char *p, int32 len);
int sum_end(char *sum);
@@ -59,25 +58,26 @@ int daemon_main(void);
void set_allow_inc_recurse(void);
void setup_protocol(int f_out,int f_in);
int claim_connection(char *fname, int max_connections);
+enum delret delete_item(char *fbuf, uint16 mode, uint16 flags);
+uint16 get_del_for_flag(uint16 mode);
void set_filter_dir(const char *dir, unsigned int dirlen);
void *push_local_filters(const char *dir, unsigned int dirlen);
void pop_local_filters(void *mem);
void change_local_filter_dir(const char *dname, int dlen, int dir_depth);
-int check_filter(struct filter_list_struct *listp, enum logcode code,
+int check_filter(filter_rule_list *listp, enum logcode code,
const char *name, int name_is_dir);
-void parse_rule(struct filter_list_struct *listp, const char *pattern,
- uint32 mflags, int xflags);
-void parse_filter_file(struct filter_list_struct *listp, const char *fname,
- uint32 mflags, int xflags);
-char *get_rule_prefix(int match_flags, const char *pat, int for_xfer,
+const filter_rule *rule_template(uint32 rflags);
+void parse_filter_str(filter_rule_list *listp, const char *rulestr,
+ const filter_rule *template, int xflags);
+void parse_filter_file(filter_rule_list *listp, const char *fname, const filter_rule *template, int xflags);
+char *get_rule_prefix(filter_rule *rule, const char *pat, int for_xfer,
unsigned int *plen_ptr);
void send_filter_list(int f_out);
void recv_filter_list(int f_in);
int sparse_end(int f, OFF_T size);
int flush_write_file(int f);
int write_file(int f, char *buf, int len);
-struct map_struct *map_file(int fd, OFF_T len, int32 read_size,
- int32 blk_size);
+struct map_struct *map_file(int fd, OFF_T len, int32 read_size, int32 blk_size);
char *map_ptr(struct map_struct *map, OFF_T offset, int32 len);
int unmap_file(struct map_struct *map);
void init_flist(void);
@@ -106,6 +106,8 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
stat_x *sxp, int32 iflags, uchar fnamecmp_type,
const char *xname);
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st);
+int atomic_create(struct file_struct *file, char *fname, const char *slnk, const char *hlnk,
+ dev_t rdev, stat_x *sxp, int del_for_flag);
void check_for_finished_files(int itemizing, enum logcode code, int check_redo);
void generate_files(int f_out, const char *local_name);
struct hashtable *hashtable_create(int size, int key64);
@@ -115,7 +117,7 @@ void init_hard_links(void);
struct ht_int64_node *idev_find(int64 dev, int64 ino);
void idev_destroy(void);
void match_hard_links(struct file_list *flist);
-int hard_link_check(struct file_struct *file, int ndx, const char *fname,
+int hard_link_check(struct file_struct *file, int ndx, char *fname,
int statret, stat_x *sxp, int itemizing,
enum logcode code);
int hard_link_one(struct file_struct *file, const char *fname,
@@ -124,28 +126,29 @@ void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
STRUCT_STAT *stp, int itemizing, enum logcode code,
int alt_dest);
int skip_hard_link(struct file_struct *file, struct file_list **flist_p);
+void reduce_iobuf_size(xbuf *out, size_t new_size);
+void restore_iobuf_size(xbuf *out);
+void noop_io_until_death(void);
+int send_msg(enum msgcode code, const char *buf, size_t len, int convert);
+void send_msg_int(enum msgcode code, int num);
void io_set_sock_fds(int f_in, int f_out);
void set_io_timeout(int secs);
-void set_msg_fd_in(int fd);
-void set_msg_fd_out(int fd);
void increment_active_files(int ndx, int itemizing, enum logcode code);
-int send_msg(enum msgcode code, const char *buf, int len, int convert);
-void send_msg_int(enum msgcode code, int num);
-void wait_for_receiver(void);
int get_redo_num(void);
int get_hlink_num(void);
-void io_set_filesfrom_fds(int f_in, int f_out);
+void start_filesfrom_forwarding(int fd);
int read_line(int fd, char *buf, size_t bufsiz, int flags);
void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
char ***argv_p, int *argc_p, char **request_p);
-int io_start_buffering_out(int f_out);
-int io_start_buffering_in(int f_in);
-void io_end_buffering_in(void);
-void io_end_buffering_out(void);
+BOOL io_start_buffering_out(int f_out);
+BOOL io_start_buffering_in(int f_in);
+void io_end_buffering_in(BOOL free_buffers);
+void io_end_buffering_out(BOOL free_buffers);
void maybe_flush_socket(int important);
-void maybe_send_keepalive(void);
-void start_flist_forward(int f_in);
+void maybe_send_keepalive(time_t now, int flags);
+void start_flist_forward(int ndx);
void stop_flist_forward(void);
+void wait_for_receiver(void);
unsigned short read_shortint(int f);
int32 read_int(int f);
int32 read_varint(int f);
@@ -157,31 +160,32 @@ uchar read_byte(int f);
int read_vstring(int f, char *buf, int bufsize);
void read_sum_head(int f, struct sum_struct *sum);
void write_sum_head(int f, struct sum_struct *sum);
-int io_flush(int flush_it_all);
+void io_flush(int flush_it_all);
void write_shortint(int f, unsigned short x);
void write_int(int f, int32 x);
void write_varint(int f, int32 x);
void write_varlong(int f, int64 x, uchar min_bytes);
void write_longint(int f, int64 x);
+void write_bigbuf(int f, const char *buf, size_t len);
void write_buf(int f, const char *buf, size_t len);
void write_sbuf(int f, const char *buf);
void write_byte(int f, uchar c);
void write_vstring(int f, const char *str, int len);
void write_ndx(int f, int32 ndx);
int32 read_ndx(int f);
-int read_line_old(int f, char *buf, size_t bufsiz);
+int read_line_old(int fd, char *buf, size_t bufsiz, int eof_ok);
void io_printf(int fd, const char *format, ...);
-void io_start_multiplex_out(void);
-void io_start_multiplex_in(void);
-int io_multiplex_write(enum msgcode code, const char *buf, size_t len, int convert);
-void io_end_multiplex_in(void);
-void io_end_multiplex_out(void);
+void io_start_multiplex_out(int fd);
+void io_start_multiplex_in(int fd);
+int io_end_multiplex_in(int mode);
+int io_end_multiplex_out(int mode);
void start_write_batch(int fd);
void stop_write_batch(void);
char *lp_bind_address(void);
char *lp_motd_file(void);
char *lp_pid_file(void);
char *lp_socket_options(void);
+int lp_listen_backlog(void);
int lp_rsync_port(void);
char *lp_auth_users(int module_id);
char *lp_charset(int module_id);
@@ -213,18 +217,21 @@ int lp_max_verbosity(int module_id);
int lp_syslog_facility(int module_id);
int lp_timeout(int module_id);
BOOL lp_fake_super(int module_id);
+BOOL lp_forward_lookup(int module_id);
BOOL lp_ignore_errors(int module_id);
BOOL lp_ignore_nonreadable(int module_id);
BOOL lp_list(int module_id);
BOOL lp_munge_symlinks(int module_id);
BOOL lp_numeric_ids(int module_id);
BOOL lp_read_only(int module_id);
+BOOL lp_reverse_lookup(int module_id);
BOOL lp_strict_modes(int module_id);
BOOL lp_transfer_logging(int module_id);
BOOL lp_use_chroot(int module_id);
BOOL lp_write_only(int module_id);
-BOOL lp_load(char *pszFname, int globals_only);
-int lp_numservices(void);
+int lp_load(char *pszFname, int globals_only);
+BOOL set_dparams(int syntax_check_only);
+int lp_num_modules(void);
int lp_number(char *name);
void log_init(int restart);
void logfile_close(void);
@@ -233,14 +240,16 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8);
void rprintf(enum logcode code, const char *format, ...);
void rsyserr(enum logcode code, int errcode, const char *format, ...);
void rflush(enum logcode code);
+void remember_initial_stats(void);
int log_format_has(const char *format, char esc);
-void log_item(enum logcode code, struct file_struct *file,
- struct stats *initial_stats, int iflags, const char *hlink);
+void log_item(enum logcode code, struct file_struct *file, int iflags, const char *hlink);
void maybe_log_item(struct file_struct *file, int iflags, int itemizing,
const char *buf);
void log_delete(const char *fname, int mode);
void log_exit(int code, const char *file, int line);
pid_t wait_process(pid_t pid, int *status_ptr, int flags);
+void write_del_stats(int f);
+void read_del_stats(int f);
int child_main(int argc, char *argv[]);
void start_server(int f_in, int f_out, int argc, char *argv[]);
int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]);
@@ -249,12 +258,15 @@ const char *get_panic_action(void);
int main(int argc,char *argv[]);
void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len);
void match_report(void);
+void limit_output_verbosity(int level);
+void reset_output_levels(void);
+void negate_output_levels(void);
void usage(enum logcode F);
void option_error(void);
int parse_arguments(int *argc_p, const char ***argv_p);
void server_options(char **args, int *argc_p);
char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr);
-BOOL pm_process( char *FileName,
+int pm_process( char *FileName,
BOOL (*sfunc)(char *),
BOOL (*pfunc)(char *, char *) );
pid_t piped_child(char **command, int *f_in, int *f_out);
@@ -263,20 +275,20 @@ pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
void set_current_file_index(struct file_struct *file, int ndx);
void end_progress(OFF_T size);
void show_progress(OFF_T ofs, OFF_T size);
-int get_tmpname(char *fnametmp, const char *fname);
+int get_tmpname(char *fnametmp, const char *fname, BOOL make_unique);
int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file);
-int recv_files(int f_in, char *local_name);
+int recv_files(int f_in, int f_out, char *local_name);
void setup_iconv(void);
int iconvbufs(iconv_t ic, xbuf *in, xbuf *out, int flags);
void send_protected_args(int fd, char *args[]);
-int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
+int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
char *buf, int *len_ptr);
void free_sums(struct sum_struct *s);
mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
int exists);
int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
const char *fnamecmp, int flags);
-RETSIGTYPE sig_int(UNUSED(int val));
+RETSIGTYPE sig_int(int sig_num);
int finish_transfer(const char *fname, const char *fnametmp,
const char *fnamecmp, const char *partialptr,
struct file_struct *file, int ok_to_set_time,
@@ -295,7 +307,8 @@ int is_a_socket(int fd);
void start_accept_loop(int port, int (*fn)(int, int));
void set_socket_options(int fd, char *options);
int do_unlink(const char *fname);
-int do_symlink(const char *fname1, const char *fname2);
+int do_symlink(const char *lnk, const char *fname);
+ssize_t do_readlink(const char *path, char *buf, size_t bufsiz);
int do_link(const char *fname1, const char *fname2);
int do_lchown(const char *path, uid_t owner, gid_t group);
int do_mknod(const char *pathname, mode_t mode, DEV_T dev);
@@ -315,11 +328,17 @@ int do_utimensat(const char *fname, time_t modtime, uint32 mod_nsec);
int do_lutimes(const char *fname, time_t modtime, uint32 mod_nsec);
int do_utimes(const char *fname, time_t modtime, uint32 mod_nsec);
int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec));
+int do_fallocate(int fd, OFF_T offset, OFF_T length);
+int do_open_nofollow(const char *pathname, int flags);
void set_compression(const char *fname);
void send_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
int32 n, int32 toklen);
int32 recv_token(int f, char **data);
void see_token(char *data, int32 toklen);
+char *uid_to_user(uid_t uid);
+char *gid_to_group(gid_t gid);
+int user_to_uid(const char *name, uid_t *uid_p, BOOL num_ok);
+int group_to_gid(const char *name, gid_t *gid_p, BOOL num_ok);
uid_t match_uid(uid_t uid);
gid_t match_gid(gid_t gid, uint16 *flags_ptr);
const char *add_uid(uid_t uid);
@@ -328,25 +347,21 @@ void send_id_list(int f);
uid_t recv_user_name(int f, uid_t uid);
gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr);
void recv_id_list(int f, struct file_list *flist);
+void parse_name_map(char *map, BOOL usernames);
+const char *getallgroups(uid_t uid, gid_t *gid_list, int *size_ptr);
void set_nonblocking(int fd);
void set_blocking(int fd);
int fd_pair(int fd[2]);
void print_child_argv(const char *prefix, char **cmd);
-NORETURN void out_of_memory(const char *str);
-NORETURN void overflow_exit(const char *str);
-int set_modtime(const char *fname, time_t modtime, mode_t mode);
-int mkdir_defmode(char *fname);
-int create_directory_path(char *fname);
+int set_modtime(const char *fname, time_t modtime, uint32 mod_nsec, mode_t mode);
+int make_path(char *fname, int flags);
int full_write(int desc, const char *ptr, size_t len);
-int copy_file(const char *source, const char *dest, int ofd,
- mode_t mode, int create_bak_dir);
+int copy_file(const char *source, const char *dest, int ofd, mode_t mode);
int robust_unlink(const char *fname);
int robust_rename(const char *from, const char *to, const char *partialptr,
int mode);
pid_t do_fork(void);
void kill_all(int sig);
-int name_to_uid(const char *name, uid_t *uid_p);
-int name_to_gid(const char *name, gid_t *gid_p);
int lock_range(int fd, int offset, int len);
int glob_expand(const char *arg, char ***argv_p, int *argc_p, int *maxargs_p);
void glob_expand_module(char *base1, char *arg, char ***argv_p, int *argc_p, int *maxargs_p);
@@ -354,7 +369,7 @@ void strlower(char *s);
size_t pathjoin(char *dest, size_t destsize, const char *p1, const char *p2);
size_t stringjoin(char *dest, size_t destsize, ...);
int count_dir_elements(const char *p);
-unsigned int clean_fname(char *name, int flags);
+int clean_fname(char *name, int flags);
char *sanitize_path(char *dest, const char *p, const char *rootdir, int depth,
int flags);
int change_dir(const char *dir, int set_path_only);
@@ -363,16 +378,11 @@ char *full_fname(const char *fn);
char *partial_dir_fname(const char *fname);
int handle_partial_dir(const char *fname, int create);
int unsafe_symlink(const char *dest, const char *src);
-char *human_num(int64 num);
-char *human_dnum(double dnum, int decimal_digits);
char *timestring(time_t t);
-int msleep(int t);
int cmp_time(time_t file1, time_t file2);
int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);
-void *_new_array(unsigned long num, unsigned int size, int use_calloc);
-void *_realloc_array(void *ptr, unsigned int size, size_t num);
const char *find_filename_suffix(const char *fn, int fn_len, int *len_ptr);
-uint32 fuzzy_distance(const char *s1, int len1, const char *s2, int len2);
+uint32 fuzzy_distance(const char *s1, unsigned len1, const char *s2, unsigned len2);
struct bitbag *bitbag_create(int max_ndx);
void bitbag_set_bit(struct bitbag *bb, int ndx);
void bitbag_clear_bit(struct bitbag *bb, int ndx);
@@ -382,6 +392,12 @@ void flist_ndx_push(flist_ndx_list *lp, int ndx);
int flist_ndx_pop(flist_ndx_list *lp);
void *expand_item_list(item_list *lp, size_t item_size,
const char *desc, int incr);
+int msleep(int t);
+void *_new_array(unsigned long num, unsigned int size, int use_calloc);
+void *_realloc_array(void *ptr, unsigned int size, size_t num);
+const char *sum_as_hex(const char *sum);
+NORETURN void out_of_memory(const char *str);
+NORETURN void overflow_exit(const char *str);
void free_xattr(stat_x *sxp);
int get_xattr(const char *fname, stat_x *sxp);
int copy_xattrs(const char *source, const char *dest);
@@ -403,3 +419,5 @@ int x_stat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst);
int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst);
int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst);
int sys_gettimeofday(struct timeval *tv);
+char *do_big_num(int64 num, int human_flag, const char *fract);
+char *do_big_dnum(double dnum, int human_flag, int decimal_digits);