rsync architecture

Matt McCutchen matt at mattmccutchen.net
Tue Dec 16 23:25:24 GMT 2008


On Mon, 2008-12-15 at 10:14 +0530, Jignesh Shah wrote: 
> I am trying to see the rsync source code. I could see that there are
> main three processes: I realize that Server or Client becomes Sender
> or Receiver based on arguments provided.

> 1. What is the roll of deamon process. How it different from server?
> Does it run always on remote machine? When I do rsync from client how
> remote deamon/server will get triggered?

In the context of rsync, the server is simply the rsync process that is
accessed on the user's behalf to handle one end of the transfer: the
remote end if there is one, or otherwise (arbitrarily) the destination.
A daemon is a server with some extra features controlled by a
configuration file: it limits clients to accessing areas of the
filesystem defined as "modules", and it can optionally listen on a port
for any number of client connections (which it handles individually).

An rsync client can fork a server locally, invoke a plain server over
remote shell, connect to a listening daemon, or invoke a single-use
daemon over remote shell.  In the last two cases, rsync carries out a
"daemon protocol" before the main transfer protocol begins.

(Now that I've taken the time to write a complete, concise explanation,
maybe it will eventually find its way into my revised man page.)

> 2 .Where the arguments are being set. I cannot see any of
> arguments(like am_server, am_deamon etc) is being set anywhere.

They are set from the --daemon and --server command-line arguments.
"git grep" is your friend:

rsync $ git grep -E -n 'am_(server|daemon) ='
cleanup.c:110: am_server = 2;
clientserver.c:773: am_server = 1; /* Don't let someone try to be
tricky. */
options.c:79:int am_server = 0;
options.c:100:int am_daemon = 0;
options.c:1305: am_server = 1;
options.c:1386: am_daemon = 1;
pipe.c:135: am_server = 1; 

-- 
Matt



More information about the rsync mailing list