The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/cddl/dev/prototype.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * This file is freeware. You are free to use it and add your own
    3  * license.
    4  *
    5  * $FreeBSD$
    6  *
    7  */
    8 
    9 #include <sys/cdefs.h>
   10 #include <sys/param.h>
   11 #include <sys/systm.h>
   12 #include <sys/conf.h>
   13 #include <sys/kernel.h>
   14 #include <sys/module.h>
   15 
   16 #include <sys/dtrace.h>
   17 
   18 static d_open_t prototype_open;
   19 static int      prototype_unload(void);
   20 static void     prototype_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
   21 static void     prototype_provide(void *, dtrace_probedesc_t *);
   22 static void     prototype_destroy(void *, dtrace_id_t, void *);
   23 static void     prototype_enable(void *, dtrace_id_t, void *);
   24 static void     prototype_disable(void *, dtrace_id_t, void *);
   25 static void     prototype_load(void *);
   26 
   27 static struct cdevsw prototype_cdevsw = {
   28         .d_version      = D_VERSION,
   29         .d_open         = prototype_open,
   30         .d_name         = "prototype",
   31 };
   32 
   33 static dtrace_pattr_t prototype_attr = {
   34 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
   35 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
   36 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
   37 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
   38 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
   39 };
   40 
   41 static dtrace_pops_t prototype_pops = {
   42         .dtps_provide =         prototype_provide,
   43         .dtps_provide_module =  NULL,
   44         .dtps_enable =          prototype_enable,
   45         .dtps_disable =         prototype_disable,
   46         .dtps_suspend =         NULL,
   47         .dtps_resume =          NULL,
   48         .dtps_getargdesc =      prototype_getargdesc,
   49         .dtps_getargval =       NULL,
   50         .dtps_usermode =        NULL,
   51         .dtps_destroy =         prototype_destroy
   52 };
   53 
   54 static struct cdev              *prototype_cdev;
   55 static dtrace_provider_id_t     prototype_id;
   56 
   57 static void
   58 prototype_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc)
   59 {
   60 }
   61 
   62 static void
   63 prototype_provide(void *arg, dtrace_probedesc_t *desc)
   64 {
   65 }
   66 
   67 static void
   68 prototype_destroy(void *arg, dtrace_id_t id, void *parg)
   69 {
   70 }
   71 
   72 static void
   73 prototype_enable(void *arg, dtrace_id_t id, void *parg)
   74 {
   75 }
   76 
   77 static void
   78 prototype_disable(void *arg, dtrace_id_t id, void *parg)
   79 {
   80 }
   81 
   82 static void
   83 prototype_load(void *dummy)
   84 {
   85         /*
   86          * Create the /dev/dtrace/prototype entry.
   87          * XXX: Remove this if the provider does not need any customs ioctls.
   88          */
   89         prototype_cdev = make_dev(&prototype_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
   90             "dtrace/prototype");
   91 
   92         if (dtrace_register("prototype", &prototype_attr, DTRACE_PRIV_USER,
   93             NULL, &prototype_pops, NULL, &prototype_id) != 0)
   94                 return;
   95 }
   96 
   97 
   98 static int
   99 prototype_unload(void)
  100 {
  101         int error = 0;
  102 
  103         if ((error = dtrace_unregister(prototype_id)) != 0)
  104                 return (error);
  105 
  106         destroy_dev(prototype_cdev);
  107 
  108         return (error);
  109 }
  110 
  111 static int
  112 prototype_modevent(module_t mod __unused, int type, void *data __unused)
  113 {
  114         int error = 0;
  115 
  116         switch (type) {
  117         case MOD_LOAD:
  118                 break;
  119 
  120         case MOD_UNLOAD:
  121                 break;
  122 
  123         case MOD_SHUTDOWN:
  124                 break;
  125 
  126         default:
  127                 error = EOPNOTSUPP;
  128                 break;
  129 
  130         }
  131 
  132         return (error);
  133 }
  134 
  135 static int
  136 prototype_open(struct cdev *dev __unused, int oflags __unused, int devtype __unused, struct thread *td __unused)
  137 {
  138         return (0);
  139 }
  140 
  141 SYSINIT(prototype_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_load, NULL);
  142 SYSUNINIT(prototype_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_unload, NULL);
  143 
  144 DEV_MODULE(prototype, prototype_modevent, NULL);
  145 MODULE_VERSION(prototype, 1);
  146 MODULE_DEPEND(prototype, dtrace, 1, 1, 1);
  147 MODULE_DEPEND(prototype, opensolaris, 1, 1, 1);

Cache object: af91ba898208ecceb5874443e19149a2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.