Alfred Perlstein wrote:
> 
> Ok, part of the mp cleanup got me looking at af_unix sockets.
> 
> Here's the deal, descriptors can be called "in-flight" meaning they
> have been passed from one application to another via
> CMG_DATA but not picked up on the other side yet.
> 
> The kernel does a bunch of hokey stuff to garbage collect them.

Check wih kirk as he always uses this as an example in his class
of something that is tricky..

> 
> Instead of doing that I'd like to abuse MEXTADD to setup a callback
> to remove the references automagicaly when the mbuf it free'd.
> 
> Here's the problem:
> 
>   I want to use the mbuf clusters, I don't want to use any special
>   external storage.  I want my callback to free the cluster.
> 
> Any hints on how to do this?
> 
> here's what I have so far:
> 
>     MEXTADD(control, mtod(control, char *), control->m_len, unp_mbfree,
>         cm, M_RDONLY, EXT_CMSG_DATA);
> 
> control is a mbuf with a cluster attached the has fd's written in it.
> cm is a pointer to the mbuf cluster.
> 
> static void
> unp_mbfree(caddr_t mm, void *claddr)
> {
>     struct mbuf *m = (struct mbuf *)mm;
> 
>     unp_scan(m, unp_discard);
>     _MCLFREE(claddr);
> }
> 
> does this look right?  would you like to abstract the mbuf
> clusters further before i started using the _ macros?
> 
> --
> -Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
> "I have the heart of a child; I keep it in a jar on my desk."
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-net" in the body of the message

-- 
      __--_|\  Julian Elischer
     /       \ [EMAIL PROTECTED]
    (   OZ    ) World tour 2000
---> X_.---._/  presently in:  Budapest
            v



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to