Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Dec 2000 01:48:37 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        bmilekic@freebsd.org
Cc:        net@freebsd.org
Subject:   Abusing m_ext for a worthy goal.
Message-ID:  <20001211014837.W16205@fw.wintelcom.net>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001211014837.W16205>