From 389cc1ba8d9e673f1313fd966820c6d9d463525f Mon Sep 17 00:00:00 2001 From: 0xwille Date: Tue, 12 Jul 2011 20:51:00 +0200 Subject: AƱadido pid --- lists/lists.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lists/lists.c (limited to 'lists/lists.c') diff --git a/lists/lists.c b/lists/lists.c new file mode 100644 index 0000000..2eee70c --- /dev/null +++ b/lists/lists.c @@ -0,0 +1,41 @@ +#include +#include + +#define LENGTH 5 + +struct node { + struct list_head l; + int dato; +}; + +int init_module(void) +{ + int i; + struct node head, aux[LENGTH], *aux2; + struct list_head* iter; + + INIT_LIST_HEAD(&head.l); + head.dato = 666; + + for (i = 0; i < LENGTH; i++) { + aux[i].dato = i; + + list_add_tail(&aux[i].l, &head.l); + } + + list_for_each(iter, &head.l) { + aux2 = list_entry(iter, struct node, l); + printk(KERN_INFO "%d", aux2->dato); + } + + printk(KERN_INFO "Por cierto, en 0x0 hay: %d", ((struct node *)0)->dato); + + return 0; +} + +void cleanup_module(void) +{ +} + +MODULE_AUTHOR("Guillermo Ramos"); +MODULE_LICENSE("GPL"); -- cgit v1.2.3