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/samples/markers/marker-example.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 /* marker-example.c
    2  *
    3  * Executes a marker when /proc/marker-example is opened.
    4  *
    5  * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
    6  *
    7  * This file is released under the GPLv2.
    8  * See the file COPYING for more details.
    9  */
   10 
   11 #include <linux/module.h>
   12 #include <linux/marker.h>
   13 #include <linux/sched.h>
   14 #include <linux/proc_fs.h>
   15 
   16 struct proc_dir_entry *pentry_example;
   17 
   18 static int my_open(struct inode *inode, struct file *file)
   19 {
   20         int i;
   21 
   22         trace_mark(subsystem_event, "integer %d string %s", 123,
   23                 "example string");
   24         for (i = 0; i < 10; i++)
   25                 trace_mark(subsystem_eventb, MARK_NOARGS);
   26         return -EPERM;
   27 }
   28 
   29 static struct file_operations mark_ops = {
   30         .open = my_open,
   31 };
   32 
   33 static int example_init(void)
   34 {
   35         printk(KERN_ALERT "example init\n");
   36         pentry_example = proc_create("marker-example", 0444, NULL, &mark_ops);
   37         if (!pentry_example)
   38                 return -EPERM;
   39         return 0;
   40 }
   41 
   42 static void example_exit(void)
   43 {
   44         printk(KERN_ALERT "example exit\n");
   45         remove_proc_entry("marker-example", NULL);
   46 }
   47 
   48 module_init(example_init)
   49 module_exit(example_exit)
   50 
   51 MODULE_LICENSE("GPL");
   52 MODULE_AUTHOR("Mathieu Desnoyers");
   53 MODULE_DESCRIPTION("Marker example");

Cache object: 38f6f61f74a21ad478c14a624d347392


[ 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.