Skip to content

Instantly share code, notes, and snippets.

@aschepis
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save aschepis/6e9b7fe9f71d5a64824f to your computer and use it in GitHub Desktop.

Select an option

Save aschepis/6e9b7fe9f71d5a64824f to your computer and use it in GitHub Desktop.
OSMalloc Tag
#include <mach/mach_types.h>
#include <sys/systm.h>
#include <libkern/OSMalloc.h>
OSMallocTag tut_mtag = (OSMallocTag)NULL;
kern_return_t network_filter_tutorial_start(kmod_info_t * ki, void *d);
kern_return_t network_filter_tutorial_stop(kmod_info_t *ki, void *d);
kern_return_t network_filter_tutorial_start(kmod_info_t * ki, void *d) {
tut_mtag = OSMalloc_Tagalloc("NetworkFilterTutorial", OSMT_DEFAULT);
return KERN_SUCCESS;
}
kern_return_t network_filter_tutorial_stop(kmod_info_t *ki, void *d) {
OSMalloc_Tagfree(tut_mtag);
return KERN_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment