#include <sys/sunddi.h>
int prefixmapdev_dup(ddi_mapdev_handle_t handle, void *devprivate, ddi_mapdev_handle_t new_handle, void **new_devprivatep);
Solaris DDI specific (Solaris DDI).
mapdev_dup() is called when a device mapping is duplicated such as through fork(2) . mapdev_dup() is expected to generate new driver private data for the new mapping, and set new_devprivatep to point to it. new_handle is the handle of the new mapped object.
A non-zero return value from mapdev_dup() will cause the corresponding operation, such as fork() to fail.
static int xxmapdev_dup(ddi_mapdev_handle_t handle, void *devprivate, ddi_mapdev_handle_t new_handle, void **new_devprivate) { struct xxpvtdata *pvtdata; /* Allocate a new private data structure */ pvtdata = kmem_alloc(sizeof (struct xxpvtdata), KM_SLEEP); /* Copy the old data to the new - device dependent*/ ... /* Return the new data */ *new_pvtdata = pvtdata; return (0); }