dtrace_link.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/*
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CDDL HEADER START
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Common Development and Distribution License, Version 1.0 only
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the "License"). You may not use this file except in compliance
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * or http://www.opensolaris.org/os/licensing.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing permissions
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL HEADER in each
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below this CDDL HEADER, with the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * fields enclosed by brackets "[]" replaced with your own identifying
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * information: Portions Copyright [yyyy] [name of copyright owner]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * CDDL HEADER END
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/*
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Use is subject to license terms.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
f015d695b84915f1c2c3fcf81f339548af1852c4Peter Major#pragma ident "%Z%%M% %I% %E% SMI"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#include <devfsadm.h>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#include <strings.h>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#include <sys/dtrace.h>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic int dtrace(di_minor_t minor, di_node_t node);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstatic devfsadm_create_t dtrace_create_cbt[] = {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster { "pseudo", "ddi_pseudo", "dtrace",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster TYPE_EXACT | DRV_EXACT, ILEVEL_0, dtrace
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster};
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterDEVFSADM_CREATE_INIT_V0(dtrace_create_cbt);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
2cdbc4fc62ed8b9c2c8ef660adc4fe0188b65407Neil Maddenstatic int
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdtrace(di_minor_t minor, di_node_t node)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster{
cd085ff36bed57615d33434450ffc7c44ca016edDavid Luna char *mname = di_minor_name(minor);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (strcmp(DTRACEMNR_HELPER, mname) == 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (void) devfsadm_mklink("dtrace/" DTRACEMNR_HELPER,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node, minor, 0);
cd085ff36bed57615d33434450ffc7c44ca016edDavid Luna }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (DEVFSADM_CONTINUE);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster