pcp
[Top] [All Lists]

Re: [pcp] PCP Updates: Allow Connection to PMCD via Unix Domain Sockets

To: Dave Brolley <brolley@xxxxxxxxxx>
Subject: Re: [pcp] PCP Updates: Allow Connection to PMCD via Unix Domain Sockets
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Mon, 15 Jul 2013 20:09:22 -0400 (EDT)
Cc: PCP <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <51E44DFA.9040402@xxxxxxxxxx>
References: <51D5E449.7010304@xxxxxxxxxx> <1032942944.13639792.1373005231784.JavaMail.root@xxxxxxxxxx> <51E44DFA.9040402@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: coQqhEMYEjtn2ia/1A9fa3+7VUXEUg==
Thread-topic: PCP Updates: Allow Connection to PMCD via Unix Domain Sockets

----- Original Message -----
> 
> Hi Nathan,
> 
> I've attached two patches for review:
> __pmUnparseHostAttrsSpec.patch: Adds the missing code for supporting
> local:// and unix://. This fixes test 720

Ah, good catch!

> and produces reasonable output for test 875 (also attached).

Looks good.

> memoryleak.patch: fixes the memory leak in the parsehostattrs.c. I based
> freeing the hash array in the caller on similar code in logutil.c. Would
> it may make more sense to free it in __pmFreeHostAttrsSpec()?

Hmm, we seem to be exposing too much hash internals don't we?  This has
been pointed out on initialising the hashctl as well - doing a memset on
the structure (or struct-assign-to-zero) is arguably a bit awkward.

Could we add two new interfaces here:
- __pmHashInit which wraps up the initial struct-zero-memset to setup
- __pmHashClear which hides the free() on the hash field.  It should also
  reset the hsize field to zero so that subsequent __pmHashAdd calls can
  still use the hash instead of crashing.

Then, the test program could be updated to use those, and all would be well.

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>