From owner-freebsd-net Tue Dec 12 4:24:49 2000 From owner-freebsd-net@FreeBSD.ORG Tue Dec 12 04:24:48 2000 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id C5DF337B400; Tue, 12 Dec 2000 04:24:47 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBCCOlh07432; Tue, 12 Dec 2000 04:24:47 -0800 (PST) Date: Tue, 12 Dec 2000 04:24:47 -0800 From: Alfred Perlstein To: net@freebsd.org Cc: bmilekic@freebsd.org Subject: need mbuf generic free() hook Message-ID: <20001212042447.E16205@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, so I'm trying to rid FreeBSD of the unp_gc() junk in uipc_usrreq.c I just realized why I'm leaking file descriptors: Only mbufs with external storage can have a 'free' function, the problem is that for the most part when passing a single fd I'm only using a single mbuf to pass my data around, my ext_free routine is probably never called, and on top of that I'm probably corrupting my mbuf by using it when I shouldn't be. This is terrible, what should be a simple free() hook is now my worst nightmare. A couple of options come to mind: a) always have a free hook, the extra if (m->m_freehook != NULL) check can't be that expensive. b) a macro to make an mbuf into an mbuf cluster that points to itself, it should check to see if it has enough room to shuffle the data and return an error if it can't accomidate both the data and the expanded mbug header. I like 'a' but would be willing to deal with 'b' as we've never had a need for this, although that would mean copying about the size of an mbuf in the worst case when a subsystem needs this facility. Suggestions? Comments? -- -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