[Linux-ha-dev] Confusion: client_lib.c vs ha_malloc.c

Alan Robertson alanr at unix.sh
Wed Jan 21 22:03:55 MST 2004


Horms wrote:
> On Wed, Jan 21, 2004 at 02:59:12PM -0700, Alan Robertson wrote:
> 
>>Lars Marowsky-Bree wrote:
>>
>>>Hi,
>>>
>>>we have several competing definitions of functions.
>>>
>>>ha_calloc, ha_strdup, ha_free, ha_malloc (maybe others). All are defined
>>>both in client_lib.c and with more checking in ha_malloc.c
>>>
>>>I'm at a loss. What gets used when and where and why?
>>>
>>>If, as horms speculates, one of them is supposedly used for the clients
>>>linking against the API and the others for heartbeat internally, why do
>>>they have the same name? *mumble mumble* And where is that documented?
>>
>>OK...
>>
>>Here's why they have the same name, but not the same implemenation.  It's 
>>not a really good story, but here it is anyway...
>>
>>There was no ha_strdup until horms created it I don't think...
>>
>>There are functions which are in common between the user space library and 
>>heartbeat.  Those functions use ha_malloc, et al.
>>
>>So there's a requirement that those functions have versions of those 
>>functions they can link against.
>>
>>On the other hand, they work the way they do, because of how heartbeat 
>>behaves, and that behavior (though not harmful) isn't probably needed on 
>>the client side.  And *when they were written*, they wasn't a separate 
>>utility library that's used by heartbeat and the client side.  So, I just 
>>put semi-dummy versions of these functions into the client library and 
>>forgot about it (to make the loader shut up).
>>
>>Nowadays, the right thing to do would be to move ha_malloc* functions to 
>>the clplumbing directory.  This is probably also desirable for the 
>>setproctitle() code that horms wrote, and maybe some other things too.
>>
>>I'll be accepting patches for this as soon as the next beta comes out ;-)
> 
> 
> Hi Alan,
> 
> That sounds like a good plan to me. Do you have any preferences
> for the name of said library?

How about just putting them in the clplumbing library ;-)



-- 
     Alan Robertson <alanr at unix.sh>

"Openness is the foundation and preservative of friendship...  Let me claim 
from you at all times your undisguised opinions." - William Wilberforce



More information about the Linux-HA-Dev mailing list