rsync on OpenVMS
John E. Malmberg
wb8tyw at qsl.net
Thu Oct 23 13:59:48 EST 2003
jw schultz wrote:
> On Tue, Oct 21, 2003 at 11:28:11PM -0400, John E. Malmberg wrote:
>>There are approximately 235 global and static variables in rsync, and
>>of those 105 are obviously never modified after the fork() takes place.
>> That may be the case for several of the others, like the 10 in batch.c
>>As the use of the remaining ones are identified, that issue is easily
>>fixed. What I need to do is map the routines called by the receive
>>process/thread to see what static/global variables that they modify.
> If you put the ones that get modified post-fork into a
> thread-local structure there is a reasonable chance of that
> getting into mainline.
Now what would be more acceptable:
Adding a context parameter to all the routines that reference the
global/static variables that are currently shared?
Having each routine that uses those type of variables to go through the
work of determining which thread that they are in?
It seems to me that adding the context parameter would make it easier to
maintain, and have a lower overhead. It also saves having thread lookup
calls added to the routines.
In some other cases, it looks like the sharing should not hurt, but
their should be some synchronization.
Since there are only two processes or threads that need to be tracked,
while the parameter could be a pointer to global structure, it can be
disruptive to put all the local thread specific static values in that
structure. Mainly because a lot of them have the same symbol names,
just different scope.
So there could be a global variable that is void * recv_context, and a
void * send_context for the sender for completeness.
A routine that needs separate local static variables would check the
context parameter passed to it against one of those pointers, and then
use the appropriate set of local variables.
With this, the static variables would become an array, and the context
parameter would determine if index 0 or 1 was used.
wb8tyw at qsl.net
Personal Opinion Only
More information about the rsync