From owner-freebsd-net Mon Dec 11 13:29:35 2000 From owner-freebsd-net@FreeBSD.ORG Mon Dec 11 13:29:32 2000 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mail.interware.hu (mail.interware.hu [195.70.32.130]) by hub.freebsd.org (Postfix) with ESMTP id C12BA37B400; Mon, 11 Dec 2000 13:29:31 -0800 (PST) Received: from victoria-117.budapest.interware.hu ([195.70.63.117] helo=elischer.org) by mail.interware.hu with esmtp (Exim 3.16 #1 (Debian)) id 145aVl-0001n5-00; Mon, 11 Dec 2000 22:29:29 +0100 Sender: julian@FreeBSD.ORG Message-ID: <3A34E04B.D93AFCB@elischer.org> Date: Mon, 11 Dec 2000 06:10:19 -0800 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: Alfred Perlstein Cc: bmilekic@freebsd.org, net@freebsd.org Subject: Re: Abusing m_ext for a worthy goal. References: <20001211014837.W16205@fw.wintelcom.net> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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