#define KEV_EVTID(code) BSDDBG_CODE(DBG_BSD_KEVENT, (code))
-MALLOC_DEFINE(M_KQUEUE, "kqueue", "memory for kqueue system");
+/*
+ * If you need accounting for KM_KQUEUE consider using
+ * KALLOC_HEAP_DEFINE to define a zone view.
+ */
+#define KM_KQUEUE KHEAP_DEFAULT
#define KQ_EVENT NO_EVENT64
}
}
/* free the table */
- FREE(fdp->fd_knlist, M_KQUEUE);
- fdp->fd_knlist = NULL;
+ kheap_free(KM_KQUEUE, fdp->fd_knlist,
+ fdp->fd_knlistsize * sizeof(struct klist *));
}
fdp->fd_knlistsize = 0;
goto out_locked;
}
- MALLOC(list, struct klist *,
- size * sizeof(struct klist *), M_KQUEUE, M_WAITOK);
+ list = kheap_alloc(KM_KQUEUE, size * sizeof(struct klist *),
+ Z_WAITOK);
if (list == NULL) {
ret = ENOMEM;
goto out_locked;
bzero((caddr_t)list +
fdp->fd_knlistsize * sizeof(struct klist *),
(size - fdp->fd_knlistsize) * sizeof(struct klist *));
- FREE(fdp->fd_knlist, M_KQUEUE);
+ kheap_free(KM_KQUEUE, fdp->fd_knlist,
+ fdp->fd_knlistsize * sizeof(struct klist *));
fdp->fd_knlist = list;
fdp->fd_knlistsize = size;
}
ROUNDUP64(sizeof(struct xsockstat_n));
struct kern_event_pcb *ev_pcb;
- buf = _MALLOC(item_size, M_TEMP, M_WAITOK | M_ZERO);
+ buf = kheap_alloc(KHEAP_TEMP, item_size, Z_WAITOK | Z_ZERO);
if (buf == NULL) {
return ENOMEM;
}
done:
lck_rw_done(&kev_rwlock);
- if (buf != NULL) {
- FREE(buf, M_TEMP);
- }
-
+ kheap_free(KHEAP_TEMP, buf, item_size);
return error;
}
err = copyout(kqext, ubuf, sizeof(struct kevent_extinfo) * MIN(buflen, nknotes));
out:
- if (kqext) {
- kheap_free(KHEAP_TEMP, kqext, buflen * sizeof(struct kevent_extinfo));
- kqext = NULL;
- }
+ kheap_free(KHEAP_TEMP, kqext, buflen * sizeof(struct kevent_extinfo));
if (!err) {
*retval = (int32_t)MIN(nknotes, PROC_PIDFDKQUEUE_KNOTES_MAX);