Home | History | Annotate | Line # | Download | only in dtrace
dtrace_test.c revision 1.1
      1  1.1  darran /*-
      2  1.1  darran  * Copyright 2008 John Birrell <jb (at) FreeBSD.org>
      3  1.1  darran  *
      4  1.1  darran  * Redistribution and use in source and binary forms, with or without
      5  1.1  darran  * modification, are permitted provided that the following conditions
      6  1.1  darran  * are met:
      7  1.1  darran  * 1. Redistributions of source code must retain the above copyright
      8  1.1  darran  *    notice, this list of conditions and the following disclaimer.
      9  1.1  darran  * 2. Redistributions in binary form must reproduce the above copyright
     10  1.1  darran  *    notice, this list of conditions and the following disclaimer in the
     11  1.1  darran  *    documentation and/or other materials provided with the distribution.
     12  1.1  darran  *
     13  1.1  darran  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     14  1.1  darran  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     15  1.1  darran  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     16  1.1  darran  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
     17  1.1  darran  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     18  1.1  darran  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     19  1.1  darran  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     20  1.1  darran  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     21  1.1  darran  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     22  1.1  darran  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     23  1.1  darran  * SUCH DAMAGE.
     24  1.1  darran  *
     25  1.1  darran  * $FreeBSD: src/sys/cddl/dev/dtrace/dtrace_test.c,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
     26  1.1  darran  *
     27  1.1  darran  */
     28  1.1  darran 
     29  1.1  darran #include <sys/cdefs.h>
     30  1.1  darran #include <sys/types.h>
     31  1.1  darran #include <sys/param.h>
     32  1.1  darran #include <sys/conf.h>
     33  1.1  darran #include <sys/kernel.h>
     34  1.1  darran #include <sys/module.h>
     35  1.1  darran #include <sys/vnode.h>
     36  1.1  darran 
     37  1.1  darran /*
     38  1.1  darran  * These are variables that the DTrace test suite references in the
     39  1.1  darran  * Solaris kernel. We define them here so that the tests function
     40  1.1  darran  * unaltered.
     41  1.1  darran  */
     42  1.1  darran int	kmem_flags;
     43  1.1  darran 
     44  1.1  darran typedef struct vnode vnode_t;
     45  1.1  darran vnode_t dummy;
     46  1.1  darran vnode_t *rootvp = &dummy;
     47  1.1  darran 
     48  1.1  darran static int
     49  1.1  darran dtrace_test_modevent(module_t mod, int type, void *data)
     50  1.1  darran {
     51  1.1  darran 	int error = 0;
     52  1.1  darran 
     53  1.1  darran 	switch (type) {
     54  1.1  darran 	case MOD_LOAD:
     55  1.1  darran 		break;
     56  1.1  darran 
     57  1.1  darran 	case MOD_UNLOAD:
     58  1.1  darran 		break;
     59  1.1  darran 
     60  1.1  darran 	case MOD_SHUTDOWN:
     61  1.1  darran 		break;
     62  1.1  darran 
     63  1.1  darran 	default:
     64  1.1  darran 		error = EOPNOTSUPP;
     65  1.1  darran 		break;
     66  1.1  darran 
     67  1.1  darran 	}
     68  1.1  darran 	return (error);
     69  1.1  darran }
     70  1.1  darran 
     71  1.1  darran DEV_MODULE(dtrace_test, dtrace_test_modevent, NULL);
     72  1.1  darran MODULE_VERSION(dtrace_test, 1);
     73  1.1  darran MODULE_DEPEND(dtrace_test, dtraceall, 1, 1, 1);
     74