This source file includes following definitions.
- kdb_hello_cmd
- kdb_hello_cmd_init
- kdb_hello_cmd_exit
1
2
3
4
5
6
7
8
9
10
11 #include <linux/module.h>
12 #include <linux/kdb.h>
13
14
15
16
17
18 static int kdb_hello_cmd(int argc, const char **argv)
19 {
20 if (argc > 1)
21 return KDB_ARGCOUNT;
22
23 if (argc)
24 kdb_printf("Hello %s.\n", argv[1]);
25 else
26 kdb_printf("Hello world!\n");
27
28 return 0;
29 }
30
31
32 static int __init kdb_hello_cmd_init(void)
33 {
34
35
36
37
38
39
40
41
42
43
44
45 kdb_register("hello", kdb_hello_cmd, "[string]",
46 "Say Hello World or Hello [string]", 0);
47 return 0;
48 }
49
50 static void __exit kdb_hello_cmd_exit(void)
51 {
52 kdb_unregister("hello");
53 }
54
55 module_init(kdb_hello_cmd_init);
56 module_exit(kdb_hello_cmd_exit);
57
58 MODULE_AUTHOR("WindRiver");
59 MODULE_DESCRIPTION("KDB example to add a hello command");
60 MODULE_LICENSE("GPL");