414 /*
415 * Inform the vnode of the new mapping.
416 */
417 /*
418 * It is ok to use pass sdp->maxprot to ADDMAP rather than to use
419 * dhp specific maxprot because spec_addmap does not use maxprot.
420 */
421 error = VOP_ADDMAP(VTOCVP(sdp->vp), sdp->offset,
422 seg->s_as, seg->s_base, seg->s_size,
423 sdp->prot, sdp->maxprot, sdp->type, CRED(), NULL);
424
425 if (error != 0) {
426 sdp->devmap_data = NULL;
427 hat_unload(seg->s_as->a_hat, seg->s_base, seg->s_size,
428 HAT_UNLOAD_UNMAP);
429 } else {
430 /*
431 * Mappings of /dev/null don't count towards the VSZ of a
432 * process. Mappings of /dev/null have no mapping type.
433 */
434 if ((SEGOP_GETTYPE(seg, (seg)->s_base) & (MAP_SHARED |
435 MAP_PRIVATE)) == 0) {
436 seg->s_as->a_resvsize -= seg->s_size;
437 }
438 }
439
440 return (error);
441 }
442
443 static struct segdev_data *
444 sdp_alloc(void)
445 {
446 struct segdev_data *sdp;
447
448 sdp = kmem_zalloc(sizeof (struct segdev_data), KM_SLEEP);
449 rw_init(&sdp->lock, NULL, RW_DEFAULT, NULL);
450
451 return (sdp);
452 }
453
454 /*
|
414 /*
415 * Inform the vnode of the new mapping.
416 */
417 /*
418 * It is ok to use pass sdp->maxprot to ADDMAP rather than to use
419 * dhp specific maxprot because spec_addmap does not use maxprot.
420 */
421 error = VOP_ADDMAP(VTOCVP(sdp->vp), sdp->offset,
422 seg->s_as, seg->s_base, seg->s_size,
423 sdp->prot, sdp->maxprot, sdp->type, CRED(), NULL);
424
425 if (error != 0) {
426 sdp->devmap_data = NULL;
427 hat_unload(seg->s_as->a_hat, seg->s_base, seg->s_size,
428 HAT_UNLOAD_UNMAP);
429 } else {
430 /*
431 * Mappings of /dev/null don't count towards the VSZ of a
432 * process. Mappings of /dev/null have no mapping type.
433 */
434 if ((segop_gettype(seg, seg->s_base) & (MAP_SHARED |
435 MAP_PRIVATE)) == 0) {
436 seg->s_as->a_resvsize -= seg->s_size;
437 }
438 }
439
440 return (error);
441 }
442
443 static struct segdev_data *
444 sdp_alloc(void)
445 {
446 struct segdev_data *sdp;
447
448 sdp = kmem_zalloc(sizeof (struct segdev_data), KM_SLEEP);
449 rw_init(&sdp->lock, NULL, RW_DEFAULT, NULL);
450
451 return (sdp);
452 }
453
454 /*
|