• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
ENOBUFS calling ctl_enqueuembuf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ENOBUFS calling ctl_enqueuembuf


  • Subject: ENOBUFS calling ctl_enqueuembuf
  • From: Adam Schepis <email@hidden>
  • Date: Tue, 14 Jan 2014 08:56:18 -0500

I’m writing a socket filter and when communicating with my daemon i’m now receiving ENOBUFS whenever i call ctl_enqueuembuf

i ran netstat -mm and get:

class        buf   active   ctotal    total cache   cached uncached    memory
name        size     bufs     bufs     bufs state     bufs     bufs     usage
---------- ----- -------- -------- -------- ----- -------- -------- ---------
mbuf         256     1206      340     1376    on       46      124   85.0 KB
cl          2048     1034       28     1062    on        2       26   56.0 KB
bigcl       4096        2      310      312    on        0      310    1.2 MB
16kcl      16384        1        7        8    on        0        7  112.0 KB
mbuf_cl     2304     1025     1034     1034    on        9        0    2.3 MB
mbuf_bigcl  4352        0        2        2    on        2        0    8.5 KB
mbuf_16kcl 16640        0        1        1    on        1        0   16.2 KB

1194/1206 mbufs in use:
	1060 mbufs allocated to data
	113 mbufs allocated to ancillary data
	21 mbufs allocated to socket names and addresses
	12 mbufs allocated to caches
1025/1062 mbuf 2KB clusters in use
0/312 mbuf 4KB clusters in use
0/8 mbuf 16KB clusters in use
3844 KB allocated to network (61.1% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to drain routines

This output changes very little and persists even after reboot.

ctl_getenqueuespace reliably returns 8196 bytes

The dev machine i’m running is Mavericks running in VMWare Fusion (so i can debug kernel panics)

here is a paste of the code in question:

kern_return_t control_socket_enqueue(mbuf_t data) {
    LOGDEBUG("%s\n", __PRETTY_FUNCTION__);
    kern_return_t res = KERN_SUCCESS;
    size_t space = 0;

    if (accountability_ctl_active_conn == NULL) {
        LOGDEBUG("NO CONTROL SOCKET ATTACHED\n");
        res = KERN_INVALID_ARGUMENT;
    }
    else {
        LOGDEBUG("ENQUEING MBUF. %llu(unit_id: %d)\n",
                 (u_int64_t)accountability_ctl_active_conn,
                 accountability_ctl_active_conn->sc_unit);

        res = ctl_getenqueuespace(accountability_ctlref,
                                  accountability_ctl_active_conn->sc_unit,
                                  &space);
        if (res) {
            LOGDEBUG("failed to get space remaining in queue. err=%d\n", res);
        }
        else {
            LOGDEBUG("free in queue: %d\n", (int)space);
        }

        mbuf_t send_buf;
        res = mbuf_dup(data, MBUF_WAITOK, &send_buf);
        if (res) {
            LOGDEBUG("failed to copy mbuf. err=%d\n", res);
        }
        else {
            res = ctl_enqueuembuf(accountability_ctlref, accountability_ctl_active_conn->sc_unit, send_buf, CTL_DATA_EOR);
            if (res) {
                LOGDEBUG("failed to enqueue data to control socket. err=%d\n", res);
                mbuf_freem(send_buf);
            }
            else {
                LOGDEBUG("successfully enqueued data to control socket.\n");
            }
        }
    }
    return res;
}


pretty confused at this point as i’m not sure why exactly ENOBUFS is being returned.  The only thing i’m certain of is that it is my fault!
Any help for tutelage would be much appreciated.

Thanks,
Adam
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Zone information for address
      • From: nemo <email@hidden>
    • Re: ENOBUFS calling ctl_enqueuembuf
      • From: Vincent Lubet <email@hidden>
  • Prev by Date: Re: Mavericks kernel panic debugging
  • Next by Date: Re: ENOBUFS calling ctl_enqueuembuf
  • Previous by thread: Re: Downloading OS X 10.9 source code
  • Next by thread: Re: ENOBUFS calling ctl_enqueuembuf
  • Index(es):
    • Date
    • Thread