Date: Mon, 11 Dec 2000 06:10:19 -0800 From: Julian Elischer <julian@elischer.org> To: Alfred Perlstein <bright@wintelcom.net> Cc: bmilekic@freebsd.org, net@freebsd.org Subject: Re: Abusing m_ext for a worthy goal. Message-ID: <3A34E04B.D93AFCB@elischer.org> References: <20001211014837.W16205@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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 - [bright@wintelcom.net|alfred@freebsd.org] > "I have the heart of a child; I keep it in a jar on my desk." > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message -- __--_|\ Julian Elischer / \ julian@elischer.org ( OZ ) World tour 2000 ---> X_.---._/ presently in: Budapest v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A34E04B.D93AFCB>