From owner-freebsd-net Mon Dec 11 3:58:57 2000 From owner-freebsd-net@FreeBSD.ORG Mon Dec 11 03:58:52 2000 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6C2537B6E5; Mon, 11 Dec 2000 03:58:13 -0800 (PST) Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8748C6E2FE0; Mon, 11 Dec 2000 01:49:52 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBB9mbv23357; Mon, 11 Dec 2000 01:48:37 -0800 (PST) Date: Mon, 11 Dec 2000 01:48:37 -0800 From: Alfred Perlstein To: bmilekic@freebsd.org Cc: net@freebsd.org Subject: Abusing m_ext for a worthy goal. Message-ID: <20001211014837.W16205@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: bright@fw.wintelcom.net Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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. 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